Package org.jibx.schema.codegen.custom
Class SchemaRootBase
- java.lang.Object
-
- org.jibx.schema.codegen.custom.CustomBase
-
- org.jibx.schema.codegen.custom.NestingCustomBase
-
- org.jibx.schema.codegen.custom.SchemaRootBase
-
- All Implemented Interfaces:
TypeReplacer
- Direct Known Subclasses:
SchemaCustom
,SchemasetCustom
public abstract class SchemaRootBase extends NestingCustomBase
Base class for possible root customizations.- Author:
- Dennis M. Sosnoski
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SchemaRootBase.ClassDecoratorUnmarshaller
Unmarshaller for class decorator extension elements.static class
SchemaRootBase.ExtensionUnmarshaller
Unmarshaller for extension elements.static class
SchemaRootBase.NameConverterUnmarshaller
Unmarshaller for name converter extension elements.static class
SchemaRootBase.SchemaTypeUnmarshaller
Unmarshaller for schema-type elements.
-
Field Summary
Fields Modifier and Type Field Description private static ClassDecorator[]
EMPTY_DECORATORS_ARRAY
static int
ENUM_JAVA5
static int
ENUM_SIMPLE
private java.lang.String
m_bindingFileName
Binding file name (only allowed if single namespace,null
if derived from schema name).private java.lang.Boolean
m_bindingPerSchema
Generate one binding for each schema flag (binding per namespace iffalse
).private java.util.List
m_classDecorators
Decorators to be used in code generation (null
if none set at level).private java.lang.Boolean
m_deleteAnnotations
Delete annotations flag.private int
m_enumCode
Code for enumeration representation (-1
if not set at level).private java.lang.Boolean
m_generateAll
Generate even unused global definitions.private java.lang.Boolean
m_importDocs
Convert schema documentation to JavaDocs in generated code flag.private java.lang.Boolean
m_inheritDecorators
Inherit code generation class decorators from parent flag.private java.lang.Boolean
m_inlineGroups
Inline xs:group and xs:attributeGroup definitions by default.private java.lang.Integer
m_lineWidth
Preferred maximum line width for generated code.private NameConverter
m_nameConverter
Name converter instance (null
if none set at level).private java.lang.Boolean
m_nullCollection
Force separate class for collection flag.private java.lang.String
m_package
Fully-qualified package name.private java.lang.Boolean
m_preferInline
Prefer inline definitions (separate classes for all iffalse
).private java.lang.String
m_prefix
Prefix used for namespace (only allowed if single namespace,null
if from schema).private int
m_repeatCode
Code for repeated value representation (-1
if not set at level).private java.util.Map
m_schemaTypes
Map from schema type name to Java type information (lazy create,null
if not used at level).private java.lang.Boolean
m_showSchema
Include schema fragments in generated class JavaDocs flag.private java.lang.Boolean
m_structureOptional
Set references as optional structure where possible flag.private java.lang.Boolean
m_useInner
Use inner classes for substructures (top-level classes for all iffalse
).static int
REPEAT_ARRAY
static int
REPEAT_LIST
static int
REPEAT_TYPED
static StringArray
s_allowedAttributes
Enumeration of allowed attribute namesprivate static NameConverter
s_defaultNameConverter
Default converter used if none set.static EnumSet
s_enumValues
private static java.util.Map
s_nameToFormat
Default format name to definition map.static EnumSet
s_repeatValues
-
Fields inherited from class org.jibx.schema.codegen.custom.NestingCustomBase
ANY_DISCARD, ANY_DOM, ANY_MAPPED, s_anyValues, s_selectionValues, SELECTION_CHECKEDBOTH, SELECTION_CHECKEDSET, SELECTION_OVERRIDEBOTH, SELECTION_OVERRIDESET, SELECTION_UNCHECKED
-
-
Constructor Summary
Constructors Constructor Description SchemaRootBase(SchemaRootBase parent)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addClassDecorator(ClassDecorator decor)
Add a class decorator to the current list.private void
addSchemaType(JavaType type)
Add schema type handling override.private static ClassDecorator
classDecoratorFactory(IUnmarshallingContext ictx)
Create an instance of the appropriate class decorator class, to be used for unmarshalling.java.lang.String
getBindingFileName()
Get binding definition file name.(package private) ClassDecorator[]
getClassDecorators()
Get class decorators.java.lang.String
getEnumerationTypeText()
Get the enumeration representation text value set specifically for this element.int
getEnumType()
Get the enumeration representation type code to be applied for this schema or set of schemas.int
getLineWidth()
Get the preferred maximum line width used for generated classes.(package private) NameConverter
getNameConverter()
Get name converter.java.lang.String
getPackage()
Get fully-qualified package name.java.lang.String
getPrefix()
Get prefix used for namespace.java.lang.String
getRepeatedTypeText()
Get the repeated value representation text value set specifically for this element.int
getRepeatType()
Get the repeated value representation type code to be applied for this schema or set of schemas.SchemaRootBase
getRootParent()
Get parent customization (which will either benull
, or another instance of this class).(package private) java.util.Map
getSchemaTypes()
Get map from schema type local name to type information.boolean
isBindingPerSchema()
Check if a separate binding should be generated for each schema.boolean
isDeleteAnnotations()
Check whether annotations are to be deleted.boolean
isGenerateAll()
Check whether unused definitions should be included in code generation.boolean
isInlineGroups()
Check whether xs:group and xs:attributeGroup definitions should be inlined by default.boolean
isJavaDocDocumentation()
Check whether schema documentation is to be used for JavaDocs in the generated code.boolean
isNullCollectionAllowed()
Check whether collection holder (array, list, etc.) can benull
.boolean
isPreferInline()
Check whether inlining of components is preferred.boolean
isSchemaFragmentDocumentation()
Check whether schema fragments matching a generated class are to be included in the class JavaDocs.boolean
isStructureOptional()
Check whether references to classes with no associated element and all components optional should be made optional in the generated binding.boolean
isUseInner()
Check whether inner classes are preferred for components used only by one definition.private void
setEnumerationTypeText(java.lang.String text, IUnmarshallingContext ictx)
Set the enumeration representation text value.void
setEnumType(int code)
Set the enumeration representation type code.private void
setNameConverter(NameConverter nconv, IUnmarshallingContext ictx)
Set name converter to be used.void
setPackage(java.lang.String pack)
Set fully-qualified package name.private void
setRepeatedTypeText(java.lang.String text, IUnmarshallingContext ictx)
Set the repeated value representation text value.void
setRepeatType(int code)
Set the repeated value representation type code.-
Methods inherited from class org.jibx.schema.codegen.custom.NestingCustomBase
getActiveFacetsMask, getAnyHandling, getAnyType, getChildren, getChoiceHandling, getChoiceType, getReplacement, getSubstitutions, getUnionHandling, getUnionType, isAttributeInlined, isChoiceExposed, isUnionExposed, setAnyType, setChoiceType, setEnforcedFacets, setIgnoredFacets, setReplacement, setSubstitutions, setUnionType, validate
-
Methods inherited from class org.jibx.schema.codegen.custom.CustomBase
getContainingObject, getParent, getSchemaRoot, setParent, validateAttributes
-
-
-
-
Field Detail
-
EMPTY_DECORATORS_ARRAY
private static final ClassDecorator[] EMPTY_DECORATORS_ARRAY
-
s_allowedAttributes
public static final StringArray s_allowedAttributes
Enumeration of allowed attribute names
-
s_defaultNameConverter
private static final NameConverter s_defaultNameConverter
Default converter used if none set.
-
s_nameToFormat
private static final java.util.Map s_nameToFormat
Default format name to definition map.
-
REPEAT_ARRAY
public static final int REPEAT_ARRAY
- See Also:
- Constant Field Values
-
REPEAT_LIST
public static final int REPEAT_LIST
- See Also:
- Constant Field Values
-
REPEAT_TYPED
public static final int REPEAT_TYPED
- See Also:
- Constant Field Values
-
s_repeatValues
public static final EnumSet s_repeatValues
-
ENUM_JAVA5
public static final int ENUM_JAVA5
- See Also:
- Constant Field Values
-
ENUM_SIMPLE
public static final int ENUM_SIMPLE
- See Also:
- Constant Field Values
-
s_enumValues
public static final EnumSet s_enumValues
-
m_package
private java.lang.String m_package
Fully-qualified package name.
-
m_bindingPerSchema
private java.lang.Boolean m_bindingPerSchema
Generate one binding for each schema flag (binding per namespace iffalse
).
-
m_bindingFileName
private java.lang.String m_bindingFileName
Binding file name (only allowed if single namespace,null
if derived from schema name).
-
m_prefix
private java.lang.String m_prefix
Prefix used for namespace (only allowed if single namespace,null
if from schema).
-
m_generateAll
private java.lang.Boolean m_generateAll
Generate even unused global definitions.
-
m_inlineGroups
private java.lang.Boolean m_inlineGroups
Inline xs:group and xs:attributeGroup definitions by default.
-
m_preferInline
private java.lang.Boolean m_preferInline
Prefer inline definitions (separate classes for all iffalse
).
-
m_useInner
private java.lang.Boolean m_useInner
Use inner classes for substructures (top-level classes for all iffalse
).
-
m_deleteAnnotations
private java.lang.Boolean m_deleteAnnotations
Delete annotations flag.
-
m_importDocs
private java.lang.Boolean m_importDocs
Convert schema documentation to JavaDocs in generated code flag.
-
m_showSchema
private java.lang.Boolean m_showSchema
Include schema fragments in generated class JavaDocs flag.
-
m_nullCollection
private java.lang.Boolean m_nullCollection
Force separate class for collection flag.
-
m_structureOptional
private java.lang.Boolean m_structureOptional
Set references as optional structure where possible flag.
-
m_schemaTypes
private java.util.Map m_schemaTypes
Map from schema type name to Java type information (lazy create,null
if not used at level).
-
m_nameConverter
private NameConverter m_nameConverter
Name converter instance (null
if none set at level).
-
m_inheritDecorators
private java.lang.Boolean m_inheritDecorators
Inherit code generation class decorators from parent flag.
-
m_classDecorators
private java.util.List m_classDecorators
Decorators to be used in code generation (null
if none set at level).
-
m_lineWidth
private java.lang.Integer m_lineWidth
Preferred maximum line width for generated code.
-
m_repeatCode
private int m_repeatCode
Code for repeated value representation (-1
if not set at level).
-
m_enumCode
private int m_enumCode
Code for enumeration representation (-1
if not set at level).
-
-
Constructor Detail
-
SchemaRootBase
public SchemaRootBase(SchemaRootBase parent)
Constructor.- Parameters:
parent
-
-
-
Method Detail
-
getRootParent
public SchemaRootBase getRootParent()
Get parent customization (which will either benull
, or another instance of this class).- Returns:
- parent, or
null
if none
-
isBindingPerSchema
public boolean isBindingPerSchema()
Check if a separate binding should be generated for each schema. The default isfalse
if not overridden at any level.- Returns:
- generate unused flag
-
isGenerateAll
public boolean isGenerateAll()
Check whether unused definitions should be included in code generation. The default istrue
if not overridden at any level.- Returns:
- generate unused flag
-
isInlineGroups
public boolean isInlineGroups()
Check whether xs:group and xs:attributeGroup definitions should be inlined by default. The default isfalse
if not overridden at any level.- Returns:
- generate unused flag
-
isPreferInline
public boolean isPreferInline()
Check whether inlining of components is preferred. The default isfalse
if not overridden at any level.- Returns:
- inline components flag
-
isUseInner
public boolean isUseInner()
Check whether inner classes are preferred for components used only by one definition. The default istrue
if not overridden at any level.- Returns:
- inline components flag
-
isDeleteAnnotations
public boolean isDeleteAnnotations()
Check whether annotations are to be deleted. The default istrue
if not overridden at any level.- Returns:
- delete annotations flag
-
isJavaDocDocumentation
public boolean isJavaDocDocumentation()
Check whether schema documentation is to be used for JavaDocs in the generated code. The default istrue
if not overridden at any level.- Returns:
- use schema documentation in JavaDocs flag
-
isSchemaFragmentDocumentation
public boolean isSchemaFragmentDocumentation()
Check whether schema fragments matching a generated class are to be included in the class JavaDocs. The default istrue
if not overridden at any level.- Returns:
- schema fragments in class JavaDocs flag
-
isNullCollectionAllowed
public boolean isNullCollectionAllowed()
Check whether collection holder (array, list, etc.) can benull
. This is only relevant to collections using an optional wrapper element: If this flag istrue
anull
collection holder indicates the element is missing; otherwise a class is created to wrap the collection holder, and anull
for that class indicates the element is missing. The default istrue
if not overridden at any level. TODO: currently unsupported- Returns:
- force collection wrapper flag
-
isStructureOptional
public boolean isStructureOptional()
Check whether references to classes with no associated element and all components optional should be made optional in the generated binding. The effect of making such class references optional is that the reference will be setnull
when unmarshalling if none of the components are present, and will be checked fornull
when marshalling. The default istrue
if not overridden at any level.- Returns:
- prefer structure optional flag
-
getLineWidth
public int getLineWidth()
Get the preferred maximum line width used for generated classes. The default is 80.- Returns:
- line width
-
getRepeatType
public int getRepeatType()
Get the repeated value representation type code to be applied for this schema or set of schemas. The default value isREPEAT_TYPED
if not overridden at any level.- Returns:
- code
-
setRepeatType
public void setRepeatType(int code)
Set the repeated value representation type code.- Parameters:
code
- type code,-1
if to be unset
-
getRepeatedTypeText
public java.lang.String getRepeatedTypeText()
Get the repeated value representation text value set specifically for this element.- Returns:
- text (
null
if not set)
-
setRepeatedTypeText
private void setRepeatedTypeText(java.lang.String text, IUnmarshallingContext ictx)
Set the repeated value representation text value. This method is provided only for use when unmarshalling.- Parameters:
text
- (null
if not set)ictx
-
-
getEnumType
public int getEnumType()
Get the enumeration representation type code to be applied for this schema or set of schemas. The default value isENUM_JAVA5
if not overridden at any level.- Returns:
- code
-
setEnumType
public void setEnumType(int code)
Set the enumeration representation type code.- Parameters:
code
- type code,-1
if to be unset
-
getEnumerationTypeText
public java.lang.String getEnumerationTypeText()
Get the enumeration representation text value set specifically for this element.- Returns:
- text (
null
if not set)
-
setEnumerationTypeText
private void setEnumerationTypeText(java.lang.String text, IUnmarshallingContext ictx)
Set the enumeration representation text value. This method is provided only for use when unmarshalling.- Parameters:
text
- (null
if not set)ictx
-
-
getPackage
public java.lang.String getPackage()
Get fully-qualified package name. This is inherited by nested schemas if set at any level.- Returns:
- package (
null
if none set)
-
setPackage
public void setPackage(java.lang.String pack)
Set fully-qualified package name. This is inherited by nested schemas if set at any level.- Parameters:
pack
- (null
if none)
-
getBindingFileName
public java.lang.String getBindingFileName()
Get binding definition file name. The binding name may not be set if more than one namespace is used in the schemas represented by this customization.- Returns:
- name,
null
if to be derived from schema name
-
getPrefix
public java.lang.String getPrefix()
Get prefix used for namespace. The prefix may not be set if more than one namespace is used in the schemas represented by this customization.- Returns:
- prefix,
null
if to be found from schema
-
addSchemaType
private void addSchemaType(JavaType type)
Add schema type handling override.- Parameters:
type
-
-
getSchemaTypes
java.util.Map getSchemaTypes()
Get map from schema type local name to type information.- Returns:
- map
-
setNameConverter
private void setNameConverter(NameConverter nconv, IUnmarshallingContext ictx)
Set name converter to be used.- Parameters:
nconv
-ictx
-
-
getNameConverter
NameConverter getNameConverter()
Get name converter.- Returns:
- converter (
null
if none defined)
-
addClassDecorator
private void addClassDecorator(ClassDecorator decor)
Add a class decorator to the current list.- Parameters:
decor
-
-
getClassDecorators
ClassDecorator[] getClassDecorators()
Get class decorators.- Returns:
- decorators
-
classDecoratorFactory
private static ClassDecorator classDecoratorFactory(IUnmarshallingContext ictx)
Create an instance of the appropriate class decorator class, to be used for unmarshalling. This always uses the default constructor for the target class.- Parameters:
ictx
-- Returns:
- class decorator instance, or
null
if error
-
-