org.jage.platform.component.builder
Class MapBuilder

java.lang.Object
  extended by org.jage.platform.component.builder.MapBuilder
All Implemented Interfaces:
IConfigurationBuilder

public final class MapBuilder
extends Object

This Builder adds several methods specific to Map Components.

Author:
AGH AgE Team

Nested Class Summary
 class MapBuilder.MapKey
           
 class MapBuilder.MapValue
           
 
Method Summary
 ComponentBuilder Agent(String name, Class<?> type)
          Alias for a component with no singleton scope.
 ArrayBuilder Array(String name, Class<?> type)
          Declares an array component with a given name and element type.
 ArrayBuilder Array(String name, Class<?> type, boolean isSingleton)
          Declares an array component with a given name, element type, and scope.
 Configuration build()
          Returns the configuration described with this builder.
 ComponentBuilder Component(String name, Class<?> type)
          Declares a component with a given name, type.
 ComponentBuilder Component(String name, Class<?> type, boolean isSingleton)
          Declares a component with a given name, type, and scope.
protected  AbstractComponentDefinition getCurrentDefinition()
           
 CollectionBuilder List(String name)
          Declares a list component with a given name.
 CollectionBuilder List(String name, Class<?> type)
          Declares a list component with a given name and element type.
 CollectionBuilder List(String name, Class<?> type, boolean isSingleton)
          Declares a list component with a given name, element type, and scope.
 MapBuilder Map(String name)
          Declares a map component with a given name.
 MapBuilder Map(String name, Class<?> keyType, Class<?> valueType)
          Declares a map component with a given name, key type and value type.
 MapBuilder Map(String name, Class<?> keyType, Class<?> valueType, boolean isSingleton)
          Declares a map component with a given name, key type, value type, and scope.
protected  ISingleValueProvider reference(String targetName)
           
 CollectionBuilder Set(String name)
          Declares a set component with a given name.
 CollectionBuilder Set(String name, Class<?> type)
          Declares a set component with a given name and element type.
 CollectionBuilder Set(String name, Class<?> type, boolean isSingleton)
          Declares a set component with a given name, element type, and scope.
 ComponentBuilder Strategy(String name, Class<?> type)
          Alias for a component with singleton scope.
protected  ISingleValueProvider value(Class<?> type, String stringValue)
           
 MapBuilder withConstructorArg(Class<?> type, String stringValue)
          Adds a constructor value argument to the current component definition.
 MapBuilder withConstructorArgRef(String targetName)
          Adds a constructor reference argument to the current component definition.
 IConfigurationBuilder withInner(Configuration innerConfiguration)
          Nests the given configuration the current component definition.
 IConfigurationBuilder withInner(IConfigurationBuilder innerConfigurationBuilder)
          Nests the configuration described by the given builder in the current component definition.
 MapBuilder.MapKey withItem()
          Adds an item to the current Map definition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getCurrentDefinition

protected AbstractComponentDefinition getCurrentDefinition()

withConstructorArg

public MapBuilder withConstructorArg(Class<?> type,
                                     String stringValue)
Adds a constructor value argument to the current component definition.

Parameters:
type - The argument's type
stringValue - The argument's string value.
Returns:
This builder

withConstructorArgRef

public MapBuilder withConstructorArgRef(String targetName)
Adds a constructor reference argument to the current component definition.

Parameters:
targetName - The target component's name.
Returns:
This builder

withItem

public MapBuilder.MapKey withItem()
Adds an item to the current Map definition.

Returns:
This builder

withInner

public final IConfigurationBuilder withInner(IConfigurationBuilder innerConfigurationBuilder)
Nests the configuration described by the given builder in the current component definition.

Parameters:
innerConfigurationBuilder - The inner builder to be nested
Returns:
This builder

withInner

public final IConfigurationBuilder withInner(Configuration innerConfiguration)
Nests the given configuration the current component definition.

Parameters:
innerConfigurationBuilder - The inner builder to be nested
Returns:
This builder

Component

public final ComponentBuilder Component(String name,
                                        Class<?> type)
Description copied from interface: IConfigurationBuilder
Declares a component with a given name, type. The singleton scope will be defaulted to false.

Specified by:
Component in interface IConfigurationBuilder
Parameters:
name - The component's name.
type - The component's type.
Returns:
This builder

Component

public final ComponentBuilder Component(String name,
                                        Class<?> type,
                                        boolean isSingleton)
Description copied from interface: IConfigurationBuilder
Declares a component with a given name, type, and scope.

Specified by:
Component in interface IConfigurationBuilder
Parameters:
name - The component's name.
type - The component's type.
isSingleton - whether this component has a singleton scope.
Returns:
This builder

Agent

public final ComponentBuilder Agent(String name,
                                    Class<?> type)
