Class CharSequenceConverter<T>
java.lang.Object
org.apache.sis.internal.converter.ClassPair<S,T>
org.apache.sis.internal.converter.SystemConverter<CharSequence,T>
org.apache.sis.internal.converter.CharSequenceConverter<T>
- All Implemented Interfaces:
Serializable,Function<CharSequence,,T> ObjectConverter<CharSequence,T>
Handles conversions from
CharSequence to String, then forward
to another converter from String to various objects. Instance of this
converter are not registered in ConverterRegistry like other converters
because we avoid registering converter expecting interfaces as their source.
The main purpose of this class is to support the conversion of
InternationalString.
Immutability and thread safety
This class is immutable, and thus inherently thread-safe, if the converter given to the constructor is also immutable.- Since:
- 0.3
- Version:
- 0.3
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ObjectConverter<? super String,? extends T> The converter to apply after this one.private static final longFor cross-version compatibility.Fields inherited from class org.apache.sis.internal.converter.ClassPair
sourceClass, targetClass -
Constructor Summary
ConstructorsConstructorDescriptionCharSequenceConverter(Class<T> targetClass, ObjectConverter<? super String, ? extends T> next) Creates a new converter fromCharSequenceto the given target type. -
Method Summary
Modifier and TypeMethodDescriptionapply(CharSequence source) Converts an object to an object of the target type.Returns the properties of the converter given at construction time minusFunctionProperty.INJECTIVE, because we don't know how many sourceCharSequences can produce the sameString.Methods inherited from class org.apache.sis.internal.converter.SystemConverter
bijective, equals, formatErrorMessage, getSourceClass, getTargetClass, inverse, readResolve, uniqueMethods inherited from class org.apache.sis.internal.converter.ClassPair
cast, hashCode, parentSource, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
next
The converter to apply after this one.
-
-
Constructor Details
-
CharSequenceConverter
CharSequenceConverter(Class<T> targetClass, ObjectConverter<? super String, ? extends T> next) Creates a new converter fromCharSequenceto the given target type.- Parameters:
targetClass- the target class requested by the user.next- the converter to apply after this one.
-
-
Method Details
-
apply
Converts an object to an object of the target type.- Parameters:
source- the object to convert, ornull.- Returns:
- the converted object, or
null. - Throws:
UnconvertibleObjectException- if the given object is not an element of the function domain.
-
properties
Returns the properties of the converter given at construction time minusFunctionProperty.INJECTIVE, because we don't know how many sourceCharSequences can produce the sameString.- Returns:
- the manners in which source values are mapped to target values. May be an empty set, but never null.
-