net.sf.morph.transform.converters
Class DefaultToBooleanConverter

java.lang.Object
  extended by net.sf.morph.transform.transformers.BaseTransformer
      extended by net.sf.morph.transform.transformers.BaseCompositeTransformer
          extended by net.sf.morph.transform.transformers.SimpleDelegatingTransformer
              extended by net.sf.morph.transform.converters.DefaultToBooleanConverter
All Implemented Interfaces:
java.lang.Cloneable, net.sf.composite.Component, net.sf.composite.Composite, net.sf.composite.SimpleComposite, net.sf.composite.SpecializableComposite, net.sf.composite.StrictlyTypedComposite, Converter, Copier, DecoratedConverter, DecoratedCopier, DecoratedTransformer, ExplicitTransformer, ImpreciseTransformer, Transformer

public class DefaultToBooleanConverter
extends SimpleDelegatingTransformer

Converts any object to a Boolean by delegating to TextToBooleanConverter, NumberToBooleanConverter and ObjectToBooleanConverter.

Since:
Dec 29, 2004
Author:
Matt Sgarlata
See Also:
SimpleDelegatingTransformer, DefaultToBooleanConverter#COMPONENTS, TextToBooleanConverter, NumberToBooleanConverter, ObjectToBooleanConverter

Field Summary
 
Fields inherited from class net.sf.morph.transform.transformers.BaseCompositeTransformer
components
 
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
 
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
 
Fields inherited from interface net.sf.morph.transform.Transformer
TRANSFORMATION_TYPE_CONVERT, TRANSFORMATION_TYPE_COPY
 
Constructor Summary
DefaultToBooleanConverter()
           
 
Method Summary
protected  Transformer[] createDefaultComponents()
          Create the default set of Transformer components.
protected  java.lang.Class[] getDestinationClassesImpl()
          Transformer.getDestinationClasses() implementation template method.
protected  boolean isTransformableImpl(java.lang.Class destinationType, java.lang.Class sourceType)
          Determines if one of the delegate transformers is capable of performing the given transformation.
 
Methods inherited from class net.sf.morph.transform.transformers.SimpleDelegatingTransformer
clearVisitedSourceToDestinationMapIfNecessary, clone, convertImpl, copyImpl, createReusableSource, decrementStackDepth, getCachedResult, getComponents, getCopier, getSourceClassesImpl, getSpecializer, getTransformer, getTransformer, getTransformers, getVisitedSourceToDestinationMap, hasVisited, hasVisitedDestination, incrementStackDepth, initializeImpl, isAutomaticallyHandlingNulls, isImpreciseTransformationImpl, isPerformingLogging, isPreferPreciseTransformers, isSpecializable, recordVisit, setComponents, setPreferPreciseTransformers, setSpecializer, specialize
 
Methods inherited from class net.sf.morph.transform.transformers.BaseCompositeTransformer
getComponentType, getComponentValidator, isNarrowingComponentArray, isWrappingRuntimeExceptions, setComponentValidator, setNestedTransformer, updateNestedTransformerComponents
 
Methods inherited from class net.sf.morph.transform.transformers.BaseTransformer
convert, convert, copy, copy, createDefaultReflector, createNewInstance, createNewInstanceImpl, equals, equals, equalsUnidirectionalTest, getDestinationClasses, getInstantiatingReflector, getLocale, getLog, getNestedTransformer, getReflector, getReflector, getSourceClasses, getTransformableCallCache, getTransformerName, initialize, isCachingIsTransformableCalls, isImpreciseTransformation, isInitialized, isTransformable, setCachingIsTransformableCalls, setDestinationClasses, setInitialized, setLog, setReflector, setSourceClasses, setTransformableCallCache, setTransformerName, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.morph.transform.ExplicitTransformer
isTransformable
 
Methods inherited from interface net.sf.morph.transform.Transformer
getDestinationClasses, getSourceClasses
 
Methods inherited from interface net.sf.morph.transform.DecoratedCopier
copy
 
Methods inherited from interface net.sf.morph.transform.Copier
copy
 
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.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

DefaultToBooleanConverter

public DefaultToBooleanConverter()
Method Detail

createDefaultComponents

protected Transformer[] createDefaultComponents()
Create the default set of Transformer components.

Overrides:
createDefaultComponents in class SimpleDelegatingTransformer
Returns:
Transformer[]

getDestinationClassesImpl

protected java.lang.Class[] getDestinationClassesImpl()
                                               throws java.lang.Exception
Transformer.getDestinationClasses() implementation template method.

Overrides:
getDestinationClassesImpl in class SimpleDelegatingTransformer
Returns:
Class[]
Throws:
java.lang.Exception
See Also:
BaseTransformer.getDestinationClassesImpl()

isTransformableImpl

protected boolean isTransformableImpl(java.lang.Class destinationType,
                                      java.lang.Class sourceType)
                               throws java.lang.Exception
Determines if one of the delegate transformers is capable of performing the given transformation. This method is necessary because otherwise the delegating transformer would be too eager in what it says it can convert. For example, if a delegate transformer was capable of transforming A to B and another delegate was capable of transforming C to D, this transformer would incorrectly state that transforming A to D and C to B was possible even though they are not.

Overrides:
isTransformableImpl in class SimpleDelegatingTransformer
Parameters:
destinationType - the destination type to test
sourceType - the source type to test
Returns:
whether the destination type is transformable to the source type
Throws:
TransformationException - if it could not be determined if sourceType is transformable into destinationType
java.lang.Exception


Copyright © 2004-2008.