Class ControllerUtil

java.lang.Object
org.fulib.fx.util.ControllerUtil

public class ControllerUtil extends Object
  • Method Details

    • isComponent

      public static boolean isComponent(@Nullable @Nullable Object instance)
      Checks if an instance is a component (controller extending a Node).

      This method is used internally by the framework and shouldn't be required for developers.

      Parameters:
      instance - The instance to check
      Returns:
      True if the instance is a component (controller extending a Node)
    • isComponent

      public static boolean isComponent(@Nullable @Nullable Class<?> clazz)
      Checks if a class is a component (controller extending a Node).

      This method is used internally by the framework and shouldn't be required for developers.

      Parameters:
      clazz - The clazz to check
      Returns:
      True if the clazz is a component (controller extending a Node)
    • isController

      public static boolean isController(@Nullable @Nullable Object instance)
      Checks if an instance is a controller or a component.

      This method is used internally by the framework and shouldn't be required for developers.

      Parameters:
      instance - The instance to check
      Returns:
      True if the instance is a controller
    • canProvideSubComponent

      public static boolean canProvideSubComponent(Field field)
      Checks if the given field is a field that can provide a component.
      Parameters:
      field - The field to check
      Returns:
      True if the field is a field that can provide a component
    • transform

      @NotNull public static @NotNull String transform(@NotNull @NotNull String className)
      Transforms a class name to a fxml file name or id using the default naming scheme. Used if no path is specified in the Controller.view() annotation.

      Example: ExampleController --> example

      Note that this method could result in funky names if the class name doesn't follow the naming scheme.

      Parameters:
      className - The name of the class (should be Class.getName() or Class.getSimpleName()
      Returns:
      The transformed name
    • requireControllerProvider

      public static void requireControllerProvider(@NotNull @NotNull Field field)
      Checks if the given field is a valid route field. A valid route field is a field that is annotated with Route and is of type Provider where the generic type is a class annotated with Controller or Component.
      Parameters:
      field - The field to check
      Throws:
      InvalidRouteFieldException - If the field is not a valid route field