|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectecologylab.generic.Debug
ecologylab.xml.types.scalar.ScalarType<T>
public abstract class ScalarType<T>
Basic unit of the scalar type system. Manages marshalling from a Java class that represents a scalar, to a String, and from a String to that Java class.
The ScalarType object is a means for associating a type name with a type index. It also knows how to create an instance of the type, given a String representation. If the ScalarType is a reference type, this is done with getInstance(String); if the ScalarType is a primitive, this is done with getValue(String), which cannot appear as a method in this, the base class, because it will return a different primitive type for each such Type. Note: unlike with ElementState subtypes, translation of these is controlled entirely by the name of the underlying Java class that gets translated, and not by the class name of subclasses of this.
| Field Summary | |
|---|---|
static java.lang.String |
DEFAULT_DELIMS
|
static java.lang.Object |
DEFAULT_VALUE
|
static java.lang.String |
DEFAULT_VALUE_STRING
|
| Constructor Summary | |
|---|---|
protected |
ScalarType(java.lang.Class<T> thatClass)
Constructor is protected because there should only be 1 instance that gets re-used, for each type. |
| Method Summary | |
|---|---|
boolean |
affordsInterestExpression()
True if the user should be able to express interest in fields of this type. |
boolean |
allowDelimitersInTokens()
When editing, determines whether delimiters can be included in token strings. |
boolean |
allowNewLines()
|
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. |
void |
appendValue(T instance,
java.lang.Appendable appendable,
boolean needsEscaping)
|
void |
appendValue(T instance,
java.lang.StringBuilder buffy,
boolean needsEscaping)
|
boolean |
composedOfTerms()
When editing, is the field one that should be part of the Term model? |
protected T |
defaultValue()
The default value for this, in its own type. |
int |
defaultValueLength()
|
protected java.lang.String |
defaultValueString()
The default value for this type, as a String. |
java.lang.String |
delimeters()
For editing: these are the valid delimiters for separating tokens that make up a field of this type. |
java.lang.String |
getClassName()
|
abstract T |
getInstance(java.lang.String value)
If this is a reference type, build an appropriate Object, given a String
representation. |
java.lang.Class |
getTypeClass()
Get the class object for the Type for which this manages conversion. |
java.lang.String |
illegalChars()
When editing, do not allow the user to include these characters in the resulting value String. |
boolean |
isDefaultValue(java.lang.reflect.Field field,
java.lang.Object context)
|
boolean |
isDefaultValue(java.lang.String value)
|
boolean |
isFloatingPoint()
Returns whether or not this is a floating point value of some sort; Types that are floating point values should override this method to return true. |
boolean |
isPrimitive()
Find out if this is a reference type or a primitive types. |
boolean |
isReference()
Find out if this is a reference type or a primitive types. |
java.lang.String |
marshall(T instance)
Get a String representation of the instance, using this. |
boolean |
needsEscaping()
Return true if this type may need escaping when emitted as XML. |
boolean |
setField(java.lang.Object object,
java.lang.reflect.Field field,
java.lang.String value)
Set the field represented to the value of Many different types of exceptions may be thrown. |
protected void |
setFieldError(java.lang.reflect.Field field,
java.lang.String value,
java.lang.Exception e)
Display an error message that arose while setting field to value. |
java.lang.String |
toString(java.lang.reflect.Field field,
java.lang.Object context)
The string representation for a Field of this type Default implementation uses the Object's toString() method. |
| 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 |
|---|
public static final java.lang.Object DEFAULT_VALUE
public static final java.lang.String DEFAULT_VALUE_STRING
public static final java.lang.String DEFAULT_DELIMS
| Constructor Detail |
|---|
protected ScalarType(java.lang.Class<T> thatClass)
TypeRegistry.get("type-string").
| Method Detail |
|---|
public abstract T getInstance(java.lang.String value)
this is a reference type, build an appropriate Object, given a String
representation. If it is a primitive type, return a boxed value.
value - String representation of the instance.
public boolean setField(java.lang.Object object,
java.lang.reflect.Field field,
java.lang.String value)
object - The object whose field should be modified.field - The field to be set.value - String representation of the value to set the field to. This Type will convert the
value to the appropriate type, using getInstance(String) for reference types, and
type specific getValue(String) methods for primitive types.
protected void setFieldError(java.lang.reflect.Field field,
java.lang.String value,
java.lang.Exception e)
field - value - e - public java.lang.String getClassName()
getClassName in class Debugpublic boolean isPrimitive()
public boolean needsEscaping()
public boolean isReference()
public java.lang.String toString(java.lang.reflect.Field field,
java.lang.Object context)
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
buffy - field - context - needsEscaping - TODO
java.lang.IllegalAccessException
java.lang.IllegalArgumentException
java.io.IOExceptionpublic java.lang.String marshall(T instance)
instance -
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
buffy - field - context - needsEscaping - TODO
java.lang.IllegalAccessException
java.lang.IllegalArgumentException
public void appendValue(T instance,
java.lang.StringBuilder buffy,
boolean needsEscaping)
public void appendValue(T instance,
java.lang.Appendable appendable,
boolean needsEscaping)
throws java.io.IOException
java.io.IOExceptionprotected java.lang.String defaultValueString()
protected T defaultValue()
public final int defaultValueLength()
public boolean isDefaultValue(java.lang.String value)
public boolean isDefaultValue(java.lang.reflect.Field field,
java.lang.Object context)
throws java.lang.IllegalArgumentException,
java.lang.IllegalAccessException
java.lang.IllegalArgumentException
java.lang.IllegalAccessExceptionpublic boolean isFloatingPoint()
public boolean allowNewLines()
public java.lang.Class getTypeClass()
public java.lang.String delimeters()
public boolean allowDelimitersInTokens()
public java.lang.String illegalChars()
public boolean composedOfTerms()
public boolean affordsInterestExpression()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||