public abstract class AbstractListDelimiterHandler extends Object implements ListDelimiterHandler
An abstract base class for concrete
This base class provides a fully functional implementation for parsing a value object which can deal with different cases like collections, arrays, iterators, etc. This logic is typically needed by every concrete subclass. Other methods are partly implemented handling special corner cases like null values; concrete subclasses do not have do implement the corresponding checks.
|Constructor and Description|
|Modifier and Type||Method and Description|
Escapes the specified single value object.
Escapes the specified string.
Parses the specified value for list delimiters and splits it if necessary.
Splits the specified string at the list delimiter and returns a collection with all extracted components.
Actually splits the passed in string which is guaranteed to be not null.
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Iterable. It is the responsibility of this method to return an
Iterablewhich contains all extracted values. Depending on the type of the passed in object the following things happen:
Iterableinterface, the corresponding
Iteratoris obtained, and contained elements are added to the resulting iteration.
public Collection<String> split(String s, boolean trim)
trimflag determines whether each extracted component should be trimmed. This typically makes sense as the list delimiter may be surrounded by whitespace. However, there may be specific use cases in which automatic trimming is not desired. This implementation handles the case that the passed in string is null. In this case, an empty collection is returned. Otherwise, this method delegates to
public Object escape(Object value, ValueTransformer transformer)
escapeString(String), otherwise no escaping is performed. Eventually, the passed in transformer is invoked so that additional encoding can be performed.
protected abstract Collection<String> splitString(String s, boolean trim)
split()method. Here the actual splitting logic has to be implemented.
s- the string to be split (not null)
trim- a flag whether the single components have to be trimmed
protected abstract 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.
s- the string to be escaped (not null)
Copyright © 2001–2020 The Apache Software Foundation. All rights reserved.