Class ConversionContext
- java.lang.Object
-
- de.gebit.integrity.parameter.conversion.ConversionContext
-
- All Implemented Interfaces:
java.lang.Cloneable
public class ConversionContext extends java.lang.Object implements java.lang.Cloneable
A conversion context is a container for contextual information required to perform a value conversion.
This class is intended to be used in a Builder-style pattern.- Author:
- Rene Schneider - initial API and implementation
-
-
Field Summary
Fields Modifier and Type Field Description protected ComparisonResult
comparisonResult
In case of a value being converted which belongs to a comparison that has been executed, the result of said comparison can be provided.protected EmptyValueHandling
emptyValueHandlingPolicy
The way in whichEmptyValue
s are to be treated.protected InexistentValueHandling
inexistentValueHandlingPolicy
The way in whichInexistentValue
s are to be treated.protected java.util.Map<java.lang.String,java.lang.Object>
properties
Map to contain arbitrary information.protected RegexValueHandling
regexValueHandlingPolicy
The way in whichRegexValue
s are to be treated.protected boolean
skipBeanToMapDefaultConversion
Whether the default conversion applied to Java Bean classes (ObjectToMap
) shall be skipped in the conversion search and no conversion at all shall be done instead.protected UnresolvableVariableHandling
unresolvableVariableHandlingPolicy
The way in which unresolvable variables shall be treated.
-
Constructor Summary
Constructors Constructor Description ConversionContext()
Creates an instance with the default initial values.
-
Method Summary
-
-
-
Field Detail
-
skipBeanToMapDefaultConversion
protected boolean skipBeanToMapDefaultConversion
Whether the default conversion applied to Java Bean classes (ObjectToMap
) shall be skipped in the conversion search and no conversion at all shall be done instead.
-
unresolvableVariableHandlingPolicy
protected UnresolvableVariableHandling unresolvableVariableHandlingPolicy
The way in which unresolvable variables shall be treated.
-
inexistentValueHandlingPolicy
protected InexistentValueHandling inexistentValueHandlingPolicy
The way in whichInexistentValue
s are to be treated.
-
regexValueHandlingPolicy
protected RegexValueHandling regexValueHandlingPolicy
The way in whichRegexValue
s are to be treated.
-
emptyValueHandlingPolicy
protected EmptyValueHandling emptyValueHandlingPolicy
The way in whichEmptyValue
s are to be treated.
-
comparisonResult
protected ComparisonResult comparisonResult
In case of a value being converted which belongs to a comparison that has been executed, the result of said comparison can be provided.
-
properties
protected java.util.Map<java.lang.String,java.lang.Object> properties
Map to contain arbitrary information.
-
-
Method Detail
-
skipBeanToMapDefaultConversion
public ConversionContext skipBeanToMapDefaultConversion()
Enable skipping of the bean-to-map default conversion (ObjectToMap
).- See Also:
skipBeanToMapDefaultConversion
-
withUnresolvableVariableHandlingPolicy
public ConversionContext withUnresolvableVariableHandlingPolicy(UnresolvableVariableHandling aPolicy)
Enables a certainUnresolvableVariableHandling
policy instead of the default.- Parameters:
aPolicy
- the policy to use
-
withInexistentValueHandling
public ConversionContext withInexistentValueHandling(InexistentValueHandling aPolicy)
Enables a certainInexistentValueHandling
policy instead of the default.- Parameters:
aPolicy
- the policy to use
-
withRegexValueHandling
public ConversionContext withRegexValueHandling(RegexValueHandling aPolicy)
Enables a certainRegexValueHandling
policy instead of the default.- Parameters:
aPolicy
- the policy to use
-
withEmptyValueHandling
public ConversionContext withEmptyValueHandling(EmptyValueHandling aPolicy)
Enables a certainEmptyValueHandling
policy instead of the default.- Parameters:
aPolicy
- the policy to use
-
withComparisonResult
public ConversionContext withComparisonResult(ComparisonResult aComparisonResult)
Adds the provided comparison result.- Parameters:
aComparisonResult
- the comparison result to add
-
withProperty
public ConversionContext withProperty(java.lang.String aKey, java.lang.Object anObject)
Adds the provided property.- Parameters:
aKey
- the keyanObject
- the object
-
getSkipBeanToMapDefaultConversion
public boolean getSkipBeanToMapDefaultConversion()
-
getUnresolvableVariableHandlingPolicy
public UnresolvableVariableHandling getUnresolvableVariableHandlingPolicy()
-
getInexistentValueHandlingPolicy
public InexistentValueHandling getInexistentValueHandlingPolicy()
-
getRegexValueHandlingPolicy
public RegexValueHandling getRegexValueHandlingPolicy()
-
getEmptyValueHandlingPolicy
public EmptyValueHandling getEmptyValueHandlingPolicy()
-
getComparisonResult
public ComparisonResult getComparisonResult()
-
getProperty
public java.lang.Object getProperty(java.lang.String aKey)
Returns the property matching the key, or null if none was set.- Parameters:
aKey
- the key- Returns:
- the property or null
-
-