ecologylab.xml.types.scalar
Class ShortType

java.lang.Object
  extended by ecologylab.generic.Debug
      extended by ecologylab.xml.types.scalar.ScalarType<java.lang.Short>
          extended by ecologylab.xml.types.scalar.ShortType

public class ShortType
extends ScalarType<java.lang.Short>

Type system entry for short, a built-in primitive.

Author:
andruid

Field Summary
static short DEFAULT_VALUE
           
static java.lang.String DEFAULT_VALUE_STRING
           
 
Fields inherited from class ecologylab.xml.types.scalar.ScalarType
DEFAULT_DELIMS
 
Constructor Summary
ShortType()
          This constructor should only be called once per session, through a static initializer, typically in TypeRegistry.
 
Method Summary
 void appendValue(java.lang.Appendable buffy, java.lang.reflect.Field field, java.lang.Object context, boolean needsEscaping)
          Get the value from the Field, in the context.
 void appendValue(java.lang.StringBuilder buffy, java.lang.reflect.Field field, java.lang.Object context, boolean needsEscaping)
          Get the value from the Field, in the context.
protected  java.lang.String defaultValueString()
          The default value for this type, as a String.
 java.lang.Short getInstance(java.lang.String value)
          Parse the String into the (primitive) type, and return a boxed instance.
 short getValue(java.lang.String valueString)
          Convert the parameter to short.
 boolean isDefaultValue(java.lang.reflect.Field field, java.lang.Object context)
          True if the value in the Field object matches the default value for this type.
 boolean setField(java.lang.reflect.Field field, java.lang.String value)
          This is a primitive type, so we set it specially.
 java.lang.String toString(java.lang.reflect.Field field, java.lang.Object context)
          The string representation for a Field of this type
 
Methods inherited from class ecologylab.xml.types.scalar.ScalarType
affordsInterestExpression, allowDelimitersInTokens, allowNewLines, appendValue, appendValue, composedOfTerms, defaultValue, defaultValueLength, delimeters, getClassName, getTypeClass, illegalChars, isDefaultValue, isFloatingPoint, isPrimitive, isReference, marshall, needsEscaping, setField, setFieldError
 
Methods inherited from class ecologylab.generic.Debug
classSimpleName, closeLoggingFile, debug, debug, debug, debug, debugA, debugA, debugA, debugI, debugI, debugI, error, error, getClassName, getInteractive, getPackageName, getPackageName, getPackageName, initialize, level, level, level, logToFile, print, print, println, println, println, println, println, println, printlnA, printlnA, printlnA, printlnI, printlnI, printlnI, printlnI, setLoggingFile, show, show, superString, toggleInteractive, toString, toString, warning, warning, weird, weird
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_VALUE

public static final short DEFAULT_VALUE
See Also:
Constant Field Values

DEFAULT_VALUE_STRING

public static final java.lang.String DEFAULT_VALUE_STRING
See Also:
Constant Field Values
Constructor Detail

ShortType

public ShortType()
This constructor should only be called once per session, through a static initializer, typically in TypeRegistry.

To get the instance of this type object for use in translations, call TypeRegistry.get("short").

Method Detail

getValue

public short getValue(java.lang.String valueString)
Convert the parameter to short.


getInstance

public java.lang.Short getInstance(java.lang.String value)
Parse the String into the (primitive) type, and return a boxed instance.

Specified by:
getInstance in class ScalarType<java.lang.Short>
Parameters:
value - String representation of the instance.

setField

public boolean setField(java.lang.reflect.Field field,
                        java.lang.String value)
This is a primitive type, so we set it specially.

See Also:
ScalarType.setField(Object, Field, String)

toString

public java.lang.String toString(java.lang.reflect.Field field,
                                 java.lang.Object context)
The string representation for a Field of this type

Overrides:
toString in class ScalarType<java.lang.Short>

defaultValueString

protected java.lang.String defaultValueString()
The default value for this type, as a String. This value is the one that translateToXML(...) wont bother emitting. In this case, "0".

Overrides:
defaultValueString in class ScalarType<java.lang.Short>

isDefaultValue

public boolean isDefaultValue(java.lang.reflect.Field field,
                              java.lang.Object context)
                       throws java.lang.IllegalArgumentException,
                              java.lang.IllegalAccessException
True if the value in the Field object matches the default value for this type.

Overrides:
isDefaultValue in class ScalarType<java.lang.Short>
Parameters:
field -
Returns:
Throws:
java.lang.IllegalArgumentException
java.lang.IllegalAccessException

appendValue

public void appendValue(java.lang.StringBuilder buffy,
                        java.lang.reflect.Field field,
                        java.lang.Object context,
                        boolean needsEscaping)
                 throws java.lang.IllegalArgumentException,
                        java.lang.IllegalAccessException
Get the value from the Field, in the context. Append its value to the buffy.

Overrides:
appendValue in class ScalarType<java.lang.Short>
Parameters:
buffy -
field -
context -
needsEscaping - TODO
Throws:
java.lang.IllegalAccessException
java.lang.IllegalArgumentException

appendValue

public void appendValue(java.lang.Appendable buffy,
                        java.lang.reflect.Field field,
                        java.lang.Object context,
                        boolean needsEscaping)
                 throws java.lang.IllegalArgumentException,
                        java.lang.IllegalAccessException,
                        java.io.IOException
Get the value from the Field, in the context. Append its value to the buffy.

Overrides:
appendValue in class ScalarType<java.lang.Short>
Parameters:
buffy -
field -
context -
needsEscaping - TODO
Throws:
java.lang.IllegalAccessException
java.lang.IllegalArgumentException
java.io.IOException