Package de.gebit.integrity.parameter.conversion

## Class ConversionContext

- java.lang.Object
- - de.gebit.integrity.parameter.conversion.ConversionContext

- All Implemented Interfaces:
    `Cloneable`

      public class ConversionContext
      extends Object
      implements 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 which `EmptyValue`s are to be treated.
    `protected InexistentValueHandling` | `inexistentValueHandlingPolicy` | The way in which `InexistentValue`s are to be treated.
    `protected Map<String,​Object>` | `properties` | Map to contain arbitrary information.
    `protected RegexValueHandling` | `regexValueHandlingPolicy` | The way in which `RegexValue`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

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `ComparisonResult` | `getComparisonResult()` |
    `EmptyValueHandling` | `getEmptyValueHandlingPolicy()` |
    `InexistentValueHandling` | `getInexistentValueHandlingPolicy()` |
    `Object` | `getProperty​(String aKey)` | Returns the property matching the key, or null if none was set.
    `RegexValueHandling` | `getRegexValueHandlingPolicy()` |
    `boolean` | `getSkipBeanToMapDefaultConversion()` |
    `UnresolvableVariableHandling` | `getUnresolvableVariableHandlingPolicy()` |
    `ConversionContext` | `skipBeanToMapDefaultConversion()` | Enable skipping of the bean-to-map default conversion ( `ObjectToMap`).
    `ConversionContext` | `withComparisonResult​(ComparisonResult aComparisonResult)` | Adds the provided comparison result.
    `ConversionContext` | `withEmptyValueHandling​(EmptyValueHandling aPolicy)` | Enables a certain `EmptyValueHandling` policy instead of the default.
    `ConversionContext` | `withInexistentValueHandling​(InexistentValueHandling aPolicy)` | Enables a certain `InexistentValueHandling` policy instead of the default.
    `ConversionContext` | `withProperty​(String aKey, Object anObject)` | Adds the provided property.
    `ConversionContext` | `withRegexValueHandling​(RegexValueHandling aPolicy)` | Enables a certain `RegexValueHandling` policy instead of the default.
    `ConversionContext` | `withUnresolvableVariableHandlingPolicy​(UnresolvableVariableHandling aPolicy)` | Enables a certain `UnresolvableVariableHandling` policy instead of the default.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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 which `InexistentValue`s are to be treated.

    - #### regexValueHandlingPolicy

          protected RegexValueHandling regexValueHandlingPolicy

      The way in which `RegexValue`s are to be treated.

    - #### emptyValueHandlingPolicy

          protected EmptyValueHandling emptyValueHandlingPolicy

      The way in which `EmptyValue`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 Map<String,​Object> properties

      Map to contain arbitrary information.

  - ### Constructor Detail

    - #### ConversionContext

          public ConversionContext()

      Creates an instance with the default initial values. SHOULD NEVER BE CALLED DIRECTLY!!! Use a Guice-injected Provider instead to create an instance!

  - ### 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 certain `UnresolvableVariableHandling` policy instead of the default.
      Parameters:
        `aPolicy` - the policy to use

    - #### withInexistentValueHandling

          public ConversionContext withInexistentValueHandling​(InexistentValueHandling aPolicy)

      Enables a certain `InexistentValueHandling` policy instead of the default.
      Parameters:
        `aPolicy` - the policy to use

    - #### withRegexValueHandling

          public ConversionContext withRegexValueHandling​(RegexValueHandling aPolicy)

      Enables a certain `RegexValueHandling` policy instead of the default.
      Parameters:
        `aPolicy` - the policy to use

    - #### withEmptyValueHandling

          public ConversionContext withEmptyValueHandling​(EmptyValueHandling aPolicy)

      Enables a certain `EmptyValueHandling` 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​(String aKey,
                                                Object anObject)

      Adds the provided property.
      Parameters:
        `aKey` - the key
        `anObject` - 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 Object getProperty​(String aKey)

      Returns the property matching the key, or null if none was set.
      Parameters:
        `aKey` - the key
      Returns:
        the property or null