public abstract class CdiRepositoryBean<T> extends Object implements javax.enterprise.inject.spi.Bean<T>, javax.enterprise.inject.spi.PassivationCapable
Bean
wrappers.Constructor and Description |
---|
CdiRepositoryBean(Set<Annotation> qualifiers,
Class<T> repositoryType,
javax.enterprise.inject.spi.BeanManager beanManager)
Creates a new
CdiRepositoryBean . |
CdiRepositoryBean(Set<Annotation> qualifiers,
Class<T> repositoryType,
javax.enterprise.inject.spi.BeanManager beanManager,
CdiRepositoryContext context)
Creates a new
CdiRepositoryBean . |
CdiRepositoryBean(Set<Annotation> qualifiers,
Class<T> repositoryType,
javax.enterprise.inject.spi.BeanManager beanManager,
Optional<CustomRepositoryImplementationDetector> detector)
Creates a new
CdiRepositoryBean . |
Modifier and Type | Method and Description |
---|---|
protected void |
applyConfiguration(RepositoryFactorySupport repositoryFactory)
Applies the configuration from
CdiRepositoryConfiguration to RepositoryFactorySupport by looking up
the actual configuration. |
protected static void |
applyConfiguration(RepositoryFactorySupport repositoryFactory,
CdiRepositoryConfiguration configuration)
Applies the configuration from
CdiRepositoryConfiguration to RepositoryFactorySupport by looking up
the actual configuration. |
T |
create(javax.enterprise.context.spi.CreationalContext<T> creationalContext) |
protected T |
create(javax.enterprise.context.spi.CreationalContext<T> creationalContext,
Class<T> repositoryType)
Creates the actual component instance.
|
protected T |
create(javax.enterprise.context.spi.CreationalContext<T> creationalContext,
Class<T> repositoryType,
Optional<Object> customImplementation)
Deprecated.
since 2.1, override
create(CreationalContext, Class) in which you create a repository factory
and call #create(RepositoryFactorySupport, Class, RepositoryFragments) . |
protected static <T> T |
create(RepositoryFactorySupport repositoryFactory,
Class<T> repositoryType,
RepositoryComposition.RepositoryFragments repositoryFragments)
Creates the actual repository instance.
|
protected T |
create(Supplier<? extends RepositoryFactorySupport> factorySupplier,
Class<T> repositoryType)
Creates the actual component instance given a
repository factory supplier and the
repository type . |
void |
destroy(T instance,
javax.enterprise.context.spi.CreationalContext<T> creationalContext) |
Class<?> |
getBeanClass() |
protected <S> S |
getDependencyInstance(javax.enterprise.inject.spi.Bean<S> bean)
Returns an instance of an the given
Bean . |
protected <S> S |
getDependencyInstance(javax.enterprise.inject.spi.Bean<S> bean,
Class<?> type)
Returns an instance of an the given
Bean and allows to be specific about the type that is about to be
created. |
String |
getId() |
Set<javax.enterprise.inject.spi.InjectionPoint> |
getInjectionPoints() |
String |
getName() |
Set<Annotation> |
getQualifiers() |
protected RepositoryComposition.RepositoryFragments |
getRepositoryFragments(Class<T> repositoryType)
Lookup repository fragments for a
repository interface . |
Class<? extends Annotation> |
getScope() |
Set<Class<? extends Annotation>> |
getStereotypes() |
Set<Type> |
getTypes() |
void |
initialize()
Forces the initialization of bean target.
|
boolean |
isAlternative() |
boolean |
isNullable() |
protected CdiRepositoryConfiguration |
lookupConfiguration(javax.enterprise.inject.spi.BeanManager beanManager,
Set<Annotation> qualifiers)
Looks up an instance of a
CdiRepositoryConfiguration . |
String |
toString() |
public CdiRepositoryBean(Set<Annotation> qualifiers, Class<T> repositoryType, javax.enterprise.inject.spi.BeanManager beanManager)
CdiRepositoryBean
.qualifiers
- must not be null.repositoryType
- has to be an interface must not be null.beanManager
- the CDI BeanManager
, must not be null.public CdiRepositoryBean(Set<Annotation> qualifiers, Class<T> repositoryType, javax.enterprise.inject.spi.BeanManager beanManager, Optional<CustomRepositoryImplementationDetector> detector)
CdiRepositoryBean
.qualifiers
- must not be null.repositoryType
- has to be an interface must not be null.beanManager
- the CDI BeanManager
, must not be null.detector
- detector for the custom repository implementations CustomRepositoryImplementationDetector
.public CdiRepositoryBean(Set<Annotation> qualifiers, Class<T> repositoryType, javax.enterprise.inject.spi.BeanManager beanManager, CdiRepositoryContext context)
CdiRepositoryBean
.qualifiers
- must not be null.repositoryType
- has to be an interface must not be null.beanManager
- the CDI BeanManager
, must not be null.context
- CDI context encapsulating class loader, metadata scanning and fragment detection.public Set<Type> getTypes()
getTypes
in interface javax.enterprise.inject.spi.Bean<T>
protected <S> S getDependencyInstance(javax.enterprise.inject.spi.Bean<S> bean)
Bean
.bean
- the Bean
about to create an instance for.Bean.getTypes()
protected <S> S getDependencyInstance(javax.enterprise.inject.spi.Bean<S> bean, Class<?> type)
Bean
and allows to be specific about the type that is about to be
created.bean
- the Bean
about to create an instance for.type
- the expected type of the component instance created for that Bean
. We need to hand this
parameter explicitly as the Bean
might carry multiple types but the primary one might not be the
first, i.e. the one returned by Bean.getBeanClass()
.Bean.getTypes()
public final void initialize()
public final T create(javax.enterprise.context.spi.CreationalContext<T> creationalContext)
create
in interface javax.enterprise.context.spi.Contextual<T>
public void destroy(T instance, javax.enterprise.context.spi.CreationalContext<T> creationalContext)
destroy
in interface javax.enterprise.context.spi.Contextual<T>
public Set<Annotation> getQualifiers()
getQualifiers
in interface javax.enterprise.inject.spi.Bean<T>
public String getName()
getName
in interface javax.enterprise.inject.spi.Bean<T>
public Set<Class<? extends Annotation>> getStereotypes()
getStereotypes
in interface javax.enterprise.inject.spi.Bean<T>
public Class<?> getBeanClass()
getBeanClass
in interface javax.enterprise.inject.spi.Bean<T>
public boolean isAlternative()
isAlternative
in interface javax.enterprise.inject.spi.Bean<T>
public boolean isNullable()
isNullable
in interface javax.enterprise.inject.spi.Bean<T>
public Set<javax.enterprise.inject.spi.InjectionPoint> getInjectionPoints()
getInjectionPoints
in interface javax.enterprise.inject.spi.Bean<T>
public Class<? extends Annotation> getScope()
getScope
in interface javax.enterprise.inject.spi.Bean<T>
public String getId()
getId
in interface javax.enterprise.inject.spi.PassivationCapable
protected T create(javax.enterprise.context.spi.CreationalContext<T> creationalContext, Class<T> repositoryType)
creationalContext
- will never be null.repositoryType
- will never be null.protected T create(Supplier<? extends RepositoryFactorySupport> factorySupplier, Class<T> repositoryType)
repository factory supplier
and the
repository type
. This method is an utility for to create a repository. This method will obtain a
repository factory
and configure it with CdiRepositoryConfiguration
.factorySupplier
- must not be null.repositoryType
- must not be null.protected RepositoryComposition.RepositoryFragments getRepositoryFragments(Class<T> repositoryType)
repository interface
.repositoryType
- must not be null.RepositoryComposition.RepositoryFragments
.@Deprecated protected T create(javax.enterprise.context.spi.CreationalContext<T> creationalContext, Class<T> repositoryType, Optional<Object> customImplementation)
create(CreationalContext, Class)
in which you create a repository factory
and call #create(RepositoryFactorySupport, Class, RepositoryFragments)
.creationalContext
- will never be null.repositoryType
- will never be null.customImplementation
- can be null.protected CdiRepositoryConfiguration lookupConfiguration(javax.enterprise.inject.spi.BeanManager beanManager, Set<Annotation> qualifiers)
CdiRepositoryConfiguration
. In case the instance cannot be found within the CDI
scope, a default configuration is used.protected void applyConfiguration(RepositoryFactorySupport repositoryFactory)
CdiRepositoryConfiguration
to RepositoryFactorySupport
by looking up
the actual configuration.repositoryFactory
- will never be null.protected static void applyConfiguration(RepositoryFactorySupport repositoryFactory, CdiRepositoryConfiguration configuration)
CdiRepositoryConfiguration
to RepositoryFactorySupport
by looking up
the actual configuration.repositoryFactory
- will never be null.configuration
- will never be null.protected static <T> T create(RepositoryFactorySupport repositoryFactory, Class<T> repositoryType, RepositoryComposition.RepositoryFragments repositoryFragments)
repositoryType
- will never be null.repositoryFragments
- will never be null.Copyright © 2011–2022 Pivotal Software, Inc.. All rights reserved.