|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.morph.transform.transformers.BaseTransformer net.sf.morph.transform.converters.BooleanToTextConverter
public class BooleanToTextConverter
Converts boolean values to text values. Subclasses can build in support for
locale-sensitive translations of true and false to text values by overriding
getTrueString(Locale)
and
getFalseString(Locale)
.
Field Summary |
---|
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 | |
---|---|
BooleanToTextConverter()
|
Method Summary | |
---|---|
protected java.lang.Object |
convertImpl(java.lang.Class destinationClass,
java.lang.Object source,
java.util.Locale locale)
The implementation of the convert method, 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 |
getFalseString(java.util.Locale locale)
Get the string representation of false . |
protected java.lang.Class[] |
getSourceClassesImpl()
Transformer.getSourceClasses() implementation template method. |
Converter |
getTextConverter()
Get the text converter used by this BaseToPrettyTextConverter. |
java.lang.String |
getTrueString(java.util.Locale locale)
Get the string representation of true . |
protected boolean |
isImpreciseTransformationImpl(java.lang.Class destinationClass,
java.lang.Class sourceClass)
Implementation of isImpreciseTransformation |
protected boolean |
isWrappingRuntimeExceptions()
Indicates whether runtime exceptions should be wrapped as TransformationException s. |
void |
setTextConverter(Converter textConverter)
Set the text converter used by this BaseToPrettyTextConverter. |
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 |
Methods inherited from interface net.sf.morph.transform.ImpreciseTransformer |
---|
isImpreciseTransformation |
Constructor Detail |
---|
public BooleanToTextConverter()
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 BaseTransformer
locale
- 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 BaseTransformer
java.lang.Exception
protected java.lang.Class[] getDestinationClassesImpl() throws java.lang.Exception
Transformer.getDestinationClasses()
implementation template method.
getDestinationClassesImpl
in class BaseTransformer
java.lang.Exception
public java.lang.String getTrueString(java.util.Locale locale)
true
.
locale
-
public java.lang.String getFalseString(java.util.Locale locale)
false
.
locale
-
protected boolean isImpreciseTransformationImpl(java.lang.Class destinationClass, java.lang.Class sourceClass)
isImpreciseTransformationImpl
in class BaseTransformer
protected boolean isWrappingRuntimeExceptions()
TransformationException
s. 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 BaseTransformer
true
public Converter getTextConverter()
public void setTextConverter(Converter textConverter)
textConverter
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |