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 intIndex of properties to handle in a special way.private final intIndex of properties to handle in a special way.private final intIndex of properties to handle in a special way.private final intIndex 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 booleanReturnstrueif the given method should be excluded in current Apache SIS version.(package private) ObjectDelegates toPropertyAccessor.get(int, Object), then substitutes the value for the properties handled in a special way.(package private) static booleanisLocaleAndCharset(PropertyAccessor accessor, int indexInData) Returnstrueif the property at the given index is aMap<Locale,Charset>.(package private) static booleanisSpecialCase(Class<?> type) Returnstrueif the given class is a special case handled by theSpecialCasesclass.(package private) CharSequenceReturns a remark or warning to format with the value at the given index, ornullif none.(package private) static StringReturns the identifier to use in replacement of the identifier given inUMLannotations.(package private) ObjectSubstitutes 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, ortypeif none.standardImpl- the implementation specified by theMetadataStandard, ornullif none. This is the same thanimplementationunless a custom implementation is used.
-
-
Method Details
-
isSpecialCase
Returnstrueif the given class is a special case handled by theSpecialCasesclass.- Parameters:
type- the interface implemented by the metadata.- Returns:
trueif the given type is a special case.
-
exclude
Returnstrueif 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:
trueif 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:
typein classPropertyAccessor- Parameters:
index- the index of the property.policy- the kind of type to return.- Returns:
- the type of property values, or
nullif unknown.
-
remarks
Returns a remark or warning to format with the value at the given index, ornullif none. This is used for notifying the user that a geographic box is crossing the anti-meridian.- Overrides:
remarksin classPropertyAccessor
-
get
Delegates toPropertyAccessor.get(int, Object), then substitutes the value for the properties handled in a special way.- Overrides:
getin classPropertyAccessor- Parameters:
index- the index of the property for which to get a value.metadata- the metadata object to query.- Returns:
- the value, or
nullif 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:
setin 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
nullifmodewasRETURN_NULLorIGNORE_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
Returnstrueif the property at the given index is aMap<Locale,Charset>. -
rename
Returns the identifier to use in replacement of the identifier given inUMLannotations. 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.
-