java.lang.Object
org.apache.hivemind.schema.rules.EnumerationTranslator
- All Implemented Interfaces:
- org.apache.hivemind.schema.Translator
- public class EnumerationTranslator
- extends java.lang.Object
- implements org.apache.hivemind.schema.Translator
Used to translate a set of strings to one of a number of constant values.
Each input string is matched against the name of a public static field
of a class. The name of the class, and the mappings, are provided
in the initializer.
Constructor Summary |
EnumerationTranslator(java.lang.String initializer)
Initialized the translator; the intitializer is the name of the class, a comma,
and a series of key=value mappings from the input values to the names
of the public static fields of the class. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_mappings
private java.util.Map _mappings
_className
private java.lang.String _className
_class
private java.lang.Class _class
EnumerationTranslator
public EnumerationTranslator(java.lang.String initializer)
- Initialized the translator; the intitializer is the name of the class, a comma,
and a series of key=value mappings from the input values to the names
of the public static fields of the class.
getClass
private java.lang.Class getClass(org.apache.hivemind.internal.Module contributingModule)
translate
public java.lang.Object translate(org.apache.hivemind.internal.Module contributingModule,
java.lang.Class propertyType,
java.lang.String inputValue,
org.apache.hivemind.Location location)
- Description copied from interface:
org.apache.hivemind.schema.Translator
- Invoked by a org.apache.hivemind.schema.Rule
to translate an inputValue into an appropriate object.
Substitution symbols will already have been expanded before this method is
invoked.
- Specified by:
translate
in interface org.apache.hivemind.schema.Translator