Package cdc.converters.defaults
Class AbstractStringToSequence<T>
- java.lang.Object
-
- cdc.converters.AbstractConverter<S,T>
-
- cdc.converters.defaults.AbstractSequenceConverter<String,T>
-
- cdc.converters.defaults.AbstractStringToSequence<T>
-
- Type Parameters:
T- The sequence type.
- Direct Known Subclasses:
StringToArray,StringToList
public abstract class AbstractStringToSequence<T> extends AbstractSequenceConverter<String,T>
Base class used to convert a string to a sequence.A sequence is converted to:
(prefix) item separator item separator ... (suffix)
If trim is set, then each item string representation is trimmed before being converted to item.
prefix and suffix are optional.
separator must be mandatory for this class to be useful.- Author:
- Damien Carbonne
-
-
Field Summary
Fields Modifier and Type Field Description static FormalArg<Boolean>TRIM-
Fields inherited from class cdc.converters.defaults.AbstractSequenceConverter
PREFIX, SEPARATOR, SUFFIX
-
Fields inherited from interface cdc.converters.Converter
META_FARGS, SOURCE_CLASS, TARGET_CLASS
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleangetTrim()protected <V> List<V>toList(String s, Function<String,? extends V> converter)Converts the string to a list of items.-
Methods inherited from class cdc.converters.defaults.AbstractSequenceConverter
getPrefix, getSeparator, getSuffix
-
Methods inherited from class cdc.converters.AbstractConverter
getSourceClass, getTargetClass, getWrappedSourceClass, getWrappedTargetClass, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface cdc.converters.Converter
adapt, andThen, andThenRaw, applyRaw, areCompliantSourceAndTargetClasses, areMatchingSourceAndTargetClasses, cast, compose, composeRaw, getParams, isCompliantSourceClass, isCompliantTargetClass, isMatchingSourceClass, isMatchingTargetClass, orElse, orElseRaw
-
-
-
-
Method Detail
-
getTrim
public final boolean getTrim()
-
toList
protected <V> List<V> toList(String s, Function<String,? extends V> converter)
Converts the string to a list of items.This works when separator is mandatory.
- Type Parameters:
V- The item type.- Parameters:
s- The string.converter- The converter from string toV.- Returns:
- A list of items after interpreting
swith prefix, suffix, separator and trim.
-
-