Class LifecycleHelper
java.lang.Object
com.blackbuild.klum.ast.runtime.internal.LifecycleHelper
Helper class that encapsulates lifecycle relevant methods. This reduces the complexity of KlumInstanceProxy.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidexecuteLifecycleClosures(InternalKlumBuilder<?> builder, Class<? extends Annotation> annotation) Executes all closures annotated with the given annotation on the DSL instance of the proxy.static voidexecuteLifecycleClosures(KlumInstanceProxy proxy, Class<? extends Annotation> annotation) Deprecated, for removal: This API element is subject to removal in a future version.static voidexecuteLifecycleMethods(InternalKlumBuilder<?> builder, Class<? extends Annotation> annotation) Executes all methods annotated with the given annotation on the rw instance of the proxy.static voidexecuteLifecycleMethods(KlumInstanceProxy proxy, Class<? extends Annotation> annotation) Deprecated, for removal: This API element is subject to removal in a future version.since 4.0; construction lifecycle state now belongs toInternalKlumBuildergetLifecycleClasses(Class<?> owner, Class<? extends Annotation> annotation) Returns a list of lifecycle classes for the given class.static booleanisValidLifecycleClassMethod(Method method, Class<? extends Annotation> annotation)
-
Method Details
-
executeLifecycleMethods
public static void executeLifecycleMethods(InternalKlumBuilder<?> builder, Class<? extends Annotation> annotation) Executes all methods annotated with the given annotation on the rw instance of the proxy. Also executes all closures annotated with the given annotation.- Parameters:
builder- the Builder for which the lifecycle methods should be executedannotation- the annotation that marks the lifecycle methods and closures
-
executeLifecycleMethods
@Deprecated(since="4.0", forRemoval=true) public static void executeLifecycleMethods(KlumInstanceProxy proxy, Class<? extends Annotation> annotation) Deprecated, for removal: This API element is subject to removal in a future version.since 4.0; construction lifecycle state now belongs toInternalKlumBuilder -
executeLifecycleClosures
public static void executeLifecycleClosures(InternalKlumBuilder<?> builder, Class<? extends Annotation> annotation) Executes all closures annotated with the given annotation on the DSL instance of the proxy.- Parameters:
builder- The Builder for which the lifecycle closures should be executedannotation- the annotation that marks the lifecycle closures
-
executeLifecycleClosures
@Deprecated(since="4.0", forRemoval=true) public static void executeLifecycleClosures(KlumInstanceProxy proxy, Class<? extends Annotation> annotation) Deprecated, for removal: This API element is subject to removal in a future version.since 4.0; construction lifecycle state now belongs toInternalKlumBuilder -
getLifecycleClasses
@NotNull public static @NotNull List<Class<?>> getLifecycleClasses(Class<?> owner, Class<? extends Annotation> annotation) Returns a list of lifecycle classes for the given class. A lifecycle class is a public, non-static inner class if the given class that is annotated with a lifecycle annotation. Returns the lifecycle classes of parent classes as well, except for lifecycle classes that explicitly override parent's lifecycle classes.If Child.InnerChild extends Parent.InnerParent, then only InnerChild is returned, as InnerParent is overshadowed by it.
- Parameters:
owner- The class whose lifecycle classes should be returnedannotation- The lifecycle annotation to look for- Returns:
- A list of the lifecycle classes, can be empty but never null.
-
isValidLifecycleClassMethod
public static boolean isValidLifecycleClassMethod(Method method, Class<? extends Annotation> annotation)
-
InternalKlumBuilder