Class EJBLocator<T>

    • Method Detail

      • withNewAffinity

        public abstract EJBLocator<T> withNewAffinity​(Affinity affinity)
        Create a copy of this locator, but with the new given affinity.
        Parameters:
        affinity - the new affinity
        Returns:
        the new locator
      • withSession

        public StatefulEJBLocator<T> withSession​(SessionID sessionId)
        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 be null)
        Returns:
        the new locator (not null)
      • withSessionAndAffinity

        public StatefulEJBLocator<T> withSessionAndAffinity​(SessionID sessionId,
                                                            Affinity affinity)
        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 be null)
        affinity - the new affinity (must not be null)
        Returns:
        the new locator (not null)
      • canNarrowTo

        public boolean canNarrowTo​(Class<?> type)
        Determine whether a narrowTo(Class) operation would succeed.
        Parameters:
        type - the type to narrow to
        Returns:
        true if the narrow would succeed; false otherwise
      • narrowTo

        public <S> EJBLocator<? extends S> narrowTo​(Class<S> type)
        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

        public <S extends jakarta.ejb.EJBHome> EJBHomeLocator<? extends S> narrowAsHome​(Class<S> type)
        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

        public <S> StatefulEJBLocator<? extends S> narrowAsStateful​(Class<S> type)
        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

        public <S> StatelessEJBLocator<? extends S> narrowAsStateless​(Class<S> type)
        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

        public StatelessEJBLocator<T> 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

        public StatefulEJBLocator<T> 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 to asStateless() and narrowAsStateless(Class) will generally succeed.
        Returns:
        true if this locator is stateless, false otherwise
      • isStateful

        public boolean isStateful()
        Determine if this is a stateful locator. If so, calls to asStateful() and narrowAsStateful(Class) will generally succeed.
        Returns:
        true if this locator is stateful, false otherwise
      • isEntity

        public boolean isEntity()
        Determine if this is an entity locator. If so, calls to narrowAsEntity(Class) will generally succeed.
        Returns:
        true if this locator is an entity, false otherwise
      • isHome

        public boolean isHome()
        Determine if this is a home locator. If so, calls to narrowAsHome(Class) will generally succeed.
        Returns:
        true if this locator is a home, false otherwise
      • getViewType

        public Class<T> getViewType()
        Get the view type of this locator.
        Returns:
        the view type
      • getAppName

        public String getAppName()
        Get the application name.
        Returns:
        the application name
      • getModuleName

        public String getModuleName()
        Get the module name.
        Returns:
        the module name
      • getBeanName

        public String getBeanName()
        Get the Enterprise Beans bean name.
        Returns:
        the Enterprise Beans bean name
      • getDistinctName

        public String getDistinctName()
        Get the module distinct name.
        Returns:
        the module distinct name
      • getAffinity

        public Affinity getAffinity()
        Get the locator affinity.
        Returns:
        the locator affinity
      • getIdentifier

        public EJBIdentifier 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.
        Overrides:
        hashCode in class Object
        Returns:
        the hash code for this instance
      • equals

        public boolean equals​(Object other)
        Determine whether this object is equal to another.
        Overrides:
        equals in class Object
        Parameters:
        other - the other object
        Returns:
        true if they are equal, false otherwise
      • getProxyClass

        public Class<? extends T> getProxyClass()
        Get the proxy class for this locator.
        Returns:
        the proxy class
      • getProxyConstructor

        public Constructor<? extends T> getProxyConstructor()
        Get the proxy class constructor for this locator. A proxy class constructor accepts a single argument of type InvocationHandler.
        Returns:
        the proxy constructor
      • createProxyInstance

        public T createProxyInstance​(InvocationHandler invocationHandler)
        Create a proxy instance using the cached proxy class.
        Parameters:
        invocationHandler - the invocation handler to use
        Returns:
        the proxy instance
      • equals

        public boolean equals​(EJBLocator<?> other)
        Determine whether this object is equal to another.
        Parameters:
        other - the other object
        Returns:
        true if they are equal, false otherwise