public class Lifecycle
extends Object
PostConstruct
and
PreDestroy
.Modifier and Type | Field and Description |
---|---|
static java.util.List<mireka.startup.Lifecycle.ManagedObject> |
managedObjects |
Constructor and Description |
---|
Lifecycle() |
Modifier and Type | Method and Description |
---|---|
static void |
addManagedObject(Object object)
Registers the object if it has at least one method which is marked with a
lifecycle annotation.
|
static void |
callPostConstructMethods()
Calls the methods of the registered objects which were marked with the
PostConstruct annotation in the order of their registration. |
static void |
callPreDestroyMethods()
Calls the methods of the successfully initialized registered objects
which were marked with the
PreDestroy annotation in the opposite
order of their registrations. |
public static final java.util.List<mireka.startup.Lifecycle.ManagedObject> managedObjects
public static void addManagedObject(Object object)
object
- the object which may have a lifecycle annotationpublic static void callPostConstructMethods() throws java.lang.reflect.InvocationTargetException, InvalidMethodSignatureException
PostConstruct
annotation in the order of their registration.java.lang.reflect.InvocationTargetException
- thrown if a called method has thrown an exceptionInvalidMethodSignatureException
- thrown if the method could not be called because it has
arguments.public static void callPreDestroyMethods()
PreDestroy
annotation in the opposite
order of their registrations. The PreDestroy method is not called on an
object