EVolve.data
Class ElementBuilder

java.lang.Object
  |
  +--EVolve.data.ElementBuilder
Direct Known Subclasses:
EntityBuilder, EventBuilder

public abstract class ElementBuilder
extends java.lang.Object

Element builder.


Field Summary
protected  int elementType
           
 
Constructor Summary
protected ElementBuilder(java.lang.String elementName, java.lang.String elementDescription)
          Creates an element builder.
 
Method Summary
 void addReferenceField(FieldDefinition fieldKey, Entity reference)
          Adds a reference field.
 void addValueField(FieldDefinition fieldKey, int value)
          Adds a value field.
protected  Entity buildEntity()
          Builds the entity.
protected  EntityDefinition buildEntityDefinition()
          Builds the element definition.
protected  Event buildEvent()
          Builds the event.
protected  EventDefinition buildEventDefinition()
          Builds the element definition.
 FieldDefinition buildReferenceDefinition(java.lang.String fieldName, EntityBuilder referenceBuilder, java.lang.String[] fieldProperty, java.lang.String fieldDescription)
          Builds the definition of a reference field.
 FieldDefinition buildValueDefinition(java.lang.String fieldName, java.lang.String[] fieldProperty, java.lang.String fieldDescription)
          Builds the definition of a value field.
static void init()
          Initializes the element builders.
protected  void newEntity(java.lang.String entityName)
          Starts building new entity.
protected  void newEvent()
          Starts building new event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

elementType

protected int elementType
Constructor Detail

ElementBuilder

protected ElementBuilder(java.lang.String elementName,
                         java.lang.String elementDescription)
Creates an element builder.

Parameters:
elementName - name of the elements
elementDescription - description of the elements
Method Detail

init

public static void init()
Initializes the element builders.


buildValueDefinition

public FieldDefinition buildValueDefinition(java.lang.String fieldName,
                                            java.lang.String[] fieldProperty,
                                            java.lang.String fieldDescription)
Builds the definition of a value field.

Parameters:
fieldName - name of the field
fieldProperty - property of the field
fieldDescription - description of the field
Returns:
the field definition

buildReferenceDefinition

public FieldDefinition buildReferenceDefinition(java.lang.String fieldName,
                                                EntityBuilder referenceBuilder,
                                                java.lang.String[] fieldProperty,
                                                java.lang.String fieldDescription)
Builds the definition of a reference field.

Parameters:
fieldName - name of the field
referenceBuilder - builder of the reference
fieldProperty - property of the field
fieldDescription - description of the field
Returns:
the field definition

buildEntityDefinition

protected EntityDefinition buildEntityDefinition()
Builds the element definition.

Returns:
the element definition

buildEventDefinition

protected EventDefinition buildEventDefinition()
Builds the element definition.

Returns:
the element definition

newEntity

protected void newEntity(java.lang.String entityName)
Starts building new entity.

Parameters:
entityName - name of the entity

newEvent

protected void newEvent()
Starts building new event.


addValueField

public void addValueField(FieldDefinition fieldKey,
                          int value)
Adds a value field.

Parameters:
value - value of the field

addReferenceField

public void addReferenceField(FieldDefinition fieldKey,
                              Entity reference)
Adds a reference field.

Parameters:
reference - the reference

buildEntity

protected Entity buildEntity()
Builds the entity.

Returns:
the entity

buildEvent

protected Event buildEvent()
Builds the event.

Returns:
the event