Package org.apache.sis.feature
Class StringJoinOperation.ForFeature
java.lang.Object
org.apache.sis.internal.converter.SurjectiveConverter<Object,Object>
org.apache.sis.feature.StringJoinOperation.ForFeature
- All Implemented Interfaces:
Serializable,Function<Object,,Object> ObjectConverter<Object,Object>
- Enclosing class:
- StringJoinOperation
private static final class StringJoinOperation.ForFeature
extends SurjectiveConverter<Object,Object>
implements Serializable
A pseudo-converter returning the identifier of a feature. This pseudo-converter is used in place
of "real" converters in the
StringJoinOperation.converters array when the property is an
association to a feature instead of an attribute. This pseudo-converters is used as below:
StringJoinOperation.Result.getValue()gets this converter by a call toconverters[i].inverse(). This works provided thatinverse()returnsthis(see comment below).StringJoinOperation.Result.setValue(String)needs to perform a special case for this class.
inverse() method does not fulfill the required
semantic of ObjectConverter.inverse(), but this is okay for StringJoinOperation needs.
This converter should never be accessible to users however.-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final ObjectConverter<? super String,?> The "real" converter which would have been stored in theStringJoinOperation.convertersarray if the property was an attribute instead of an association.private static final longFor cross-version compatibility. -
Constructor Summary
ConstructorsConstructorDescriptionForFeature(ObjectConverter<? super String, ?> converter) Creates a new wrapper over the given converter. -
Method Summary
Modifier and TypeMethodDescriptionConverts the given object from the source type S to the target type T.Returns the type of objects to convert.Returns the type of converted objects.inverse()Returnsthisfor allowingStringJoinOperation.Result.getValue()to get this pseudo-converter.Methods inherited from class org.apache.sis.internal.converter.SurjectiveConverter
properties, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
converter
The "real" converter which would have been stored in theStringJoinOperation.convertersarray if the property was an attribute instead of an association. For formatting the feature identifier, we need to use the inverse of that converter.
-
-
Constructor Details
-
ForFeature
ForFeature(ObjectConverter<? super String, ?> converter) Creates a new wrapper over the given converter.
-
-
Method Details
-
inverse
Returnsthisfor allowingStringJoinOperation.Result.getValue()to get this pseudo-converter. This is a violation ofObjectConvertercontract since this pseudo-converter is not an identity converter. Direct uses of this pseudo-converter will need ainstanceofcheck instead.- Specified by:
inversein interfaceObjectConverter<Object,Object> - Overrides:
inversein classSurjectiveConverter<Object,Object> - Returns:
- a converter for converting instances of T back to instances of S.
- See Also:
-
getSourceClass
Description copied from interface:ObjectConverterReturns the type of objects to convert.- Specified by:
getSourceClassin interfaceObjectConverter<Object,Object> - Returns:
- the type of objects to convert.
-
getTargetClass
Description copied from interface:ObjectConverterReturns the type of converted objects.- Specified by:
getTargetClassin interfaceObjectConverter<Object,Object> - Returns:
- the type of converted objects.
-
apply
Description copied from interface:ObjectConverterConverts the given object from the source type S to the target type T. If the given object cannot be converted, then this method may either returnsnullor throws an exception, at implementation choice (except for injective functions, which must throw an exception - see the class Javadoc for more discussion about function properties).Example: in Apache SIS implementation, converters fromStringtoNumberdistinguish two kinds of unconvertible objects:- Null or empty source string result in a
nullvalue to be returned. - All other kind of unparsable strings results in an exception to be thrown.
""value is unconvertible but nevertheless considered as part of the converter domain, and is mapped to "no number". All other unparsable strings are considered outside the converter domain. - Null or empty source string result in a
-