org.jboss.solder.bean
Class NarrowingBeanBuilder<T>

java.lang.Object
  extended by org.jboss.solder.bean.NarrowingBeanBuilder<T>

public class NarrowingBeanBuilder<T>
extends Object

Builder for ImmutableNarrowingBean and ImmutablePassivationCapableNarrowingBean.

Author:
Pete Muir
See Also:
ImmutableNarrowingBean, ImmutablePassivationCapableNarrowingBean

Constructor Summary
NarrowingBeanBuilder(javax.enterprise.inject.spi.Bean<Object> delegate, javax.enterprise.inject.spi.BeanManager beanManager)
          Instantiate a new NarrowingBeanBuilder.
 
Method Summary
 NarrowingBeanBuilder<T> addQualifier(Annotation qualifier)
          Add to the qualifiers used for bean creation.
 NarrowingBeanBuilder<T> addQualifiers(Annotation... qualifiers)
          Add to the qualifiers used for bean creation.
 NarrowingBeanBuilder<T> addQualifiers(Collection<Annotation> qualifiers)
          Add to the qualifiers used for bean creation.
 NarrowingBeanBuilder<T> addType(Type type)
          Add to the type closure used for bean creation.
 NarrowingBeanBuilder<T> addTypes(Collection<Type> types)
          Add to the type closure used for bean creation.
 NarrowingBeanBuilder<T> addTypes(Type... types)
          Add to the type closure used for bean creation.
 NarrowingBeanBuilder<T> alternative(boolean alternative)
          Define that the created bean will (or will not) be an alternative.
 ImmutableNarrowingBean<T> create()
           Use the bean builder's current state to define the bean.
 String getId()
          The id currently defined for bean creation.
 String getName()
          The name of the bean currently defined for bean creation.
 Set<Annotation> getQualifiers()
          Qualifiers currently defined for bean creation.
 Class<? extends Annotation> getScope()
          Scope currently defined for bean creation.
 Set<Class<? extends Annotation>> getStereotypes()
          Stereotypes currently defined for bean creation.
 String getToString()
          The string used when Object.toString() is called on the bean.
 Set<Type> getTypes()
          Type closure currently defined for bean creation.
 NarrowingBeanBuilder<T> id(String id)
          Define the id used for bean creation.
 boolean isAlternative()
          Whether the created bean will be an alternative.
 boolean isNullable()
          Whether the created bean will be nullable.
 boolean isPassivationCapable()
          Whether the created bean will be passivation capable.
 NarrowingBeanBuilder<T> name(String name)
          Define the name of the bean used for bean creation.
 NarrowingBeanBuilder<T> nullable(boolean nullable)
          Define that the created bean will (or will not) be nullable.
static
<T> NarrowingBeanBuilder<T>
of(javax.enterprise.inject.spi.Bean<Object> delegate, javax.enterprise.inject.spi.BeanManager beanManager)
          Create a new NarrowingBeanBuilder, allowing Java to infer the type T.
 NarrowingBeanBuilder<T> passivationCapable(boolean passivationCapable)
          Define that the created bean will (or will not) be passivation capable.
 NarrowingBeanBuilder<T> qualifiers(Annotation... qualifiers)
          Define the qualifiers used for bean creation.
 NarrowingBeanBuilder<T> qualifiers(Set<Annotation> qualifiers)
          Define the qualifiers used for bean creation.
 NarrowingBeanBuilder<T> readFromType(javax.enterprise.inject.spi.AnnotatedType<T> type)
           Read the AnnotatedType, creating a narrowing bean from the class and its annotations.
 NarrowingBeanBuilder<T> scope(Class<? extends Annotation> scope)
          Define the scope used for bean creation.
 NarrowingBeanBuilder<T> stereotypes(Set<Class<? extends Annotation>> stereotypes)
          Define the stereotypes used for bean creation.
 NarrowingBeanBuilder<T> toString(String toString)
          Define the string used when Object.toString() is called on the bean.
 NarrowingBeanBuilder<T> types(Set<Type> types)
          Define the type closure used for bean creation.
 NarrowingBeanBuilder<T> types(Type... types)
          Define the type closure used for bean creation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NarrowingBeanBuilder

public NarrowingBeanBuilder(javax.enterprise.inject.spi.Bean<Object> delegate,
                            javax.enterprise.inject.spi.BeanManager beanManager)
Instantiate a new NarrowingBeanBuilder.

Parameters:
delegate - the delegate bean
Method Detail

of

public static <T> NarrowingBeanBuilder<T> of(javax.enterprise.inject.spi.Bean<Object> delegate,
                                             javax.enterprise.inject.spi.BeanManager beanManager)
Create a new NarrowingBeanBuilder, allowing Java to infer the type T.

Type Parameters:
T - the type of the bean
Parameters:
delegate - the delegate bean

readFromType

