|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.cocoon.woody.datatype.typeimpl.AbstractDatatype org.apache.cocoon.woody.datatype.typeimpl.EnumType
public class EnumType
A Datatype
implementation for
types implementing Joshua Bloch's
typesafe enum pattern.
See the following code for an example:
package com.example; public class Sex { public static final Sex MALE = new Sex("M"); public static final Sex FEMALE = new Sex("F"); private String code; private Sex(String code) { this.code = code; } }
If your enumerated type does not provide a Object.toString()
method, the enum convertor will use the fully qualified class name,
followed by the name of the public static final field referring to
each instance, i.e. "com.example.Sex.MALE", "com.example.Sex.FEMALE"
and so on.
If you provide a toString() method which returns something different, you should also provide a fromString(String, Locale) method to convert those strings back to instances.
Constructor Summary | |
---|---|
EnumType()
|
Method Summary | |
---|---|
String |
getDescriptiveName()
Returns a descriptive name for the base type of this datatype, i.e. something like 'string', 'long', 'decimal', ... |
Class |
getTypeClass()
Gets the class object for the type represented by this datatype. |
Methods inherited from class org.apache.cocoon.woody.datatype.typeimpl.AbstractDatatype |
---|
addValidationRule, convertFromString, convertToString, getBuilder, getConvertor, getPlainConvertor, isArrayType, setArrayType, setBuilder, setConvertor, validate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EnumType()
Method Detail |
---|
public Class getTypeClass()
Datatype
public String getDescriptiveName()
Datatype
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |