Class DisabledListDelimiterHandler
java.lang.Object
org.apache.commons.configuration2.convert.AbstractListDelimiterHandler
org.apache.commons.configuration2.convert.DisabledListDelimiterHandler
- All Implemented Interfaces:
ListDelimiterHandler
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
Modifier and TypeFieldDescriptionstatic final ListDelimiterHandler
A default instance of this class.Fields inherited from interface org.apache.commons.configuration2.convert.ListDelimiterHandler
NOOP_TRANSFORMER
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionescapeList
(List<?> values, ValueTransformer transformer) Escapes all values in the given list and concatenates them to a single string.protected String
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
A default instance of this class. Because it is safe to shareDisabledListDelimiterHandler
objects this instance can be used whenever such an object is needed.
-
-
Constructor Details
-
DisabledListDelimiterHandler
public DisabledListDelimiterHandler()
-
-
Method Details
-
escapeList
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 anUnsupportedOperationException
exception.- Parameters:
values
- the list with all the values to be converted to a single valuetransformer
- aValueTransformer
for an additional encoding (must not be null)- Returns:
- the resulting escaped value
-
escapeString
Escapes the specified string. This method is called byescape()
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 classAbstractListDelimiterHandler
- Parameters:
s
- the string to be escaped (not null)- Returns:
- the escaped string
-
splitString
Actually splits the passed in string which is guaranteed to be not null. This method is called by the base implementation of thesplit()
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, thetrim
flag is ignored. (Thetrim
flag refers to the components extracted from the string. Because no components are extracted nothing is trimmed.)- Specified by:
splitString
in classAbstractListDelimiterHandler
- 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
-