MetaDone
metadone.client.grasyla2.base.GrasylaEngineForAttribute< T >.AttributeBuilder< T > Class Reference
Collaboration diagram for metadone.client.grasyla2.base.GrasylaEngineForAttribute< T >.AttributeBuilder< T >:

List of all members.

Public Member Functions

 AttributeBuilder ()
Class<?> getPropertyClass (String name)
Iterable< String > getProperties ()
boolean isComposed ()
abstract T build (GrasylaContext context, String type, Map< String, Component<?>> properties, List<?extends T > list)
boolean buildMany ()
List< T > buildList (GrasylaContext context, String type, Map< String, Component<?>> properties, List<?extends T > list)

Protected Member Functions

Object getProperty (Map< String, Component<?>> properties, String string)

Package Functions

protected< P > void addProperty (String name, Class<?super P > type, P value)

Private Attributes

final HashMap< String, Class<?> > properties = new HashMap<String, Class<?>>()
final HashMap< String, Object > defaultValues = new HashMap<String, Object>()

Detailed Description

An attribute builder.

The user of this class registers wanted properties when initializing an instance of this class. Then, such an instance can be used to build multiple components in different engines.

Attributes
  • type: overwrites the type from the source
  • other: to be defined by the subclass

Contents

Used only if isComposed() is set.

Result
Evaluated by build(GrasylaContext, String, Map, List) or buildList(GrasylaContext, String, Map, List).
Parameters:
<T>The type of the built component

Constructor & Destructor Documentation

metadone.client.grasyla2.base.GrasylaEngineForAttribute< T >.AttributeBuilder< T >.AttributeBuilder ( )

Initializes this builder.


Member Function Documentation

protected<P> void metadone.client.grasyla2.base.GrasylaEngineForAttribute< T >.AttributeBuilder< T >.addProperty ( String  name,
Class<?super P >  type,
value 
) [package]

Adds a property.

Parameters:
<P>The type of the property
nameThe name of the property
typeThe type
valueThe default value
abstract T metadone.client.grasyla2.base.GrasylaEngineForAttribute< T >.AttributeBuilder< T >.build ( GrasylaContext  context,
String  type,
Map< String, Component<?>>  properties,
List<?extends T >  list 
) [pure virtual]

Builds an attribute.

This function is called when buildMany() is false.

Parameters:
contextThe context
typeThe type or null
propertiesThe properties
listThe list of composed components or null if isComposed() is false
Returns:
The resulting property
List<T> metadone.client.grasyla2.base.GrasylaEngineForAttribute< T >.AttributeBuilder< T >.buildList ( GrasylaContext  context,
String  type,
Map< String, Component<?>>  properties,
List<?extends T >  list 
)

Builds an attribute.

This function is called when buildMany() is true.

Parameters:
contextThe context
typeThe type or null
propertiesThe properties
listThe list of composed components or null if isComposed() is false
Returns:
The resulting property
boolean metadone.client.grasyla2.base.GrasylaEngineForAttribute< T >.AttributeBuilder< T >.buildMany ( )

Indicates whether to call the build version for a single attribute or a list.

By default, this is false, but a subclass may decide to change it.

Returns:
true to call for a list of attributes
Iterable<String> metadone.client.grasyla2.base.GrasylaEngineForAttribute< T >.AttributeBuilder< T >.getProperties ( )

Gets the properties declared in this builder.

Returns:
The properties
Object metadone.client.grasyla2.base.GrasylaEngineForAttribute< T >.AttributeBuilder< T >.getProperty ( Map< String, Component<?>>  properties,
String  string 
) [protected]

Gets a property from the map.

Parameters:
propertiesThe map
stringThe name of the property
Returns:
The reduced property or the default value
Class<?> metadone.client.grasyla2.base.GrasylaEngineForAttribute< T >.AttributeBuilder< T >.getPropertyClass ( String  name)

Gets the class of a property.

Parameters:
nameThe name
Returns:
The class or null if there is no such property
boolean metadone.client.grasyla2.base.GrasylaEngineForAttribute< T >.AttributeBuilder< T >.isComposed ( )

Indicates whether this engine is composed of other attributes.

By default this is false. A subclass may overwrite this method.

Returns:
Whether this builder is composed

Member Data Documentation

final HashMap<String, Object> metadone.client.grasyla2.base.GrasylaEngineForAttribute< T >.AttributeBuilder< T >.defaultValues = new HashMap<String, Object>() [private]
final HashMap<String, Class<?> > metadone.client.grasyla2.base.GrasylaEngineForAttribute< T >.AttributeBuilder< T >.properties = new HashMap<String, Class<?>>() [private]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations