Class ControllerUtil
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancanProvideSubComponent(Field field) Checks if the given field is a field that can provide a component.static voidcheckOverrides(Method method) Utility method for checking if a method overrides another event method.static booleanisComponent(@Nullable Class<?> clazz) Checks if a class is a component (controller extending a Node).static booleanisComponent(@Nullable Object instance) Checks if an instance is a component (controller extending a Node).static booleanisController(@Nullable Class<?> clazz) Checks if a class is a controller.static booleanisController(@Nullable Object instance) Checks if an instance is a controller.static booleanisControllerOrComponent(@Nullable Class<?> clazz) Checks if a class is a controller or a component.static booleanisControllerOrComponent(@Nullable Object instance) Checks if an instance is a controller or a component.static booleanisEventMethod(@NotNull Method method) 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.
-
Field Details
-
EVENT_ANNOTATIONS
-
-
Method Details
-
isComponent
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
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)
-
isControllerOrComponent
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 or component
-
isController
Checks if an instance is a controller.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
-
isController
Checks if a class is a controller.This method is used internally by the framework and shouldn't be required for developers.
- Parameters:
clazz- The class to check- Returns:
- True if the class is a controller
-
isControllerOrComponent
Checks if a class is a controller or a component.- Parameters:
clazz- The class to check- Returns:
- True if the class is a controller or a component
-
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:
RuntimeException- If the field is not a valid route field
-
isEventMethod
- Parameters:
method- The method to check- Returns:
- Whether the method is annotated with an event annotation
-
checkOverrides
Utility method for checking if a method overrides another event method.If a method overrides another method and the overridden method is an event method, calling the superclass method results in the subclass method being called twice due to how java handles method overrides.
- Parameters:
method- The method to check
-