001/*
002 * Copyright 2019-2021 M. Sean Gilligan.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package app.supernaut.fx.fxml;
017
018import javafx.fxml.FXMLLoader;
019
020import java.net.URL;
021
022/**
023 * Factory interface for providing DI-enabled instances of {@link FXMLLoader}
024 */
025public interface FxmlLoaderFactory {
026    /**
027     * Get the FXML controller (from a DI context)
028     *
029     * @param clazz The controller class we are looking for
030     * @param <T> The class type of the controller
031     * @return A controller instance
032     */
033    <T> T getControllerFactory(Class<T> clazz);
034
035    /**
036     * Get an FXMLLoader without setting a location
037     *
038     * @return An FXMLLoader
039     */
040    FXMLLoader get();
041
042    /**
043     * Get an FXMLLoader for the given location
044     *
045     * @param location The location of the FXML resource
046     * @return An FXMLLoader
047     */
048    FXMLLoader get(URL location);
049
050}