Save This Page
Home » xwork-2.1.1-src » com.opensymphony.xwork2.inject » [javadoc | source]
com.opensymphony.xwork2.inject
public final class: ContainerBuilder [javadoc | source]
java.lang.Object
   com.opensymphony.xwork2.inject.ContainerBuilder
Builds a dependency injection Container . The combination of dependency type and name uniquely identifies a dependency mapping; you can use the same name for two different types. Not safe for concurrent use.

Adds the following factories by default:

Nested Class Summary:
public interface  ContainerBuilder.Command  Implemented by classes which participate in building a container. 
Field Summary
final  Map factories     
final  List singletonFactories     
final  List staticInjections     
 boolean created     
 boolean allowDuplicates     
Constructor:
 public ContainerBuilder() 
Method from com.opensymphony.xwork2.inject.ContainerBuilder Summary:
alias,   alias,   constant,   constant,   constant,   constant,   constant,   constant,   constant,   constant,   constant,   constant,   contains,   contains,   create,   factory,   factory,   factory,   factory,   factory,   factory,   factory,   factory,   factory,   factory,   factory,   factory,   injectStatics,   setAllowDuplicates
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from com.opensymphony.xwork2.inject.ContainerBuilder Detail:
 public ContainerBuilder alias(Class type,
    String alias) 
    Convenience method. Equivalent to {@code alias(type, Container.DEFAULT_NAME, type)}.
 public ContainerBuilder alias(Class type,
    String name,
    String alias) 
    Maps an existing factory to a new name.
 public ContainerBuilder constant(String name,
    String value) 
    Maps a constant value to the given name.
 public ContainerBuilder constant(String name,
    int value) 
    Maps a constant value to the given name.
 public ContainerBuilder constant(String name,
    long value) 
    Maps a constant value to the given name.
 public ContainerBuilder constant(String name,
    boolean value) 
    Maps a constant value to the given name.
 public ContainerBuilder constant(String name,
    double value) 
    Maps a constant value to the given name.
 public ContainerBuilder constant(String name,
    float value) 
    Maps a constant value to the given name.
 public ContainerBuilder constant(String name,
    short value) 
    Maps a constant value to the given name.
 public ContainerBuilder constant(String name,
    char value) 
    Maps a constant value to the given name.
 public ContainerBuilder constant(String name,
    Class value) 
    Maps a class to the given name.
 public ContainerBuilder constant(String name,
    E value) 
    Maps an enum to the given name.
 public boolean contains(Class type) 
    Convenience method. Equivalent to {@code contains(type, Container.DEFAULT_NAME)}.
 public boolean contains(Class type,
    String name) 
    Returns true if this builder contains a mapping for the given type and name.
 public Container create(boolean loadSingletons) 
 public ContainerBuilder factory(Class type) 
    Convenience method. Equivalent to {@code factory(type, Container.DEFAULT_NAME, type)}.
 public ContainerBuilder factory(Class type,
    Factory factory) 
    Convenience method. Equivalent to {@code factory(type, Container.DEFAULT_NAME, factory, Scope.DEFAULT)}.
 public ContainerBuilder factory(Class type,
    Class implementation) 
    Convenience method. Equivalent to {@code factory(type, Container.DEFAULT_NAME, implementation)}.
 public ContainerBuilder factory(Class type,
    String name) 
    Convenience method. Equivalent to {@code factory(type, name, type)}.
 public ContainerBuilder factory(Class type,
    Scope scope) 
    Convenience method. Equivalent to {@code factory(type, Container.DEFAULT_NAME, type, scope)}.
 public ContainerBuilder factory(Class type,
    Factory factory,
    Scope scope) 
    Convenience method. Equivalent to {@code factory(type, Container.DEFAULT_NAME, factory, scope)}.
 public ContainerBuilder factory(Class type,
    String name,
    Factory factory) 
    Convenience method. Equivalent to {@code factory(type, name, factory, Scope.DEFAULT)}.
 public ContainerBuilder factory(Class type,
    String name,
    Class implementation) 
    Maps an implementation class to a given dependency type and name. Creates instances using the container, recursively injecting dependencies.

    Sets scope to value from Scoped annotation on the implementation class. Defaults to Scope#DEFAULT if no annotation is found.

 public ContainerBuilder factory(Class type,
    Class implementation,
    Scope scope) 
    Convenience method. Equivalent to {@code factory(type, Container.DEFAULT_NAME, implementation, scope)}.
 public ContainerBuilder factory(Class type,
    String name,
    Scope scope) 
    Convenience method. Equivalent to {@code factory(type, name, type, scope)}.
 public ContainerBuilder factory(Class type,
    String name,
    Factory factory,
    Scope scope) 
    Maps a factory to a given dependency type and name.
 public ContainerBuilder factory(Class type,
    String name,
    Class implementation,
    Scope scope) 
    Maps an implementation class to a given dependency type and name. Creates instances using the container, recursively injecting dependencies.
 public ContainerBuilder injectStatics(Class types) 
    Upon creation, the Container will inject static fields and methods into the given classes.
 public  void setAllowDuplicates(boolean val)