Package org.eclipse.sisu.bean
Class LifecycleBuilder
java.lang.Object
org.eclipse.sisu.bean.LifecycleBuilder
Builds
BeanLifecycle
s by searching class hierarchies for JSR250 annotations.-
Field Summary
FieldsModifier and TypeFieldDescription -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
addLifecycleMethods
(Class<?> clazz) Adds any declaredPostConstruct
andPreDestroy
methods to the current lifecycle.
Ignores methods overridden in subclasses, as well as multiple declarations of each annotation.Builds a newBeanLifecycle
for the given bean type.private static boolean
isCandidateMethod
(Method method) Tests to see if this method is a lifecycle candidate: void return, not static/abstract, no parameters.private boolean
isOverridden
(Method method) Tests to see if the given method is overridden in the subclass hierarchy.private static boolean
samePackage
(Method lhs, Method rhs)
-
Field Details
-
startMethods
-
stopMethods
-
hierarchy
-
-
Constructor Details
-
LifecycleBuilder
LifecycleBuilder()
-
-
Method Details
-
build
Builds a newBeanLifecycle
for the given bean type.- Parameters:
clazz
- The bean type- Returns:
- Lifecycle for the bean
-
addLifecycleMethods
Adds any declaredPostConstruct
andPreDestroy
methods to the current lifecycle.
Ignores methods overridden in subclasses, as well as multiple declarations of each annotation.- Parameters:
clazz
-
-
isOverridden
Tests to see if the given method is overridden in the subclass hierarchy.- Parameters:
method
- The method to test- Returns:
true
if the method was overridden; otherwisefalse
-
isCandidateMethod
Tests to see if this method is a lifecycle candidate: void return, not static/abstract, no parameters.- Parameters:
method
- The method to test- Returns:
true
if the method is acceptable; otherwisefalse
-
samePackage
- Returns:
true
if the methods were declared in the same package; otherwisefalse
-