public NarrowingBeanBuilder<T> readFromType(javax.enterprise.inject.spi.AnnotatedType<T> type)

Read the AnnotatedType, creating a narrowing bean from the class and its annotations.

Parameters:
type - the type to read

getTypes

public Set<Type> getTypes()
Type closure currently defined for bean creation.

Returns:
the type closure currently defined

types

public NarrowingBeanBuilder<T> types(Set<Type> types)
Define the type closure used for bean creation.

Parameters:
types - the type closure to use

types

public NarrowingBeanBuilder<T> types(Type... types)
Define the type closure used for bean creation.

Parameters:
types - the type closure to use

addType

public NarrowingBeanBuilder<T> addType(Type type)
Add to the type closure used for bean creation.

Parameters:
type - additional type to use

addTypes

public NarrowingBeanBuilder<T> addTypes(Type... types)
Add to the type closure used for bean creation.

Parameters:
types - the additional types to use

addTypes

public NarrowingBeanBuilder<T> addTypes(Collection<Type> types)
Add to the type closure used for bean creation.

Parameters:
types - the additional types to use

getQualifiers

public Set<Annotation> getQualifiers()
Qualifiers currently defined for bean creation.

Returns:
the qualifiers current defined

qualifiers

public NarrowingBeanBuilder<T> qualifiers(Set<Annotation> qualifiers)
Define the qualifiers used for bean creation.

Parameters:
qualifiers - the qualifiers to use

qualifiers

public NarrowingBeanBuilder<T> qualifiers(Annotation... qualifiers)
Define the qualifiers used for bean creation.

Parameters:
qualifiers - the qualifiers to use

addQualifier

public NarrowingBeanBuilder<T> addQualifier(Annotation qualifier)
Add to the qualifiers used for bean creation.

Parameters:
qualifiers - the additional qualifier to use

addQualifiers

public NarrowingBeanBuilder<T> addQualifiers(Annotation... qualifiers)
Add to the qualifiers used for bean creation.

Parameters:
qualifiers - the additional qualifiers to use

addQualifiers

public NarrowingBeanBuilder<T> addQualifiers(Collection<Annotation> qualifiers)
Add to the qualifiers used for bean creation.

Parameters:
qualifiers - the additional qualifiers to use

getName

public String getName()
The name of the bean currently defined for bean creation.

Returns:
the name of the bean or null if the bean has no name

name

public NarrowingBeanBuilder<T> name(String name)
Define the name of the bean used for bean creation.

Parameters:
name - the name of the bean to use or null if the bean should have no name

getScope

public Class<? extends Annotation> getScope()
Scope currently defined for bean creation.

Returns:
the scope currently defined

scope

public NarrowingBeanBuilder<T> scope(Class<? extends Annotation> scope)
Define the scope used for bean creation.

Parameters:
scope - the scope to use

isAlternative

public boolean isAlternative()
Whether the created bean will be an alternative.

Returns:
true if the created bean will be an alternative, otherwise false

alternative

public NarrowingBeanBuilder<T> alternative(boolean alternative)
Define that the created bean will (or will not) be an alternative.

Parameters:
alternative - true if the created bean should be an alternative, otherwise false

getStereotypes

public Set<Class<? extends Annotation>> getStereotypes()
Stereotypes currently defined for bean creation.

Returns:
the stereotypes currently defined

stereotypes

public NarrowingBeanBuilder<T> stereotypes(Set<Class<? extends Annotation>> stereotypes)
Define the stereotypes used for bean creation.

Parameters:
stereotypes - the stereotypes to use

create

public ImmutableNarrowingBean<T> create()

Use the bean builder's current state to define the bean.

Returns:
the bean

getToString

public String getToString()
The string used when Object.toString() is called on the bean.

Returns:
the string currently defined

toString

public NarrowingBeanBuilder<T> toString(String toString)
Define the string used when Object.toString() is called on the bean.

Parameters:
toString - the string to use

isNullable

public boolean isNullable()
Whether the created bean will be nullable.

Returns:
true if the created bean will be nullable, otherwise false

nullable

public NarrowingBeanBuilder<T> nullable(boolean nullable)
Define that the created bean will (or will not) be nullable.

Parameters:
nullable - true if the created bean should be nullable, otherwise false

isPassivationCapable

public boolean isPassivationCapable()
Whether the created bean will be passivation capable.

Returns:
true if the created bean will be passivation capable, otherwise false

passivationCapable

public NarrowingBeanBuilder<T> passivationCapable(boolean passivationCapable)
Define that the created bean will (or will not) be passivation capable.

Parameters:
nullable - true if the created bean should be passivation capable, otherwise false

getId

public String getId()
The id currently defined for bean creation.

Returns:
the id currently defined.

id

public NarrowingBeanBuilder<T> id(String id)
Define the id used for bean creation.

Parameters:
id - the id to use


Copyright © 2008-2011 Seam Framework. All Rights Reserved.