com.bowstreet.generation
Interface BuilderInputs


public interface BuilderInputs

This holds a set of builder inputs and is passed to builders during generation.


Method Summary
 boolean getBoolean(java.lang.String name, boolean defaultValue)
          Gets the named data as a boolean.
 java.util.Iterator getIterator()
          Gets an iterator to all of the names of the named data.
 java.lang.Object getObject(java.lang.String strName, java.lang.Object defaultValue)
          Gets the named data as a Object.
 java.lang.String getString(java.lang.String name, java.lang.String defaultValue)
          Gets the named data as a String.
 IXml getXml(java.lang.String name, IXml defaultValue)
          Gets the named data as a IXml.
 void removeValue(java.lang.String strName)
          Removes an input
 void setBoolean(java.lang.String name, boolean value)
          Sets the named data with the specified boolean value.
 void setObject(java.lang.String strName, java.lang.Object value)
          Sets the named data with the specified Object value.
 void setString(java.lang.String name, java.lang.String value)
          Sets the named data with the specified String value.
 void setXml(java.lang.String name, IXml value)
          Sets the named data with the specified IXml value.
 

Method Detail

getBoolean

boolean getBoolean(java.lang.String name,
                   boolean defaultValue)
Gets the named data as a boolean.

Parameters:
name - The name of the boolean value to get.
defaultValue - the value to return if the named element doesn't exist
Returns:
the boolean value of the named data.
Example:
Get a boolean input with a default of "false".
   boolean inputBoolean = builderInputs.getBoolean("MyBooleanInput", false);

getIterator

java.util.Iterator getIterator()
Gets an iterator to all of the names of the named data.

Returns:
the Iterator of all of the names of the named data.
Example:
Show all the builder input names and values:
   for (Iterator i = builderInputs.getIterator(); i.hasNext();) {
        String inputName = (String)i.next();
        System.out.println("input name: " + inputName + " value: " + builderInputs.getObject(inputName, null));
   }

getObject

java.lang.Object getObject(java.lang.String strName,
                           java.lang.Object defaultValue)
Gets the named data as a Object.

Parameters:
strName - The name of the Object value to get.
defaultValue - the value to return if the named element doesn't exist
Returns:
the Object value of the named data.
Example:
Get the input "MyInput" and default to null:
    builderInputs.getObject("MyInput", null);

getString

java.lang.String getString(java.lang.String name,
                           java.lang.String defaultValue)
Gets the named data as a String.

Parameters:
name - The name of the String value to get.
defaultValue - the value to return if the named element doesn't exist
Returns:
the String value of the named data.
Example:
Get a String input with a default of "abc".
   String inputString = builderInputs.getString("MyStringInput", "abc");

getXml

IXml getXml(java.lang.String name,
            IXml defaultValue)
Gets the named data as a IXml.

Parameters:
name - The name of the IXml value to get.
defaultValue - the value to return if the named element doesn't exist
Returns:
the IXml value of the named data.
Example:
Get an XML input with a default of a single empty element.
   IXml inputXML = builderInputs.getXml("MyXMLInput", XmlUtil.create("EmptyElement"));

removeValue

void removeValue(java.lang.String strName)
Removes an input

Parameters:
strName - The name of the input to remove

setBoolean

void setBoolean(java.lang.String name,
                boolean value)
Sets the named data with the specified boolean value.

Parameters:
name - The name of the value to set.
value - The value to set on the specified name.
Example:
Set a boolean input to "false".
   builderInputs.setBoolean("MyBooleanInput", false);

setObject

void setObject(java.lang.String strName,
               java.lang.Object value)
Sets the named data with the specified Object value.

Parameters:
strName - The name of the value to set.
value - The value to set on the specified name.

setString

void setString(java.lang.String name,
               java.lang.String value)
Sets the named data with the specified String value.

Parameters:
name - The name of the value to set.
value - The value to set on the specified name.
Example:
Set a String input to "abc".
   builderInputs.setString("MyStringInput", "abc");

setXml

void setXml(java.lang.String name,
            IXml value)
Sets the named data with the specified IXml value.

Parameters:
name - The name of the value to set.
value - The value to set on the specified name.
Example:
Set an XML input to a single empty element.
   builderInputs.setXml("MyXMLInput", XmlUtil.create("EmptyElement"));


Copyright © 2009 IBM. All Rights Reserved.