org.apache.hivemind.schema.rules
Class BooleanTranslator

java.lang.Object
  |
  +--org.apache.hivemind.schema.rules.BooleanTranslator
All Implemented Interfaces:
Translator

public class BooleanTranslator
extends java.lang.Object
implements Translator

Translates a string value to a boolean value. "true" and "false" are acceptible values. Other values are logged as errors and treated as false. Null is simply considered false.

Author:
Howard Lewis Ship

Constructor Summary
BooleanTranslator()
           
BooleanTranslator(java.lang.String initializer)
          Initializes the translator, recognizing key "default" as the default value for the translator when the input is blank.
 
Method Summary
 java.lang.Object translate(Module contributingModule, java.lang.Class propertyType, java.lang.String inputValue)
          Invoked by a 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
 

Constructor Detail

BooleanTranslator

public BooleanTranslator()

BooleanTranslator

public BooleanTranslator(java.lang.String initializer)
Initializes the translator, recognizing key "default" as the default value for the translator when the input is blank.

Method Detail

translate

public java.lang.Object translate(Module contributingModule,
                                  java.lang.Class propertyType,
                                  java.lang.String inputValue)
Description copied from interface: Translator
Invoked by a 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 Translator
Parameters:
contributingModule - the module from which the input value originates
propertyType - the type of the property to be assigned by this translator; smart translators may be able to automatically convert from string to the correct type
inputValue - the value to be translated, either an attribute value or the content of the element