
org.fulib.fx.controller.building.ControllerBuildFactory Maven / Gradle / Ivy
package org.fulib.fx.controller.building;
import javafx.util.Builder;
import javafx.util.BuilderFactory;
import org.fulib.fx.annotation.controller.Component;
import org.fulib.fx.annotation.controller.SubComponent;
import org.fulib.fx.util.ReflectionUtil;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import javax.inject.Provider;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.fulib.fx.util.FrameworkUtil.error;
/**
* A custom building-factory for instantiating controllers. If an element in an FXML file is of a class annotated with @Controller and a field providing an instance of the same class exists, the provided instance will be used as the controller for the element.
*/
@ApiStatus.Internal
public class ControllerBuildFactory implements BuilderFactory {
private final Object instance;
// Cache for subcontroller instances, mapped by class -> instance/provider
private final Map, List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy