Package org.apache.openjpa.event
Class MethodLifecycleCallbacks
java.lang.Object
org.apache.openjpa.event.MethodLifecycleCallbacks
- All Implemented Interfaces:
Externalizable
,Serializable
,LifecycleCallbacks
- Direct Known Subclasses:
BeanLifecycleCallbacks
Callback adapter that invokes a callback method via reflection.
- Author:
- Steve Kim
- See Also:
-
Constructor Summary
ConstructorDescriptionMethodLifecycleCallbacks
(Class cls, String method, boolean arg) Constructor.MethodLifecycleCallbacks
(Method method, boolean arg) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionThe callback method.protected static Method
Helper method to return the named method of the given class, throwing the proper exception on error.boolean
hasCallback
(Object obj, int eventType) Return whether the given instance has a callback for the given event type.void
makeCallback
(Object obj, Object arg, int eventType) Invoke the callback for the given event type on the given instance.void
boolean
Returns if this callback expects another argumenttoString()
void
-
Constructor Details
-
MethodLifecycleCallbacks
Constructor. Supply callback class and its callback method name.- Parameters:
arg
- Whether we expect a further argument such as in AfterDetach
-
MethodLifecycleCallbacks
Constructor. Supply callback method.
-
-
Method Details
-
getCallbackMethod
The callback method. -
requiresArgument
public boolean requiresArgument()Returns if this callback expects another argument -
hasCallback
Description copied from interface:LifecycleCallbacks
Return whether the given instance has a callback for the given event type.- Specified by:
hasCallback
in interfaceLifecycleCallbacks
-
makeCallback
Description copied from interface:LifecycleCallbacks
Invoke the callback for the given event type on the given instance.- Specified by:
makeCallback
in interfaceLifecycleCallbacks
- Throws:
Exception
-
toString
-
getMethod
Helper method to return the named method of the given class, throwing the proper exception on error. -
readExternal
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
ClassNotFoundException
-
writeExternal
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-