Package com.helger.jaxb.builder
Class JAXBBuilderDefaultSettings
java.lang.Object
com.helger.jaxb.builder.JAXBBuilderDefaultSettings
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.
Changes made in this class only effects instances that are created afterwards. Existing instances are never changed.
- Author:
- Philip Helger
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Charsetstatic final booleanstatic final booleanstatic final booleanstatic final jakarta.xml.bind.ValidationEventHandler -
Method Summary
Modifier and TypeMethodDescriptionstatic Charsetstatic Stringstatic NamespaceContextstatic Stringstatic Stringstatic jakarta.xml.bind.ValidationEventHandlerstatic booleanstatic booleanstatic booleanstatic voidsetDefaultCharset(Charset aCharset) Set the default charset to be used for writing JAXB objects.static voidsetDefaultFormattedOutput(boolean bFormattedOutput) Enable or disable the formatting of the output.static voidsetDefaultIndentString(String sIndentString) Set the default indent string to be used for writing JAXB objects.static voidsetDefaultNamespaceContext(NamespaceContext aNamespaceContext) Set the default namespace context (prefix to namespace URL mapping) to be used.static voidsetDefaultNoNamespaceSchemaLocation(String sNoNamespaceSchemaLocation) Set the no namespace schema location to be used for writing JAXB objects.static voidsetDefaultSchemaLocation(String sSchemaLocation) Set the schema location to be used for writing JAXB objects.static voidsetDefaultUseContextCache(boolean bUseContextCache) Enable or disable the usage of the JAXBContext cache.static voidsetDefaultUseSchema(boolean bUseSchema) Enable or disable the usage of an eventually configured XML Schema.static voidsetDefaultValidationEventHandler(jakarta.xml.bind.ValidationEventHandler aEventHandler) Set a global event handler that should be passed to all read/write actions.
-
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
-
DEFAULT_USE_SCHEMA
public static final boolean DEFAULT_USE_SCHEMA- See Also:
-
-
Method Details
-
isDefaultUseContextCache
public static boolean isDefaultUseContextCache()- Returns:
trueif the JAXBContext cache should be used. Default istrue.
-
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-trueto enable it,falseto disable it.
-
getDefaultValidationEventHandler
- Returns:
- The current default validation event handler. May be
nullto 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 benullto indicate, that the default handler should be used.
-
getDefaultNamespaceContext
- Returns:
- The special JAXB namespace context to be used.
nullby default.
-
setDefaultNamespaceContext
Set the default namespace context (prefix to namespace URL mapping) to be used.- Parameters:
aNamespaceContext- The namespace context to be used by default. May benull.
-
isDefaultFormattedOutput
public static boolean isDefaultFormattedOutput()- Returns:
trueif the JAXB output should be formatted. Only for writers. Default isfalse. 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-trueto enable it,falseto disable it.
-
getDefaultCharset
- Returns:
- The special JAXB Charset to be used for writing.
nullby default. The JDK implementation uses UTF-8 by default.
-
setDefaultCharset
Set the default charset to be used for writing JAXB objects.- Parameters:
aCharset- The charset to be used by default. May benull.
-
getDefaultIndentString
- Returns:
- The JAXB indentation string to be used for writing.
nullby default. Only used when formatted output is used. The JDK implementation uses 4 spaces by default.
-
setDefaultIndentString
Set the default indent string to be used for writing JAXB objects.- Parameters:
sIndentString- The indent string to be used by default. May benull.
-
isDefaultUseSchema
public static boolean isDefaultUseSchema()- Returns:
trueif an eventually configured XML Schema should be used,falseto 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-trueto use an XML Schema,falseto not use it.- Since:
- 11.0.3
-
getDefaultSchemaLocation
- Returns:
- The JAXB schema location to be used for writing.
nullby default. - Since:
- 8.6.0
-
setDefaultSchemaLocation
Set the schema location to be used for writing JAXB objects.- Parameters:
sSchemaLocation- The schema location to be used by default. May benull.- Since:
- 8.6.0
-
getDefaultNoNamespaceSchemaLocation
- Returns:
- The JAXB no namespace schema location to be used for writing.
nullby default. - Since:
- 9.0.0
-
setDefaultNoNamespaceSchemaLocation
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 benull.- Since:
- 9.0.0
-