step.typedef
Class FieldDef.Builder

java.lang.Object
  |
  +--step.typedef.FieldDef.Builder
Enclosing class:
FieldDef

public static class FieldDef.Builder
extends Object

Create field definitions with the Builder pattern.


Method Summary
 FieldDef.Builder addAttribute(Attribute attribute)
          Add an attribute to the definition.
 FieldDef.Builder addAttributes(List attributes)
           
 void clear()
          Reset the build context.
 TypeDef getAltTypeDef()
           
 List getAttributes()
          Get the list of attributes for the definition.
 String getDescription()
          Get the description for the definition.
 FieldDef makeFieldDef()
          Obtain the completed field definition.
 FieldDef.Builder newFieldDef(String name, String typeName)
          Start building a new field definition with the given name and type name.
 FieldDef.Builder newFieldDef(String name, Type type)
          Start building a new field definition with the given name and type.
 FieldDef.Builder setAltTypeDef(TypeDef altDef)
          Set an alternate type definition for the field.
 FieldDef.Builder setDescription(String description)
          Set the description for the definition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newFieldDef

public FieldDef.Builder newFieldDef(String name,
                                    String typeName)
Start building a new field definition with the given name and type name.

See Also:
newFieldDef(String,Type)

newFieldDef

public FieldDef.Builder newFieldDef(String name,
                                    Type type)
Start building a new field definition with the given name and type.

The default record description is the empty string ("").

Parameters:
name - the brief name of the new field.
type - the type of the field.
Returns:
the current builder.
Throws:
IllegalStateException - if already building a definition.
IllegalArgumentException - name or type are null.

setDescription

public FieldDef.Builder setDescription(String description)
Set the description for the definition.

Returns:
the current builder.
Throws:
IllegalStateException - if not building a definition.
IllegalArgumentException - description is null.

getDescription

public String getDescription()
Get the description for the definition.

Returns:
the description, or null if no description is currently defined.

addAttribute

public FieldDef.Builder addAttribute(Attribute attribute)
Add an attribute to the definition.

Returns:
the current builder.
Throws:
IllegalStateException - if not building a definition.
IllegalArgumentException - attribute is null.

addAttributes

public FieldDef.Builder addAttributes(List attributes)

getAttributes

public List getAttributes()
Get the list of attributes for the definition.

Returns:
the current list of attributes, which may be empty.

setAltTypeDef

public FieldDef.Builder setAltTypeDef(TypeDef altDef)
Set an alternate type definition for the field.

Returns:
the current builder.
Throws:
IllegalStateException - if not building a definition.
IllegalArgumentException - altDef is for a different type than the current one.

getAltTypeDef

public TypeDef getAltTypeDef()

makeFieldDef

public FieldDef makeFieldDef()
Obtain the completed field definition.

Returns:
the fully constructed field definition.
Throws:
IllegalStateException - if not building a definition.

clear

public void clear()
Reset the build context.