Package org.jibx.custom.classes
Class GlobalCustom
java.lang.Object
org.jibx.custom.classes.CustomBase
org.jibx.custom.classes.SharedNestingBase
org.jibx.custom.classes.NestingBase
org.jibx.custom.classes.GlobalCustom
Global customization information. This includes some options specific to the <binding> element of the definition,
as well as controls for structuring of the generated binding(s). It handles the binding customization child elements
directly, by invoking the abstract unmarshallers for the child elements to process the content. It also allows for
extension elements which are not part of the binding customization structure, as long as the binding in use defines
the unmarshalling for these elements.
- Author:
- Dennis M. Sosnoski
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Unmarshaller implementation for class. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final String
Element name in XML customization file.static final int
private boolean
private final IClassLocator
private List
private boolean
private boolean
private boolean
private boolean
private Map
private boolean
private ArrayList
static final int
static final StringArray
Enumeration of allowed attribute names(package private) static final EnumSet
Fields inherited from class org.jibx.custom.classes.NestingBase
ATTRIBUTE_STYLE_INTEGER, ATTRIBUTE_VALUE_STYLE, ELEMENT_STYLE_INTEGER, ELEMENT_VALUE_STYLE, s_valueStyleEnum
Fields inherited from class org.jibx.custom.classes.CustomBase
CAMEL_CASE_NAMES, DERIVE_BY_PACKAGE, DERIVE_FIXED, DERIVE_NONE, DOTTED_NAMES, HYPHENATED_NAMES, REQUIRE_ALL, REQUIRE_NONE, REQUIRE_OBJECTS, REQUIRE_PRIMITIVES, s_namespaceStyleEnum, s_nameStyleEnum, s_requireEnum, UNDERSCORED_NAMES, UPPER_CAMEL_CASE_NAMES
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor.Constructor with class locator supplied. -
Method Summary
Modifier and TypeMethodDescriptionaddClassCustomization
(String type) Get initialized class customization information, creating it if it doesn't already exist.void
addExtensionChild
(Object child) Add a child extension element.private ClassCustom
Build new class customization information.void
Fills in class information based on inspection of the actual class data.private ClassCustom
Get class customization information, creating it if it doesn't already exist.getClassCustomization
(String type) Get class customization information.getClassInfo
(String type) Get class information.protected IClassLocator
Get class locator.private String
Direction get text method.Get the extension elements used in this customization.Get global customizations root.getPackage
(String name) Get package customizations.Get list of unmarshalled classes.void
Initialize the global default namespace, along with special classes with built-in defaults.protected void
internalAddExtensionChild
(Object child) Internal method used during unmarshalling to add a child extension element.boolean
Get 'add-constructors' setting.boolean
isClassUsed
(String type) Check if a class is included in the customization information.boolean
Get 'force-classes' setting.boolean
isInput()
Check for an input binding.boolean
isKnownMapping
(String type) Check if type represents a known mapping.boolean
isOutput()
Check for an output binding.boolean
Get 'track-source' attribute value.private void
preSet
(IUnmarshallingContext uctx) Make sure all attributes are defined.void
setAddConstructors
(boolean add) Set 'add-constructors' value.private void
setDirectionText
(String text, IUnmarshallingContext ictx) Direction set text method.void
setForceClasses
(boolean force) Set 'force-classes' value.void
setInput
(boolean input) Set input binding flag.void
setOutput
(boolean output) Set output binding falg.void
setTrackSource
(boolean track) Set 'track-source' value.Methods inherited from class org.jibx.custom.classes.NestingBase
getStripPrefixes, getStripSuffixes, getValueStyle, isForceMapping, isForceStructureNames, isMapAbstract, isPropertyAccess, isWrapCollections, setMapAbstract, setValueStyle
Methods inherited from class org.jibx.custom.classes.SharedNestingBase
convertName, getFormatterClass, getNamespace, getNamespaceStyle, getNameStyle, getSpecifiedNamespace, isObjectRequired, isPrimitiveRequired, isUseJavaDocs, setNamespace, setNamespaceStyle, setNameStyle
Methods inherited from class org.jibx.custom.classes.CustomBase
convertName, deriveItemName, deriveNamespace, getContainingObject, getParent, packageOfType, packageToNamespace, validateAttributes
-
Field Details
-
s_allowedAttributes
Enumeration of allowed attribute names -
ELEMENT_NAME
Element name in XML customization file.- See Also:
-
IN_BINDING
public static final int IN_BINDING- See Also:
-
OUT_BINDING
public static final int OUT_BINDING- See Also:
-
BOTH_BINDING
public static final int BOTH_BINDING- See Also:
-
s_directionEnum
-
m_packageMap
-
m_classLocator
-
m_extensionChildren
-
m_addConstructors
private boolean m_addConstructors -
m_forceClasses
private boolean m_forceClasses -
m_trackSource
private boolean m_trackSource -
m_namespaceModular
private boolean m_namespaceModular -
m_isInput
private boolean m_isInput -
m_isOutput
private boolean m_isOutput -
m_unmarshalledClasses
-
-
Constructor Details
-
GlobalCustom
Constructor with class locator supplied.- Parameters:
loc
-
-
GlobalCustom
public GlobalCustom()Constructor. This always creates the default package as the only direct child, since other packages will be treated as children of the default package.
-
-
Method Details
-
preSet
Make sure all attributes are defined.- Parameters:
uctx
- unmarshalling context
-
getGlobal
Get global customizations root.- Overrides:
getGlobal
in classCustomBase
- Returns:
- global customization
-
getUnmarshalledClasses
Get list of unmarshalled classes. This list is populated by the custom unmarshalling code as the customizations document is unmarshalled.- Returns:
- list
-
isAddConstructors
public boolean isAddConstructors()Get 'add-constructors' setting.- Returns:
- 'add-constructors' value
-
setAddConstructors
public void setAddConstructors(boolean add) Set 'add-constructors' value.- Parameters:
add
- 'add-constructors' value
-
isForceClasses
public boolean isForceClasses()Get 'force-classes' setting.- Returns:
- 'force-classes' value
-
setForceClasses
public void setForceClasses(boolean force) Set 'force-classes' value.- Parameters:
force
- 'force-classes' value
-
isTrackSource
public boolean isTrackSource()Get 'track-source' attribute value.- Returns:
- 'track-source' value
-
setTrackSource
public void setTrackSource(boolean track) Set 'track-source' value.- Parameters:
track
- 'track-source' value
-
isInput
public boolean isInput()Check for an input binding.- Returns:
- input flag
-
setInput
public void setInput(boolean input) Set input binding flag.- Parameters:
input
-
-
isOutput
public boolean isOutput()Check for an output binding.- Returns:
- output flag
-
setOutput
public void setOutput(boolean output) Set output binding falg.- Parameters:
output
-
-
getClassLocator
Get class locator.- Returns:
- locator
-
getClassInfo
Get class information.- Parameters:
type
- fully-qualified class name- Returns:
- information, or
null
if unable to load
-
getExtensionChildren
Get the extension elements used in this customization. This does not include the <package> or <class> child elements, which are added directly to the customization structures.- Returns:
- child list
-
internalAddExtensionChild
Internal method used during unmarshalling to add a child extension element.- Parameters:
child
-
-
addExtensionChild
Add a child extension element. This both adds the child to the list and invokes the extension element'sIApply.apply(IClassLocator)
method, if present.- Parameters:
child
-
-
isClassUsed
Check if a class is included in the customization information. This method does not alter the structures in any way, it only checks if the class customization information is part of the existing structure.- Parameters:
type
- fully qualified class name- Returns:
true
if class includes,false
if not
-
getClassCustomization
Get class customization information.- Parameters:
type
- fully qualified class name- Returns:
- class information (
null
if not defined)
-
buildClassCustomization
Build new class customization information. This creates the customization information and adds it to the internal structures, initializing all values based on the settings inherited from <package> and <global> elements of the structure. This method should only be used after first callinggetClassCustomization(String)
and obtaining anull
result.- Parameters:
type
- fully qualified class name- Returns:
- class information
-
forceClassCustomization
Get class customization information, creating it if it doesn't already exist. This internal method supplies the class information in uninitialized form, so that data can be unmarshalled before initialization.- Parameters:
type
- fully qualified class name- Returns:
- class information
-
addClassCustomization
Get initialized class customization information, creating it if it doesn't already exist.- Parameters:
type
- fully qualified class name- Returns:
- class information
-
isKnownMapping
Check if type represents a known mapping.- Parameters:
type
- fully qualified class name- Returns:
- known mapping flag
-
setDirectionText
Direction set text method. This is intended for use during unmarshalling. TODO: add validation- Parameters:
text
-ictx
-
-
getDirectionText
Direction get text method. This is intended for use during marshalling.- Returns:
- text
-
initClasses
public void initClasses()Initialize the global default namespace, along with special classes with built-in defaults. This needs to be done as a separate step before unmarshalling, so that the special classes are available for use. -
fillClasses
public void fillClasses()Fills in class information based on inspection of the actual class data. This needs to be done as a separate step following unmarshalling, so that the full details of the unmarshalled customizations are available. -
getPackage
Get package customizations. If the requested package is already defined the existing instance will be returned, otherwise a new instance will be created (along with any ancestor packages) and added to the structure.- Parameters:
name
-- Returns:
- package
-