Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.hivemind.schema.rules
Class EnumerationTranslator  view EnumerationTranslator download EnumerationTranslator.java

java.lang.Object
  extended byorg.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.


Field Summary
private  java.lang.Class _class
           
private  java.lang.String _className
           
private  java.util.Map _mappings
           
 
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.
 
Method Summary
private  java.lang.Class getClass(org.apache.hivemind.internal.Module contributingModule)
           
 java.lang.Object translate(org.apache.hivemind.internal.Module contributingModule, java.lang.Class propertyType, java.lang.String inputValue, org.apache.hivemind.Location location)
          Invoked by a org.apache.hivemind.schema.Rule to translate an inputValue into an appropriate object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_mappings

private java.util.Map _mappings

_className

private java.lang.String _className

_class

private java.lang.Class _class
Constructor Detail

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.

Method Detail

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