Class JAXBBuilderDefaultSettings

java.lang.Object
com.helger.jaxb.builder.JAXBBuilderDefaultSettings

@ThreadSafe public final class JAXBBuilderDefaultSettings extends Object
A class containing some default settings for the various JAXB builders.
Changes made in this class only effects instances that are created afterwards. Existing instances are never changed.
Author:
Philip Helger
  • Field Details

    • DEFAULT_USE_CONTEXT_CACHE

      public static final boolean DEFAULT_USE_CONTEXT_CACHE
      See Also:
    • DEFAULT_VALIDATION_EVENT_HANDLER

      public static final jakarta.xml.bind.ValidationEventHandler DEFAULT_VALIDATION_EVENT_HANDLER
    • DEFAULT_FORMATTED_OUTPUT

      public static final boolean DEFAULT_FORMATTED_OUTPUT
      See Also:
    • DEFAULT_CHARSET

      public static final Charset DEFAULT_CHARSET
    • DEFAULT_USE_SCHEMA

      public static final boolean DEFAULT_USE_SCHEMA
      See Also:
  • Method Details

    • isDefaultUseContextCache

      public static boolean isDefaultUseContextCache()
      Returns:
      true if the JAXBContext cache should be used. Default is true.
    • setDefaultUseContextCache

      public static void setDefaultUseContextCache(boolean bUseContextCache)
      Enable or disable the usage of the JAXBContext cache. For performance reasons it is recommended to enable it. By default it is enabled.
      Parameters:
      bUseContextCache - true to enable it, false to disable it.
    • getDefaultValidationEventHandler

      @Nullable public static jakarta.xml.bind.ValidationEventHandler getDefaultValidationEventHandler()
      Returns:
      The current default validation event handler. May be null to indicate that no global validation event handler is defined, and the default validation handler is used.
    • setDefaultValidationEventHandler

      public static void setDefaultValidationEventHandler(@Nullable jakarta.xml.bind.ValidationEventHandler aEventHandler)
      Set a global event handler that should be passed to all read/write actions. If no global validation handler is defined, a default logging event handler is used.
      Parameters:
      aEventHandler - The new default event handler. May be null to indicate, that the default handler should be used.
    • getDefaultNamespaceContext

      @Nullable public static NamespaceContext getDefaultNamespaceContext()
      Returns:
      The special JAXB namespace context to be used. null by default.
    • setDefaultNamespaceContext

      public static void setDefaultNamespaceContext(@Nullable NamespaceContext aNamespaceContext)
      Set the default namespace context (prefix to namespace URL mapping) to be used.
      Parameters:
      aNamespaceContext - The namespace context to be used by default. May be null.
    • isDefaultFormattedOutput

      public static boolean isDefaultFormattedOutput()
      Returns:
      true if the JAXB output should be formatted. Only for writers. Default is false. The JDK implementation does not format by default.
    • setDefaultFormattedOutput

      public static void setDefaultFormattedOutput(boolean bFormattedOutput)
      Enable or disable the formatting of the output.
      Parameters:
      bFormattedOutput - true to enable it, false to disable it.
    • getDefaultCharset

      @Nullable public static Charset getDefaultCharset()
      Returns:
      The special JAXB Charset to be used for writing. null by default. The JDK implementation uses UTF-8 by default.
    • setDefaultCharset

      public static void setDefaultCharset(@Nullable Charset aCharset)
      Set the default charset to be used for writing JAXB objects.
      Parameters:
      aCharset - The charset to be used by default. May be null.
    • getDefaultIndentString

      @Nullable public static String getDefaultIndentString()
      Returns:
      The JAXB indentation string to be used for writing. null by default. Only used when formatted output is used. The JDK implementation uses 4 spaces by default.
    • setDefaultIndentString

      public static void setDefaultIndentString(@Nullable String sIndentString)
      Set the default indent string to be used for writing JAXB objects.
      Parameters:
      sIndentString - The indent string to be used by default. May be null.
    • isDefaultUseSchema

      public static boolean isDefaultUseSchema()
      Returns:
      true if an eventually configured XML Schema should be used, false to explicitly disable the usage of XML Schema.
      Since:
      11.0.3
    • setDefaultUseSchema

      public static void setDefaultUseSchema(boolean bUseSchema)
      Enable or disable the usage of an eventually configured XML Schema.
      Parameters:
      bUseSchema - true to use an XML Schema, false to not use it.
      Since:
      11.0.3
    • getDefaultSchemaLocation

      @Nullable public static String getDefaultSchemaLocation()
      Returns:
      The JAXB schema location to be used for writing. null by default.
      Since:
      8.6.0
    • setDefaultSchemaLocation

      public static void setDefaultSchemaLocation(@Nullable String sSchemaLocation)
      Set the schema location to be used for writing JAXB objects.
      Parameters:
      sSchemaLocation - The schema location to be used by default. May be null.
      Since:
      8.6.0
    • getDefaultNoNamespaceSchemaLocation

      @Nullable public static String getDefaultNoNamespaceSchemaLocation()
      Returns:
      The JAXB no namespace schema location to be used for writing. null by default.
      Since:
      9.0.0
    • setDefaultNoNamespaceSchemaLocation

      public static void setDefaultNoNamespaceSchemaLocation(@Nullable String sNoNamespaceSchemaLocation)
      Set the no namespace schema location to be used for writing JAXB objects.
      Parameters:
      sNoNamespaceSchemaLocation - The no namespace schema location to be used by default. May be null.
      Since:
      9.0.0