Class PathConverter<S,T>
java.lang.Object
org.apache.sis.internal.converter.ClassPair<S,T>
org.apache.sis.internal.converter.SystemConverter<S,T>
org.apache.sis.internal.converter.PathConverter<S,T>
- All Implemented Interfaces:
Serializable
,Function<S,
,T> ObjectConverter<S,
T>
- Direct Known Subclasses:
PathConverter.FilePath
,PathConverter.FileURI
,PathConverter.FileURL
,PathConverter.PathFile
,PathConverter.PathURI
,PathConverter.PathURL
,PathConverter.URI_URL
,PathConverter.URIFile
,PathConverter.URIPath
,PathConverter.URL_URI
,PathConverter.URLFile
,PathConverter.URLPath
Handles conversions between
Path
, File
, URI
and URL
objects.
Immutability and thread safety
This base class and all inner classes are immutable, and thus inherently thread-safe.- Since:
- 0.3
- Version:
- 0.7
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
static final class
static final class
static final class
static final class
static final class
static final class
static final class
static final class
static final class
static final class
static final class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final long
For cross-version compatibility.Fields inherited from class org.apache.sis.internal.converter.ClassPair
sourceClass, targetClass
-
Constructor Summary
ConstructorsConstructorDescriptionPathConverter
(Class<S> sourceClass, Class<T> targetClass) Creates a path converter from the given source class to the given target class. -
Method Summary
Modifier and TypeMethodDescriptionfinal T
Converts the given path to the target type of this converter.(package private) abstract T
Invoked byapply(Object)
for converting the given path to the target type of this converter.final Set<FunctionProperty>
Returns the properties of this converter.Methods inherited from class org.apache.sis.internal.converter.SystemConverter
bijective, equals, formatErrorMessage, getSourceClass, getTargetClass, inverse, readResolve, unique
Methods 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:
-
-
Constructor Details
-
PathConverter
Creates a path converter from the given source class to the given target class.
-
-
Method Details
-
properties
Returns the properties of this converter.- Returns:
- the manners in which source values are mapped to target values. May be an empty set, but never null.
-
apply
Converts the given path to the target type of this converter. This method verifies that the given path is non-null, then delegates todoConvert(Object)
.- Parameters:
source
- the path to convert, ornull
.- Returns:
- the converted value, or
null
if the given path was null. - Throws:
UnconvertibleObjectException
- if an error occurred during the conversion.
-
doConvert
Invoked byapply(Object)
for converting the given path to the target type of this converter.- Parameters:
source
- the path to convert, guaranteed to be non-null.- Returns:
- the converted path.
- Throws:
Exception
- if an error occurred during the conversion.
-