Package org.apache.sis.metadata
Class SpecialCases
java.lang.Object
org.apache.sis.metadata.PropertyAccessor
org.apache.sis.metadata.SpecialCases
Substitute on-the-fly the values of some ISO 19115 properties handled in a special way.
Current implementation handles the longitude and latitude bounds of
GeographicBoundingBox
,
which are returned as Longitude
or Latitude
instances instead of Double
.- Since:
- 0.4
- Version:
- 1.3
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int
Index of properties to handle in a special way.private final int
Index of properties to handle in a special way.private final int
Index of properties to handle in a special way.private final int
Index of properties to handle in a special way.Fields inherited from class org.apache.sis.metadata.PropertyAccessor
APPEND, COUNT_DEEP, COUNT_FIRST, COUNT_SHALLOW, IGNORE_READ_ONLY, implementation, RETURN_NULL, RETURN_PREVIOUS, type
-
Constructor Summary
ConstructorsConstructorDescriptionSpecialCases
(Class<?> type, Class<?> implementation, Class<?> standardImpl) Creates a new property accessor for the specified metadata implementation. -
Method Summary
Modifier and TypeMethodDescription(package private) static boolean
Returnstrue
if the given method should be excluded in current Apache SIS version.(package private) Object
Delegates toPropertyAccessor.get(int, Object)
, then substitutes the value for the properties handled in a special way.(package private) static boolean
isLocaleAndCharset
(PropertyAccessor accessor, int indexInData) Returnstrue
if the property at the given index is aMap<Locale,Charset>
.(package private) static boolean
isSpecialCase
(Class<?> type) Returnstrue
if the given class is a special case handled by theSpecialCases
class.(package private) CharSequence
Returns a remark or warning to format with the value at the given index, ornull
if none.(package private) static String
Returns the identifier to use in replacement of the identifier given inUML
annotations.(package private) Object
Substitutes the value for the properties handled in a special way, then delegates toset(int, Object, Object, int)
.(package private) Class
<?> type
(int index, TypeValuePolicy policy) Delegates toPropertyAccessor.type(int, TypeValuePolicy)
, then substitutes the type for the properties handled in a special way.Methods inherited from class org.apache.sis.metadata.PropertyAccessor
count, count, equals, indexOf, information, isCollectionOrMap, isMap, isWritable, isWritable, name, toString, walkReadable, walkWritable
-
Field Details
-
westBoundLongitude
private final int westBoundLongitudeIndex of properties to handle in a special way. -
eastBoundLongitude
private final int eastBoundLongitudeIndex of properties to handle in a special way. -
southBoundLatitude
private final int southBoundLatitudeIndex of properties to handle in a special way. -
northBoundLatitude
private final int northBoundLatitudeIndex of properties to handle in a special way.
-
-
Constructor Details
-
SpecialCases
Creates a new property accessor for the specified metadata implementation.- Parameters:
type
- the interface implemented by the metadata, which must be the value returned byMetadataStandard.findInterface(CacheKey)
.implementation
- the class of metadata implementations, ortype
if none.standardImpl
- the implementation specified by theMetadataStandard
, ornull
if none. This is the same thanimplementation
unless a custom implementation is used.
-
-
Method Details
-
isSpecialCase
Returnstrue
if the given class is a special case handled by theSpecialCases
class.- Parameters:
type
- the interface implemented by the metadata.- Returns:
true
if the given type is a special case.
-
exclude
Returnstrue
if the given method should be excluded in current Apache SIS version. A future SIS version may handle that property as a special case instead.- Parameters:
type
- the class or interface containing the method.method
- the method to test for exclusion.- Returns:
true
if the given method should be excluded.
-
type
Delegates toPropertyAccessor.type(int, TypeValuePolicy)
, then substitutes the type for the properties handled in a special way.- Overrides:
type
in classPropertyAccessor
- Parameters:
index
- the index of the property.policy
- the kind of type to return.- Returns:
- the type of property values, or
null
if unknown.
-
remarks
Returns a remark or warning to format with the value at the given index, ornull
if none. This is used for notifying the user that a geographic box is crossing the anti-meridian.- Overrides:
remarks
in classPropertyAccessor
-
get
Delegates toPropertyAccessor.get(int, Object)
, then substitutes the value for the properties handled in a special way.- Overrides:
get
in classPropertyAccessor
- Parameters:
index
- the index of the property for which to get a value.metadata
- the metadata object to query.- Returns:
- the value, or
null
if none or if the given is out of bounds. - Throws:
BackingStoreException
- if the implementation threw a checked exception.
-
set
Object set(int index, Object metadata, Object value, int mode) throws UnmodifiableMetadataException, ClassCastException, BackingStoreException Substitutes the value for the properties handled in a special way, then delegates toset(int, Object, Object, int)
.- Overrides:
set
in classPropertyAccessor
- Parameters:
index
- the index of the property to set.metadata
- the metadata object on which to set the value.value
- the new value.mode
- whether this method should first fetches the old value, as one of the constants listed in this method javadoc.- Returns:
- the old value, or
null
ifmode
wasRETURN_NULL
orIGNORE_READ_ONLY
. - Throws:
UnmodifiableMetadataException
- if the property for the given key is read-only.ClassCastException
- if the given value is not of the expected type.BackingStoreException
- if the implementation threw a checked exception.
-
isLocaleAndCharset
Returnstrue
if the property at the given index is aMap<Locale,Charset>
. -
rename
Returns the identifier to use in replacement of the identifier given inUML
annotations. We usually want to use those identifiers as-is because they were specified by ISO standards, but we may do an exception if the identifier is actually a construction of two or more identifiers like"defaultLocale+otherLocale"
.- Parameters:
name
- the UML identifier(s) from ISO specification.- Returns:
- the potentially simplified identifier to use for displaying purpose.
-