Class ControllerBuildFactory

java.lang.Object
org.fulib.fx.controller.building.ControllerBuildFactory
All Implemented Interfaces:
javafx.util.BuilderFactory

@Internal public class ControllerBuildFactory extends Object implements javafx.util.BuilderFactory
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.
  • Constructor Details

    • ControllerBuildFactory

      public ControllerBuildFactory(@NotNull @NotNull Object instance)
  • Method Details

    • getBuilder

      public javafx.util.Builder<?> getBuilder(Class<?> type)
      Specified by:
      getBuilder in interface javafx.util.BuilderFactory
    • getProvidedInstance

      public Object getProvidedInstance(Class<?> type)
      Searches the controller class for a field annotated with SubComponent that provides an instance of the given type. If no matching field is found, the framework will look for a provider field annotated with SubComponent. If no matching provider is found, the framework will throw an exception.
      Parameters:
      type - The type of the subcomponent
      Returns:
      The instance of the subcomponent