Package org.fulib.fx.util
Class ControllerUtil
java.lang.Object
org.fulib.fx.util.ControllerUtil
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleancanProvideSubComponent(Field field) Checks if the given field is a field that can provide a component.static booleanisComponent(@Nullable Object instance) Checks if an instance is a component (controller extending a Parent).static booleanisController(@Nullable Object instance) Checks if an instance is a controller or a component.static voidrequireControllerProvider(@NotNull Field field) Checks if the given field is a valid route field.static @NotNull StringTransforms a class name to a fxml file name or id using the default naming scheme.
-
Method Details
-
isComponent
Checks if an instance is a component (controller extending a Parent).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 Parent)
-
isController
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
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
Transforms a class name to a fxml file name or id using the default naming scheme. Used if no path is specified in theController.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 beClass.getName()orClass.getSimpleName()- Returns:
- The transformed name
-
requireControllerProvider
Checks if the given field is a valid route field. A valid route field is a field that is annotated withRouteand is of typeProviderwhere the generic type is a class annotated withControllerorComponent.- Parameters:
field- The field to check- Throws:
InvalidRouteFieldException- If the field is not a valid route field
-