Enum Implementation

java.lang.Object
java.lang.Enum<Implementation>
org.apache.sis.xml.Implementation
All Implemented Interfaces:
Serializable, Comparable<Implementation>, java.lang.constant.Constable

enum Implementation extends Enum<Implementation>
Known JAXB implementations. This enumeration allows to set vendor-specific marshaller properties.
Since:
0.8
Version:
1.0
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    JAXB implementation provided in a separated JAR, used for instance by Glassfish.
    JAXB implementation bundled in the JDK.
    Unrecognized implementation.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final String
    The prefix of property names which are provided in external (endorsed) implementation of JAXB.
    (package private) final String
    The JAXB property for setting the indentation string, or null if none.
    private static final String
    The prefix of property names which are provided in internal implementation of JAXB (the one bundled with the JDK 6).
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Creates a new enumeration value for a JAXB implementation.
  • Method Summary

    Modifier and Type
    Method
    Description
    Detects if we are using the endorsed JAXB implementation (the one provided in separated JAR files) or the one bundled in JDK.
    (package private) boolean
    Returns false if the given (un)marshaller property should be silently ignored.
    (package private) static String
    Converts the given key from "com.sun.xml.bind.*" to "com.sun.xml.internal.bind.*" namespace.
    Returns the enum constant of this type with the specified name.
    Returns an array containing the constants of this enum type, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • INTERNAL

      public static final Implementation INTERNAL
      JAXB implementation bundled in the JDK.
    • ENDORSED

      public static final Implementation ENDORSED
      JAXB implementation provided in a separated JAR, used for instance by Glassfish.
    • OTHER

      public static final Implementation OTHER
      Unrecognized implementation.
  • Field Details

    • ENDORSED_PREFIX

      private static final String ENDORSED_PREFIX
      The prefix of property names which are provided in external (endorsed) implementation of JAXB. This is slightly different than the prefix used by the implementation bundled with the JDK 6, which is "com.sun.xml.internal.bind".
      See Also:
    • INTERNAL_PREFIX

      private static final String INTERNAL_PREFIX
      The prefix of property names which are provided in internal implementation of JAXB (the one bundled with the JDK 6).
      See Also:
    • indentKey

      final String indentKey
      The JAXB property for setting the indentation string, or null if none.
  • Constructor Details

    • Implementation

      private Implementation(String indentKey)
      Creates a new enumeration value for a JAXB implementation.
  • Method Details

    • values

      public static Implementation[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static Implementation valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • detect

      public static Implementation detect(JAXBContext context)
      Detects if we are using the endorsed JAXB implementation (the one provided in separated JAR files) or the one bundled in JDK. We use the JAXB context package name as a criterion:
      • JAXB endorsed JAR uses "com.sun.xml.bind.*"
      • JAXB bundled in JDK uses "com.sun.xml.internal.bind.*"
      Parameters:
      context - the JAXB context for which to detect the implementation.
      Returns:
      the implementation, or OTHER if unknown.
    • filterProperty

      boolean filterProperty(String key)
      Returns false if the given (un)marshaller property should be silently ignored. A value of true does not necessarily mean that the given property is supported, but that the caller should either support the property or throw an exception.

      This method excludes the "com.sun.xml.bind.*" properties if the implementation is not ENDORSED or INTERNAL. We do not distinguish between the endorsed and internal namespaces since Apache SIS uses only the endorsed namespace and lets org.apache.sis.xml.Pooled do the conversion to internal namespace if needed.

      Parameters:
      key - the property key to test.
      Returns:
      false if the given property should be silently ignored.
    • toInternal

      static String toInternal(String key)
      Converts the given key from "com.sun.xml.bind.*" to "com.sun.xml.internal.bind.*" namespace. This method is invoked when the JAXB implementation is known to be the INTERNAL one. We perform this conversion for allowing Apache SIS to ignore the difference between internal and endorsed JAXB.
      Parameters:
      key - the key that may potentially a endorsed JAXB key.
      Returns:
      the key as an internal JAXB key, or the given key unchanged if it is not an endorsed JAXB key.