Description copied from interface: IConfigurationBuilder
Alias for a component with no singleton scope.

Specified by:
Agent in interface IConfigurationBuilder
Parameters:
name - The component's name.
type - The component's type.
Returns:
This builder

Strategy

public final ComponentBuilder Strategy(String name,
                                       Class<?> type)
Description copied from interface: IConfigurationBuilder
Alias for a component with singleton scope.

Specified by:
Strategy in interface IConfigurationBuilder
Parameters:
name - The component's name.
type - The component's type.
Returns:
This builder

Set

public final CollectionBuilder Set(String name)
Description copied from interface: IConfigurationBuilder
Declares a set component with a given name. The element type will be defaulted to Object and the singleton scope to false.

Specified by:
Set in interface IConfigurationBuilder
Parameters:
name - The component's name.
Returns:
This builder

Set

public final CollectionBuilder Set(String name,
                                   Class<?> type)
Description copied from interface: IConfigurationBuilder
Declares a set component with a given name and element type. The singleton scope will be defaulted to false.

Specified by:
Set in interface IConfigurationBuilder
Parameters:
name - The component's name.
type - The component's element type.
Returns:
This builder

Set

public final CollectionBuilder Set(String name,
                                   Class<?> type,
                                   boolean isSingleton)
Description copied from interface: IConfigurationBuilder
Declares a set component with a given name, element type, and scope.

Specified by:
Set in interface IConfigurationBuilder
Parameters:
name - The component's name.
type - The component's element type.
isSingleton - whether this component has a singleton scope.
Returns:
This builder

List

public final CollectionBuilder List(String name)
Description copied from interface: IConfigurationBuilder
Declares a list component with a given name. The element type will be defaulted to Object and the singleton scope to false.

Specified by:
List in interface IConfigurationBuilder
Parameters:
name - The component's name.
Returns:
This builder

List

public final CollectionBuilder List(String name,
                                    Class<?> type)
Description copied from interface: IConfigurationBuilder
Declares a list component with a given name and element type. The singleton scope will be defaulted to false.

Specified by:
List in interface IConfigurationBuilder
Parameters:
name - The component's name.
type - The component's element type.
Returns:
This builder

List

public final CollectionBuilder List(String name,
                                    Class<?> type,
                                    boolean isSingleton)
Description copied from interface: IConfigurationBuilder
Declares a list component with a given name, element type, and scope.

Specified by:
List in interface IConfigurationBuilder
Parameters:
name - The component's name.
type - The component's element type.
isSingleton - whether this component has a singleton scope.
Returns:
This builder

Array

public final ArrayBuilder Array(String name,
                                Class<?> type)
Description copied from interface: IConfigurationBuilder
Declares an array component with a given name and element type. The singleton scope will be defaulted to false.

Specified by:
Array in interface IConfigurationBuilder
Parameters:
name - The component's name.
type - The component's element type.
Returns:
This builder

Array

public final ArrayBuilder Array(String name,
                                Class<?> type,
                                boolean isSingleton)
Description copied from interface: IConfigurationBuilder
Declares an array component with a given name, element type, and scope.

Specified by:
Array in interface IConfigurationBuilder
Parameters:
name - The component's name.
type - The component's element type.
isSingleton - whether this component has a singleton scope.
Returns:
This builder

Map

public MapBuilder Map(String name)
Description copied from interface: IConfigurationBuilder
Declares a map component with a given name. The key and value type will be defaulted to Object, the singleton scope to false

Specified by:
Map in interface IConfigurationBuilder
Parameters:
name - The component's name.
Returns:
This builder

Map

public MapBuilder Map(String name,
                      Class<?> keyType,
                      Class<?> valueType)
Description copied from interface: IConfigurationBuilder
Declares a map component with a given name, key type and value type. The singleton scope will be defaulted to false

Specified by:
Map in interface IConfigurationBuilder
Parameters:
name - The component's name.
keyType - The component's key type.
valueType - The component's value type.
Returns:
This builder

Map

public MapBuilder Map(String name,
                      Class<?> keyType,
                      Class<?> valueType,
                      boolean isSingleton)
Description copied from interface: IConfigurationBuilder
Declares a map component with a given name, key type, value type, and scope.

Specified by:
Map in interface IConfigurationBuilder
Parameters:
name - The component's name.
keyType - The component's key type.
valueType - The component's value type.
isSingleton - whether this component has a singleton scope.
Returns:
This builder

build

public final Configuration build()
Description copied from interface: IConfigurationBuilder
Returns the configuration described with this builder.

Specified by:
build in interface IConfigurationBuilder
Returns:
The configuration described.

value

protected final ISingleValueProvider value(Class<?> type,
                                           String stringValue)

reference

protected final ISingleValueProvider reference(String targetName)


Copyright © 2006-2011 AGH University of Science and Technology. All Rights Reserved.