Class SerializableBean<T>

  • All Implemented Interfaces:
    Serializable, javax.enterprise.context.spi.Contextual<T>, javax.enterprise.inject.spi.Bean<T>, javax.enterprise.inject.spi.BeanAttributes<T>, javax.enterprise.inject.spi.PassivationCapable

    public final class SerializableBean<T>
    extends Object
    implements javax.enterprise.inject.spi.Bean<T>, javax.enterprise.inject.spi.PassivationCapable, Serializable
    Wrapper to make all our Beans serializable. This is basically a delegate to an underlying Bean<T>. We use the PassivationCapable.getId() and BeanManager.getPassivationCapableBean(String) for serialisation and deserialisation.
    Version:
    $Rev$ $Date$
    See Also:
    Serialized Form
    • Method Detail

      • getBean

        public javax.enterprise.inject.spi.Bean<T> getBean()
        Returns:
        the delegated internal Bean.
      • getTypes

        public Set<Type> getTypes()
        Specified by:
        getTypes in interface javax.enterprise.inject.spi.BeanAttributes<T>
      • getQualifiers

        public Set<Annotation> getQualifiers()
        Specified by:
        getQualifiers in interface javax.enterprise.inject.spi.BeanAttributes<T>
      • getScope

        public Class<? extends Annotation> getScope()
        Specified by:
        getScope in interface javax.enterprise.inject.spi.BeanAttributes<T>
      • getName

        public String getName()
        Specified by:
        getName in interface javax.enterprise.inject.spi.BeanAttributes<T>
      • isNullable

        public boolean isNullable()
        Specified by:
        isNullable in interface javax.enterprise.inject.spi.Bean<T>
      • getInjectionPoints

        public Set<javax.enterprise.inject.spi.InjectionPoint> getInjectionPoints()
        Specified by:
        getInjectionPoints in interface javax.enterprise.inject.spi.Bean<T>
      • getBeanClass

        public Class<?> getBeanClass()
        Specified by:
        getBeanClass in interface javax.enterprise.inject.spi.Bean<T>
      • getStereotypes

        public Set<Class<? extends Annotation>> getStereotypes()
        Specified by:
        getStereotypes in interface javax.enterprise.inject.spi.BeanAttributes<T>
      • isAlternative

        public boolean isAlternative()
        Specified by:
        isAlternative in interface javax.enterprise.inject.spi.BeanAttributes<T>
      • create

        public T create​(javax.enterprise.context.spi.CreationalContext<T> tCreationalContext)
        Specified by:
        create in interface javax.enterprise.context.spi.Contextual<T>
      • destroy

        public void destroy​(T instance,
                            javax.enterprise.context.spi.CreationalContext<T> tCreationalContext)
        Specified by:
        destroy in interface javax.enterprise.context.spi.Contextual<T>
      • getId

        public String getId()
        Specified by:
        getId in interface javax.enterprise.inject.spi.PassivationCapable
      • equals

        public boolean equals​(Object other)
        If the other object is a SerializableBean too, we compare the 2 underlying wrapped beans.
        Overrides:
        equals in class Object
      • hashCode

        public int hashCode()
        We need to return the hashCode of the wrapped underlying bean, otherwise the context won't work.
        Overrides:
        hashCode in class Object
        Returns:
        hashCode of the underlying bean instance.