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 classUnmarshaller implementation for class. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final StringElement name in XML customization file.static final intprivate booleanprivate final IClassLocatorprivate Listprivate booleanprivate booleanprivate booleanprivate booleanprivate Mapprivate booleanprivate ArrayListstatic final intstatic final StringArrayEnumeration of allowed attribute names(package private) static final EnumSetFields inherited from class org.jibx.custom.classes.NestingBase
ATTRIBUTE_STYLE_INTEGER, ATTRIBUTE_VALUE_STYLE, ELEMENT_STYLE_INTEGER, ELEMENT_VALUE_STYLE, s_valueStyleEnumFields 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.voidaddExtensionChild(Object child) Add a child extension element.private ClassCustomBuild new class customization information.voidFills in class information based on inspection of the actual class data.private ClassCustomGet 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 IClassLocatorGet class locator.private StringDirection 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.voidInitialize the global default namespace, along with special classes with built-in defaults.protected voidinternalAddExtensionChild(Object child) Internal method used during unmarshalling to add a child extension element.booleanGet 'add-constructors' setting.booleanisClassUsed(String type) Check if a class is included in the customization information.booleanGet 'force-classes' setting.booleanisInput()Check for an input binding.booleanisKnownMapping(String type) Check if type represents a known mapping.booleanisOutput()Check for an output binding.booleanGet 'track-source' attribute value.private voidpreSet(IUnmarshallingContext uctx) Make sure all attributes are defined.voidsetAddConstructors(boolean add) Set 'add-constructors' value.private voidsetDirectionText(String text, IUnmarshallingContext ictx) Direction set text method.voidsetForceClasses(boolean force) Set 'force-classes' value.voidsetInput(boolean input) Set input binding flag.voidsetOutput(boolean output) Set output binding falg.voidsetTrackSource(boolean track) Set 'track-source' value.Methods inherited from class org.jibx.custom.classes.NestingBase
getStripPrefixes, getStripSuffixes, getValueStyle, isForceMapping, isForceStructureNames, isMapAbstract, isPropertyAccess, isWrapCollections, setMapAbstract, setValueStyleMethods inherited from class org.jibx.custom.classes.SharedNestingBase
convertName, getFormatterClass, getNamespace, getNamespaceStyle, getNameStyle, getSpecifiedNamespace, isObjectRequired, isPrimitiveRequired, isUseJavaDocs, setNamespace, setNamespaceStyle, setNameStyleMethods 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:
getGlobalin 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
nullif 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:
trueif class includes,falseif not
-
getClassCustomization
Get class customization information.- Parameters:
type- fully qualified class name- Returns:
- class information (
nullif 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 anullresult.- 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
-