org.apache.struts2.conversion

## Class StrutsTypeConverterHolder

- java.lang.Object
- - org.apache.struts2.conversion.StrutsTypeConverterHolder

- All Implemented Interfaces:
    TypeConverterHolder

      public class StrutsTypeConverterHolder
      extends Object
      implements TypeConverterHolder

  Default implementation of `TypeConverterHolder`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected HashSet<String>` | `unknownMappings` Record classes that doesn't have conversion mapping defined.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StrutsTypeConverterHolder()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addDefaultMapping(String className, TypeConverter typeConverter)` Adds mapping for default type converters - application scoped
    `void` | `addMapping(Class clazz, Map<String,Object> mapping)` Assign mapping of converters for given class
    `void` | `addNoMapping(Class clazz)` Adds no mapping flag for give class
    `void` | `addUnknownMapping(String className)` Adds no converter flag for given class name FIXME lukaszlenart: maybe it should be merged with NoMapping
    `boolean` | `containsDefaultMapping(String className)` Checks if converter was already defined for given class
    `boolean` | `containsNoMapping(Class clazz)` Check if there is no mapping for given class to convert
    `boolean` | `containsUnknownMapping(String className)` Checks if no mapping was defined for given class name FIXME lukaszlenart: maybe it should be merged with NoMapping
    `TypeConverter` | `getDefaultMapping(String className)` Returns instance of `TypeConverter` associated with given class
    `Map<String,Object>` | `getMapping(Class clazz)` Target class conversion Mappings.

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

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

- - ### Field Detail

    - #### unknownMappings

          protected HashSet<String> unknownMappings

      Record classes that doesn't have conversion mapping defined.

           - String -> classname as String

  - ### Constructor Detail

    - #### StrutsTypeConverterHolder

          public StrutsTypeConverterHolder()

  - ### Method Detail

    - #### addDefaultMapping

          public void addDefaultMapping(String className,
                                        TypeConverter typeConverter)

      Description copied from interface: `TypeConverterHolder`
      Adds mapping for default type converters - application scoped
      Specified by:
        `addDefaultMapping` in interface `TypeConverterHolder`
      Parameters:
        `className` - name of the class with associated converter
        `typeConverter` - `TypeConverter` instance for associated class

    - #### containsDefaultMapping

          public boolean containsDefaultMapping(String className)

      Description copied from interface: `TypeConverterHolder`
      Checks if converter was already defined for given class
      Specified by:
        `containsDefaultMapping` in interface `TypeConverterHolder`
      Parameters:
        `className` - name of the class to check for
      Returns:
        true if default mapping was already specified

    - #### getDefaultMapping

          public TypeConverter getDefaultMapping(String className)

      Description copied from interface: `TypeConverterHolder`
      Returns instance of `TypeConverter` associated with given class
      Specified by:
        `getDefaultMapping` in interface `TypeConverterHolder`
      Parameters:
        `className` - name of the class to return converter for
      Returns:
        instance of `TypeConverter` to be used to convert class

    - #### getMapping

          public Map<String,Object> getMapping(Class clazz)

      Description copied from interface: `TypeConverterHolder`
      Target class conversion Mappings.
      Specified by:
        `getMapping` in interface `TypeConverterHolder`
      Parameters:
        `clazz` - class to convert to/from
      Returns:
        `TypeConverter` for given class

    - #### addMapping

          public void addMapping(Class clazz,
                                 Map<String,Object> mapping)

      Description copied from interface: `TypeConverterHolder`
      Assign mapping of converters for given class
      Specified by:
        `addMapping` in interface `TypeConverterHolder`
      Parameters:
        `clazz` - class to convert to/from
        `mapping` - property converters

    - #### containsNoMapping

          public boolean containsNoMapping(Class clazz)

      Description copied from interface: `TypeConverterHolder`
      Check if there is no mapping for given class to convert
      Specified by:
        `containsNoMapping` in interface `TypeConverterHolder`
      Parameters:
        `clazz` - class to convert to/from
      Returns:
        true if mapping couldn't be found

    - #### addNoMapping

          public void addNoMapping(Class clazz)

      Description copied from interface: `TypeConverterHolder`
      Adds no mapping flag for give class
      Specified by:
        `addNoMapping` in interface `TypeConverterHolder`
      Parameters:
        `clazz` - class to register missing converter

    - #### containsUnknownMapping

          public boolean containsUnknownMapping(String className)

      Description copied from interface: `TypeConverterHolder`
      Checks if no mapping was defined for given class name FIXME lukaszlenart: maybe it should be merged with NoMapping
      Specified by:
        `containsUnknownMapping` in interface `TypeConverterHolder`
      Parameters:
        `className` - name of the class to check for
      Returns:
        true if converter was defined for given class name

    - #### addUnknownMapping

          public void addUnknownMapping(String className)

      Description copied from interface: `TypeConverterHolder`
      Adds no converter flag for given class name FIXME lukaszlenart: maybe it should be merged with NoMapping
      Specified by:
        `addUnknownMapping` in interface `TypeConverterHolder`
      Parameters:
        `className` - name of the class to mark there is no converter for it

Copyright © 2000–2025 Apache Software Foundation. All rights reserved.