Package org.apache.commons.configuration2.convert

# Class DisabledListDelimiterHandler

java.lang.Object
org.apache.commons.configuration2.convert.AbstractListDelimiterHandler
org.apache.commons.configuration2.convert.DisabledListDelimiterHandler

All Implemented Interfaces:
  `ListDelimiterHandler`

public class DisabledListDelimiterHandler extends AbstractListDelimiterHandler

A specialized implementation of the `ListDelimiterHandler` interface which disables list splitting.

This class does not recognize any list delimiters; passed in strings are returned unchanged. Also the `escape()` method is a dummy - there is no need for escaping delimiter characters as none are supported. Note that the method for escaping a list throws an `UnsupportedOperationException`. If list delimiters are not supported, there is no point in squashing multiple values into a single one.

Implementation note: An instance of this class can be shared between multiple configuration objects. It is state-less and thread-safe.

Since:
  2.0

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final ListDelimiterHandler`
  `INSTANCE`
  A default instance of this class.

  ### Fields inherited from interface org.apache.commons.configuration2.convert.ListDelimiterHandler

  `NOOP_TRANSFORMER`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DisabledListDelimiterHandler()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Object`
  `escapeList(List<?> values, ValueTransformer transformer)`
  Escapes all values in the given list and concatenates them to a single string.
  `protected String`
  `escapeString(String s)`
  Escapes the specified string.
  `protected Collection<String>`
  `splitString(String s, boolean trim)`
  Actually splits the passed in string which is guaranteed to be not null.

  ### Methods inherited from class org.apache.commons.configuration2.convert.AbstractListDelimiterHandler

  `escape, parse, split`

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

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

  ### Methods inherited from interface org.apache.commons.configuration2.convert.ListDelimiterHandler

  `flatten`

- ## Field Details

  - ### INSTANCE

    public static final ListDelimiterHandler INSTANCE
    A default instance of this class. Because it is safe to share `DisabledListDelimiterHandler` objects this instance can be used whenever such an object is needed.

- ## Constructor Details

  - ### DisabledListDelimiterHandler

    public DisabledListDelimiterHandler()

- ## Method Details

  - ### escapeList

    public Object escapeList(List<?> values, ValueTransformer transformer)
    Escapes all values in the given list and concatenates them to a single string. This operation is required by configurations that have to represent properties with multiple values in a single line in their external configuration representation. This may require an advanced escaping in some cases. This implementation always throws an `UnsupportedOperationException` exception.
    Parameters:
      `values` - the list with all the values to be converted to a single value
      `transformer` - a `ValueTransformer` for an additional encoding (must not be null)
    Returns:
      the resulting escaped value

  - ### escapeString

    protected String escapeString(String s)
    Escapes the specified string. This method is called by `escape()` if the passed in object is a string. Concrete subclasses have to implement their specific escaping logic here, so that the list delimiters they support are properly escaped. This implementation returns the passed in string without any changes.
    Specified by:
      `escapeString` in class `AbstractListDelimiterHandler`
    Parameters:
      `s` - the string to be escaped (not null)
    Returns:
      the escaped string

  - ### splitString

    protected Collection<String> splitString(String s, boolean trim)
    Actually splits the passed in string which is guaranteed to be not null. This method is called by the base implementation of the `split()` method. Here the actual splitting logic has to be implemented. This implementation always returns a collection containing the passed in string as its single element. The string is not changed, the `trim` flag is ignored. (The `trim` flag refers to the components extracted from the string. Because no components are extracted nothing is trimmed.)
    Specified by:
      `splitString` in class `AbstractListDelimiterHandler`
    Parameters:
      `s` - the string to be split (not null)
      `trim` - a flag whether the single components have to be trimmed
    Returns:
      a collection with the extracted components of the passed in string