| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.morph.transform.transformers.BaseTransformer
net.sf.morph.transform.converters.TextToBooleanConverter
public class TextToBooleanConverter
Converts text values to Booleans. Text values include Characters, Strings and StringBuffers.
| Field Summary | |
|---|---|
| static java.lang.String[] | DEFAULT_FALSE_TEXTDefault values for the falseTextattribute. | 
| static java.lang.String[] | DEFAULT_TRUE_TEXTDefault values for the trueTextattribute. | 
| Fields inherited from class net.sf.morph.transform.transformers.BaseTransformer | 
|---|
| destinationClasses, log, sourceClasses | 
| Fields inherited from interface net.sf.morph.transform.Transformer | 
|---|
| TRANSFORMATION_TYPE_CONVERT, TRANSFORMATION_TYPE_COPY | 
| Fields inherited from interface net.sf.morph.transform.Transformer | 
|---|
| TRANSFORMATION_TYPE_CONVERT, TRANSFORMATION_TYPE_COPY | 
| Constructor Summary | |
|---|---|
| TextToBooleanConverter() | |
| Method Summary | |
|---|---|
| protected  java.lang.Object | convertImpl(java.lang.Class destinationClass,
            java.lang.Object source,
            java.util.Locale locale)The implementation of the convertmethod, which may omit
 the invalid argument checks already performed by this base class. | 
| protected  java.lang.Class[] | getDestinationClassesImpl()Transformer.getDestinationClasses()implementation template method. | 
|  java.lang.String[] | getFalseText()Returns the String, StringBuffer, and Character values that will be converted to false. | 
| protected  java.lang.Class[] | getSourceClassesImpl()Transformer.getSourceClasses()implementation template method. | 
|  Converter | getTextConverter()Get the text converter of this TextToBooleanConverter. | 
|  java.lang.String[] | getTrueText()Returns the String, StringBuffer, and Character values that will be converted to true. | 
| protected  boolean | isAutomaticallyHandlingNulls()Indicates whether nullvalues will automatically be
 converted tonullby this base class before even calling
 the subclass'sBaseTransformer.convertImpl(Class, Object, Locale)method. | 
| protected  boolean | isWrappingRuntimeExceptions()Indicates whether runtime exceptions should be wrapped as TransformationExceptions. | 
|  void | setFalseText(java.lang.String[] falseStrings)Sets the values that will be converted to false. | 
|  void | setTextConverter(Converter textConverter)Set the text converter of this TextToBooleanConverter. | 
|  void | setTrueText(java.lang.String[] trueStrings)Sets the values that will be converted to true. | 
| Methods inherited from class java.lang.Object | 
|---|
| equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Methods inherited from interface net.sf.morph.transform.DecoratedConverter | 
|---|
| convert, equals, equals | 
| Methods inherited from interface net.sf.morph.transform.Converter | 
|---|
| convert | 
| Methods inherited from interface net.sf.morph.transform.Transformer | 
|---|
| getDestinationClasses, getSourceClasses | 
| Methods inherited from interface net.sf.morph.transform.Transformer | 
|---|
| getDestinationClasses, getSourceClasses | 
| Methods inherited from interface net.sf.morph.transform.ExplicitTransformer | 
|---|
| isTransformable | 
| Field Detail | 
|---|
public static final java.lang.String[] DEFAULT_TRUE_TEXT
trueText attribute.
public static final java.lang.String[] DEFAULT_FALSE_TEXT
falseText attribute.
| Constructor Detail | 
|---|
public TextToBooleanConverter()
| Method Detail | 
|---|
protected java.lang.Object convertImpl(java.lang.Class destinationClass,
                                       java.lang.Object source,
                                       java.util.Locale locale)
                                throws java.lang.Exception
convert method, which may omit
 the invalid argument checks already performed by this base class. By
 default, this method creates a new instance of the destinationClass and
 copies information from the source to the destination. This
 implementation should be fine as-is for Copiers, but Converters will need
 to implement this method since they will not be implementing the copy
 method.
convertImpl in class BaseTransformerlocale - the locale in which the conversion should take place. for
            converters that are not locale-aware, the local argument can
            simply be ignored
java.lang.Exception
protected java.lang.Class[] getSourceClassesImpl()
                                          throws java.lang.Exception
Transformer.getSourceClasses() implementation template method.
getSourceClassesImpl in class BaseTransformerjava.lang.Exception
protected java.lang.Class[] getDestinationClassesImpl()
                                               throws java.lang.Exception
Transformer.getDestinationClasses() implementation template method.
getDestinationClassesImpl in class BaseTransformerjava.lang.Exceptionpublic java.lang.String[] getFalseText()
false. The strings are not case-sensitive.
false. The strings are not
         case-sensitive.public void setFalseText(java.lang.String[] falseStrings)
false. The
 strings are not case-sensitive.
falseText - the values that will be converted to false.
            The strings are not case-sensitive.public java.lang.String[] getTrueText()
true. The strings are not case-sensitive.
true. The strings are not
         case-sensitive.public void setTrueText(java.lang.String[] trueStrings)
true. The
 strings are not case-sensitive.
trueText - the values that will be converted to true. The
            strings are not case-sensitive.protected boolean isAutomaticallyHandlingNulls()
null values will automatically be
 converted to null by this base class before even calling
 the subclass's BaseTransformer.convertImpl(Class, Object, Locale) method.
 Subclasses which depend on this behavior (which is all subclasses, by
 default) should include null as one of their source and
 destination classes so that the actual behavior of the transformer is
 consistent with the values that are returned by the
 BaseTransformer.isTransformable(Class, Class) method. The conversions will
 happen automatically even if the source and destination classes don't
 contain null, but for the sake of consistency the
 nulls should be included.
isAutomaticallyHandlingNulls in class BaseTransformernull values will automatically be
         converted to null by this base class before even
         calling the subclass's
         BaseTransformer.convertImpl(Class, Object, Locale) methodprotected boolean isWrappingRuntimeExceptions()
TransformationExceptions. By default, this method returns
 true.
 
 
 Simple transformers in Morph that operate on JDK types like Numbers and
 Strings will usually set this value to true so that they
 throw TransformationExceptions if problems occur. More complex
 transformers that operate on graphs of objects are encouraged to set this
 value to false so that runtime exceptions are not wrapped.
 This way, problems accessing data will be expressed by the native API of
 a user's domain objects and avoid the need to catch Morph-specific
 exceptions (assuming the use of runtime exceptions in said domain
 objects).
isWrappingRuntimeExceptions in class BaseTransformertruepublic Converter getTextConverter()
public void setTextConverter(Converter textConverter)
textConverter - the Converter to set| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||