org.apache.hivemind.schema.rules
Class DoubleTranslator
java.lang.Object
org.apache.hivemind.schema.rules.DoubleTranslator
- All Implemented Interfaces:
- Translator
public class DoubleTranslator
- extends java.lang.Object
- implements Translator
Translates strings to integer values.
- Author:
- Howard Lewis Ship
Constructor Summary |
DoubleTranslator()
|
DoubleTranslator(java.lang.String initializer)
Initializers:
default: default value for empty or invalid input
min: minimum acceptible value
max: maximum acceptible value
|
Method Summary |
java.lang.Object |
translate(Module contributingModule,
java.lang.Class propertyType,
java.lang.String inputValue,
Location location)
Converts the string to an Double. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DoubleTranslator
public DoubleTranslator()
DoubleTranslator
public DoubleTranslator(java.lang.String initializer)
- Initializers:
- default: default value for empty or invalid input
- min: minimum acceptible value
- max: maximum acceptible value
translate
public java.lang.Object translate(Module contributingModule,
java.lang.Class propertyType,
java.lang.String inputValue,
Location location)
- Converts the string to an Double. The empty string is returned as zero.
On failure, an error is logged and the method returns zero.
- Specified by:
translate
in interface Translator
- Parameters:
contributingModule
- the module from which the input value originatespropertyType
- the type of the property to be assigned by this translator; smart translators may
be able to automatically convert from string to the correct typeinputValue
- the value to be translated, either an attribute value or the content of the elementlocation
- the location of the inputValue; used to set the location of created objects,
or when reporting errors