Package org.jboss.ejb.client
Class EJBLocator<T>
java.lang.Object
org.jboss.ejb.client.EJBLocator<T>
- Type Parameters:
T- the interface type
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
EJBHomeLocator,EntityEJBLocator,StatefulEJBLocator,StatelessEJBLocator
An identifier for an Enterprise Bean proxy invocation target instance, suitable for use as a hash key or a serialized token.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionReturn this locator as a stateful locator, if it is one.Return this locator as a stateless locator, if it is one.booleancanNarrowTo(Class<?> type) Determine whether anarrowTo(Class)operation would succeed.createProxyInstance(InvocationHandler invocationHandler) Create a proxy instance using the cached proxy class.booleanDetermine whether this object is equal to another.booleanequals(EJBLocator<?> other) Determine whether this object is equal to another.Get the locator affinity.Get the application name.Get the Enterprise Beans bean name.Get the module distinct name.Get the Enterprise Beans identifier for this locator.Get the module name.Get the proxy class for this locator.Constructor<? extends T>Get the proxy class constructor for this locator.Get the view type of this locator.final inthashCode()Get the hash code for this instance.booleanisEntity()Determine if this is an entity locator.booleanisHome()Determine if this is a home locator.booleanDetermine if this is a stateful locator.booleanDetermine if this is a stateless locator.<S extends jakarta.ejb.EJBObject>
EntityEJBLocator<? extends S>narrowAsEntity(Class<S> type) Narrow this locator to the target type as a entity locator.<S extends jakarta.ejb.EJBHome>
EJBHomeLocator<? extends S>narrowAsHome(Class<S> type) Narrow this locator to the target type as a home locator.<S> StatefulEJBLocator<? extends S>narrowAsStateful(Class<S> type) Narrow this locator to the target type as a stateful locator.<S> StatelessEJBLocator<? extends S>narrowAsStateless(Class<S> type) Narrow this locator to the target type as a stateless locator.<S> EJBLocator<? extends S>Narrow this locator to the target type.toString()abstract EJBLocator<T>withNewAffinity(Affinity affinity) Create a copy of this locator, but with the new given affinity.withSession(SessionID sessionId) Create a copy of this locator, but with the given stateful session ID.withSessionAndAffinity(SessionID sessionId, Affinity affinity) Create a copy of this locator, but with the given affinity and stateful session ID.
-
Method Details
-
withNewAffinity
Create a copy of this locator, but with the new given affinity.- Parameters:
affinity- the new affinity- Returns:
- the new locator
-
withSession
Create a copy of this locator, but with the given stateful session ID. If this locator cannot be converted, an exception is thrown.- Parameters:
sessionId- the stateful session ID (must not benull)- Returns:
- the new locator (not
null)
-
withSessionAndAffinity
Create a copy of this locator, but with the given affinity and stateful session ID. If this locator cannot be converted, an exception is thrown.- Parameters:
sessionId- the stateful session ID (must not benull)affinity- the new affinity (must not benull)- Returns:
- the new locator (not
null)
-
canNarrowTo
Determine whether anarrowTo(Class)operation would succeed.- Parameters:
type- the type to narrow to- Returns:
trueif the narrow would succeed;falseotherwise
-
narrowTo
Narrow this locator to the target type.- Type Parameters:
S- the target type- Parameters:
type- the target type class- Returns:
- this instance, narrowed to the given type
- Throws:
ClassCastException- if the view type cannot be cast to the given type
-
narrowAsHome
Narrow this locator to the target type as a home locator.- Type Parameters:
S- the target type- Parameters:
type- the target type class- Returns:
- this instance, narrowed to the given type and cast as a home locator
- Throws:
ClassCastException- if the view type cannot be cast to the given type or if this locator is not a home locator
-
narrowAsEntity
public <S extends jakarta.ejb.EJBObject> EntityEJBLocator<? extends S> narrowAsEntity(Class<S> type) Narrow this locator to the target type as a entity locator.- Type Parameters:
S- the target type- Parameters:
type- the target type class- Returns:
- this instance, narrowed to the given type and cast as a entity locator
- Throws:
ClassCastException- if the view type cannot be cast to the given type or if this locator is not a entity locator
-
narrowAsStateful
Narrow this locator to the target type as a stateful locator.- Type Parameters:
S- the target type- Parameters:
type- the target type class- Returns:
- this instance, narrowed to the given type and cast as a stateful locator
- Throws:
ClassCastException- if the view type cannot be cast to the given type or if this locator is not a stateful locator
-
narrowAsStateless
Narrow this locator to the target type as a stateless locator.- Type Parameters:
S- the target type- Parameters:
type- the target type class- Returns:
- this instance, narrowed to the given type and cast as a stateless locator
- Throws:
ClassCastException- if the view type cannot be cast to the given type or if this locator is not a stateless locator
-
asStateless
Return this locator as a stateless locator, if it is one.- Returns:
- this instance, cast as a stateless locator
- Throws:
ClassCastException- if this locator is not a stateless locator
-
asStateful
Return this locator as a stateful locator, if it is one.- Returns:
- this instance, cast as a stateful locator
- Throws:
ClassCastException- if this locator is not a stateful locator
-
isStateless
public boolean isStateless()Determine if this is a stateless locator. If so, calls toasStateless()andnarrowAsStateless(Class)will generally succeed.- Returns:
trueif this locator is stateless,falseotherwise
-
isStateful
public boolean isStateful()Determine if this is a stateful locator. If so, calls toasStateful()andnarrowAsStateful(Class)will generally succeed.- Returns:
trueif this locator is stateful,falseotherwise
-
isEntity
public boolean isEntity()Determine if this is an entity locator. If so, calls tonarrowAsEntity(Class)will generally succeed.- Returns:
trueif this locator is an entity,falseotherwise
-
isHome
public boolean isHome()Determine if this is a home locator. If so, calls tonarrowAsHome(Class)will generally succeed.- Returns:
trueif this locator is a home,falseotherwise
-
getViewType
Get the view type of this locator.- Returns:
- the view type
-
getAppName
Get the application name.- Returns:
- the application name
-
getModuleName
Get the module name.- Returns:
- the module name
-
getBeanName
Get the Enterprise Beans bean name.- Returns:
- the Enterprise Beans bean name
-
getDistinctName
Get the module distinct name.- Returns:
- the module distinct name
-
getAffinity
Get the locator affinity.- Returns:
- the locator affinity
-
getIdentifier
Get the Enterprise Beans identifier for this locator.- Returns:
- the Enterprise Beans identifier
-
hashCode
public final int hashCode()Get the hash code for this instance. -
equals
Determine whether this object is equal to another. -
getProxyClass
Get the proxy class for this locator.- Returns:
- the proxy class
-
getProxyConstructor
Get the proxy class constructor for this locator. A proxy class constructor accepts a single argument of typeInvocationHandler.- Returns:
- the proxy constructor
-
createProxyInstance
Create a proxy instance using the cached proxy class.- Parameters:
invocationHandler- the invocation handler to use- Returns:
- the proxy instance
-
equals
Determine whether this object is equal to another.- Parameters:
other- the other object- Returns:
trueif they are equal,falseotherwise
-
toString
-