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.
Modifier and Type | Field and Description |
---|---|
static ListDelimiterHandler |
INSTANCE
A default instance of this class.
|
NOOP_TRANSFORMER
Constructor and Description |
---|
DisabledListDelimiterHandler() |
Modifier and Type | Method and 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.
|
escape, parse, split
public static final ListDelimiterHandler INSTANCE
DisabledListDelimiterHandler
objects this instance can be used
whenever such an object is needed.public Object escapeList(List<?> values, ValueTransformer transformer)
UnsupportedOperationException
exception.values
- the list with all the values to be converted to a single
valuetransformer
- a ValueTransformer
for an additional encoding
(must not be null)protected Collection<String> splitString(String s, boolean trim)
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.)splitString
in class AbstractListDelimiterHandler
s
- the string to be split (not null)trim
- a flag whether the single components have to be trimmedprotected String escapeString(String s)
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.escapeString
in class AbstractListDelimiterHandler
s
- the string to be escaped (not null)Copyright © 2001–2020 The Apache Software Foundation. All rights reserved.