Class StandardImplementation

java.lang.Object
org.apache.sis.metadata.MetadataStandard
org.apache.sis.metadata.StandardImplementation
All Implemented Interfaces:
Serializable

final class StandardImplementation extends MetadataStandard
Information about an Apache SIS metadata standard implementation.
Since:
0.3
Version:
0.3
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      For cross-version compatibility.
      See Also:
    • implementationPackage

      private final String implementationPackage
      The root packages for metadata implementations, or null if none. If non-null, then this string must ends with a trailing ".".
    • IMPL_PREFIXES

      private static final String[] IMPL_PREFIXES
      The prefixes that implementation classes may have. The most common prefixes should be first, because the prefixes will be tried in that order.
    • acronyms

      private final String[] acronyms
      The acronyms that implementation classes may have, or null if none. If non-null, then this array shall contain (full text, acronym) pairs. The full text shall appear to the end of the class name, otherwise it is not replaced. This is necessary in order to avoid the replacement of "DefaultCoordinateSystemAxis" by "DefaultCSAxis".
    • implementations

      private final transient Map<Class<?>,Class<?>> implementations
      Implementations for a given interface, computed when first needed then cached.
      Implementation note: In the particular case of Class keys, IdentityHashMap and HashMap have identical behavior since Class is final and does not override the equals(Object) and hashCode() methods. The IdentityHashMap Javadoc claims that it is faster than the regular HashMap. But maybe the most interesting property is that it allocates less objects since IdentityHashMap implementation doesn't need the chain of objects created by HashMap.
  • Constructor Details

    • StandardImplementation

      StandardImplementation(String citation, String interfacePackage, String implementationPackage, String[] acronyms, MetadataStandard... dependencies)
      Creates a new instance working on implementation of interfaces defined in the specified package. This constructor is used only for the predefined constants.
      Parameters:
      citation - the title of the standard.
      interfacePackage - the root package for metadata interfaces, with a trailing '.'.
      implementationPackage - the root package for metadata implementations. with a trailing '.'.
      acronyms - an array of (full text, acronyms) pairs. This array is not cloned.
      dependencies - the dependencies to other metadata standards, or null if none.
  • Method Details

    • isPendingAPI

      boolean isPendingAPI(Class<?> type)
      Accepts Apache SIS implementation classes as "pseudo-interfaces" if they are annotated with UML. We use this feature for example in the transition from ISO 19115:2003 to ISO 19115:2014, when new API is defined in Apache SIS but not yet available in GeoAPI interfaces.
      Overrides:
      isPendingAPI in class MetadataStandard
    • getImplementation

      public <T> Class<? extends T> getImplementation(Class<T> type)
      Returns the implementation class for the given interface, or null if none. This class uses heuristic rules based on naming conventions.
      Overrides:
      getImplementation in class MetadataStandard
      Type Parameters:
      T - the compile-time type.
      Parameters:
      type - the interface, typically from the org.opengis.metadata package.
      Returns:
      the implementation class, or null if none.
    • readResolve

      Object readResolve() throws ObjectStreamException
      Invoked on deserialization. Returns one of the preexisting constants if possible.
      Throws:
      ObjectStreamException