public class MockEjbObject
extends java.lang.Object
implements java.lang.reflect.InvocationHandler, javax.ejb.EnterpriseBean, java.io.Serializable
javax.ejb.EJBObject and javax.ejb.EJBLocalObject interfaces.
Provides API for working with interceptors.| Modifier and Type | Method and Description |
|---|---|
void |
addInterceptor(Interceptor interceptor)
Deprecated.
Use AspectSystem and poincuts to add interceptors
|
boolean |
equals(java.lang.Object obj)
Tests if this object is equals to the given object.
|
java.lang.Object |
getBean() |
MockEjbContext |
getEjbContext()
Returns
MockEjbContext object for the bean backed by this
MockEjbObject. |
javax.ejb.EJBHome |
getEJBHome()
Obtains the enterprise Bean's home interface.
|
javax.ejb.EJBLocalHome |
getEJBLocalHome()
Obtains the enterprise Bean's local home interface.
|
javax.ejb.Handle |
getHandle()
This method is not supported.
|
java.lang.Object |
getPrimaryKey() |
int |
hashCode() |
java.lang.Object |
invoke(java.lang.Object proxy,
java.lang.reflect.Method ifaceMethod,
java.lang.Object[] paramVals)
Invokes the target bean's method by delegating to the
InvocationContext
which calls interceptors and then the bean itself. |
boolean |
isIdentical(java.lang.Object object)
Test if a given object is identical to the invoked object.
|
void |
remove()
Currently this method does not do anything
TODO: should call ejbRemove for stateful session bean
|
void |
setTransactionPolicy(TransactionPolicy policy)
Deprecated.
use TransactionManager with the AspectSystem to set transaction policies
|
java.lang.String |
toString()
Provides string representation of this
MockEjbObject and
the its bean implementation object. |
public void addInterceptor(Interceptor interceptor)
interceptor - interceptor to addpublic void setTransactionPolicy(TransactionPolicy policy)
TransactionManager
which is always part of the interceptor list.
policy - transaction policy as defined by TransactionPolicy
enumeration.public java.lang.Object invoke(java.lang.Object proxy,
java.lang.reflect.Method ifaceMethod,
java.lang.Object[] paramVals)
throws java.lang.Throwable
InvocationContext
which calls interceptors and then the bean itself.
If we're dealing with the standard EJB method, this object provides the implementation
of these methods instead of the target bean. All interceptors are still invoked as before.invoke in interface java.lang.reflect.InvocationHandlerjava.lang.Throwablepublic MockEjbContext getEjbContext()
MockEjbContext object for the bean backed by this
MockEjbObject. MockEjbContext implements SessionContext and MesageDrivenContext.
Additionally it provides some convenience methods.public javax.ejb.EJBHome getEJBHome()
public javax.ejb.EJBLocalHome getEJBLocalHome()
public javax.ejb.Handle getHandle()
throws java.rmi.RemoteException
java.rmi.RemoteExceptionpublic java.lang.Object getPrimaryKey()
public void remove()
throws javax.ejb.RemoveException
javax.ejb.RemoveExceptionEJBObject.remove()public boolean isIdentical(java.lang.Object object)
object - an object to test for identity with the invoked object.public boolean equals(java.lang.Object obj)
super.equals() is called.
In other words, this method can be used to compare MockEjbObject instances
as well as bean dynamic proxies returned by Home create().equals in class java.lang.Objectobj - object to compare withtrue if this object or the dynamic proxy it holds equals
to the given object.public int hashCode()
hashCode in class java.lang.Objectpublic java.lang.Object getBean()
public java.lang.String toString()
MockEjbObject and
the its bean implementation object.toString in class java.lang.ObjectObject.toString()