Package org.apache.openjpa.event
Class MethodLifecycleCallbacks
- java.lang.Object
-
- org.apache.openjpa.event.MethodLifecycleCallbacks
-
- All Implemented Interfaces:
java.io.Externalizable,java.io.Serializable,LifecycleCallbacks
- Direct Known Subclasses:
BeanLifecycleCallbacks
public class MethodLifecycleCallbacks extends java.lang.Object implements LifecycleCallbacks, java.io.Externalizable
Callback adapter that invokes a callback method via reflection.- Author:
- Steve Kim
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description MethodLifecycleCallbacks(java.lang.Class cls, java.lang.String method, boolean arg)Constructor.MethodLifecycleCallbacks(java.lang.reflect.Method method, boolean arg)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.reflect.MethodgetCallbackMethod()The callback method.protected static java.lang.reflect.MethodgetMethod(java.lang.Class cls, java.lang.String method, java.lang.Class[] args)Helper method to return the named method of the given class, throwing the proper exception on error.booleanhasCallback(java.lang.Object obj, int eventType)Return whether the given instance has a callback for the given event type.voidmakeCallback(java.lang.Object obj, java.lang.Object arg, int eventType)Invoke the callback for the given event type on the given instance.voidreadExternal(java.io.ObjectInput in)booleanrequiresArgument()Returns if this callback expects another argumentjava.lang.StringtoString()voidwriteExternal(java.io.ObjectOutput out)
-
-
-
Constructor Detail
-
MethodLifecycleCallbacks
public MethodLifecycleCallbacks(java.lang.Class cls, java.lang.String method, boolean arg)Constructor. Supply callback class and its callback method name.- Parameters:
arg- Whether we expect a further argument such as in AfterDetach
-
MethodLifecycleCallbacks
public MethodLifecycleCallbacks(java.lang.reflect.Method method, boolean arg)Constructor. Supply callback method.
-
-
Method Detail
-
getCallbackMethod
public java.lang.reflect.Method getCallbackMethod()
The callback method.
-
requiresArgument
public boolean requiresArgument()
Returns if this callback expects another argument
-
hasCallback
public boolean hasCallback(java.lang.Object obj, int eventType)Description copied from interface:LifecycleCallbacksReturn whether the given instance has a callback for the given event type.- Specified by:
hasCallbackin interfaceLifecycleCallbacks
-
makeCallback
public void makeCallback(java.lang.Object obj, java.lang.Object arg, int eventType) throws java.lang.ExceptionDescription copied from interface:LifecycleCallbacksInvoke the callback for the given event type on the given instance.- Specified by:
makeCallbackin interfaceLifecycleCallbacks- Throws:
java.lang.Exception
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getMethod
protected static java.lang.reflect.Method getMethod(java.lang.Class cls, java.lang.String method, java.lang.Class[] args)Helper method to return the named method of the given class, throwing the proper exception on error.
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException- Specified by:
readExternalin interfacejava.io.Externalizable- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException- Specified by:
writeExternalin interfacejava.io.Externalizable- Throws:
java.io.IOException
-
-