net.sf.morph.transform.copiers
Class PropertyNameMatchingCopier
java.lang.Object
net.sf.morph.transform.transformers.BaseTransformer
net.sf.morph.transform.transformers.BaseReflectorTransformer
net.sf.morph.transform.copiers.BasePropertyNameCopier
net.sf.morph.transform.copiers.PropertyNameMatchingCopier
- All Implemented Interfaces:
- net.sf.composite.Component, Converter, Copier, DecoratedConverter, DecoratedCopier, DecoratedTransformer, ExplicitTransformer, NodeCopier, Transformer
public class PropertyNameMatchingCopier
- extends BasePropertyNameCopier
Copies the properties specified by the propertiesToCopy
property of this class from the source to the destination. If
propertiesToCopy
is not specified, all of the source
properties will be copied to the destination.
Copies properties that have the same name from the source to the destination.
By default, if a property found on the source is missing on the destination,
an exception will not be thrown and copying will continue. If you
want to ensure all properties from the source are copied to the destination,
set the errorOnMissingProperty property of this class to
true
.
- Since:
- Oct 31, 2004
- Author:
- Matt Sgarlata, Alexander Volanis
Method Summary |
void |
addPropertyToCopy(java.lang.String propertyName)
Add a property to copy. |
void |
addPropertyToIgnore(java.lang.String propertyName)
Add a property to ignore. |
void |
copyImpl(java.lang.Object destination,
java.lang.Object source,
java.util.Locale locale,
java.lang.Integer preferredTransformationType)
Implementation of the copy method. |
java.lang.String[] |
getPropertiesToCopy()
Get the properties to copy. |
java.lang.String[] |
getPropertiesToIgnore()
Get the properties to ignore. |
protected boolean |
isImpreciseTransformationImpl(java.lang.Class destinationClass,
java.lang.Class sourceClass)
Implementation of isImpreciseTransformation |
void |
setPropertiesToCopy(java.lang.String[] propertiesToCopy)
Set the properties to copy. |
void |
setPropertiesToIgnore(java.lang.String[] propertiesToIgnore)
Set the properties to ignore. |
Methods inherited from class net.sf.morph.transform.copiers.BasePropertyNameCopier |
chooseTransformer, copyProperty, createReusableSource, getDestinationClassesImpl, getNestedTransformer, getPreferredTransformationType, getPropertyTransformers, getSourceClassesImpl, isErrorOnMissingProperty, isWrappingRuntimeExceptions, setDestinationClasses, setErrorOnMissingProperty, setNestedTransformer, setPropertyTransformers, setSourceClasses |
Methods inherited from class net.sf.morph.transform.transformers.BaseTransformer |
clone, convert, convert, convertImpl, copy, copy, createDefaultReflector, createNewInstance, createNewInstanceImpl, equals, equals, equalsUnidirectionalTest, getDestinationClasses, getInstantiatingReflector, getLocale, getLog, getReflector, getReflector, getSourceClasses, getTransformableCallCache, getTransformerName, initialize, initializeImpl, isAutomaticallyHandlingNulls, isCachingIsTransformableCalls, isImpreciseTransformation, isInitialized, isPerformingLogging, isTransformable, isTransformableImpl, setCachingIsTransformableCalls, setInitialized, setLog, setReflector, 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.Copier |
copy |
Methods inherited from interface net.sf.morph.transform.Copier |
copy |
PropertyNameMatchingCopier
public PropertyNameMatchingCopier()
- Create a new PropertyNameMatchingCopier.
PropertyNameMatchingCopier
public PropertyNameMatchingCopier(boolean errorOnMissingProperty)
- Create a new PropertyNameMatchingCopier.
- Parameters:
errorOnMissingProperty
-
copyImpl
public void copyImpl(java.lang.Object destination,
java.lang.Object source,
java.util.Locale locale,
java.lang.Integer preferredTransformationType)
throws java.lang.Exception
- Implementation of the copy method. By default, this method throws
UnsupportedOperationException.
- Overrides:
copyImpl
in class BaseTransformer
- Throws:
java.lang.Exception
getPropertiesToCopy
public java.lang.String[] getPropertiesToCopy()
- Get the properties to copy.
- Returns:
- String[]
setPropertiesToCopy
public void setPropertiesToCopy(java.lang.String[] propertiesToCopy)
- Set the properties to copy.
- Parameters:
propertiesToCopy
- String[]
addPropertyToCopy
public void addPropertyToCopy(java.lang.String propertyName)
- Add a property to copy.
- Parameters:
propertyName
-
getPropertiesToIgnore
public java.lang.String[] getPropertiesToIgnore()
- Get the properties to ignore.
- Returns:
- String[]
setPropertiesToIgnore
public void setPropertiesToIgnore(java.lang.String[] propertiesToIgnore)
- Set the properties to ignore.
- Parameters:
propertiesToIgnore
- String[]
addPropertyToIgnore
public void addPropertyToIgnore(java.lang.String propertyName)
- Add a property to ignore.
- Parameters:
propertyName
-
isImpreciseTransformationImpl
protected boolean isImpreciseTransformationImpl(java.lang.Class destinationClass,
java.lang.Class sourceClass)
- Implementation of isImpreciseTransformation
- Overrides:
isImpreciseTransformationImpl
in class BaseTransformer
- Returns:
- boolean
Copyright © 2004-2008.