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
Base class for possible root customizations.
- Author:
- Dennis M. Sosnoski
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classUnmarshaller for class decorator extension elements.static classUnmarshaller for extension elements.static classUnmarshaller for name converter extension elements.static classUnmarshaller for schema-type elements. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final ClassDecorator[]static final intstatic final intprivate StringBinding file name (only allowed if single namespace,nullif derived from schema name).private BooleanGenerate one binding for each schema flag (binding per namespace iffalse).private ListDecorators to be used in code generation (nullif none set at level).private BooleanDelete annotations flag.private intCode for enumeration representation (-1if not set at level).private BooleanGenerate even unused global definitions.private BooleanConvert schema documentation to JavaDocs in generated code flag.private BooleanInherit code generation class decorators from parent flag.private BooleanInline xs:group and xs:attributeGroup definitions by default.private IntegerPreferred maximum line width for generated code.private NameConverterName converter instance (nullif none set at level).private BooleanForce separate class for collection flag.private StringFully-qualified package name.private BooleanPrefer inline definitions (separate classes for all iffalse).private StringPrefix used for namespace (only allowed if single namespace,nullif from schema).private intCode for repeated value representation (-1if not set at level).private MapMap from schema type name to Java type information (lazy create,nullif not used at level).private BooleanInclude schema fragments in generated class JavaDocs flag.private BooleanSet references as optional structure where possible flag.private BooleanUse inner classes for substructures (top-level classes for all iffalse).static final intstatic final intstatic final intstatic final StringArrayEnumeration of allowed attribute namesprivate static final NameConverterDefault converter used if none set.static final EnumSetprivate static final MapDefault format name to definition map.static final EnumSetFields 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 -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddClassDecorator(ClassDecorator decor) Add a class decorator to the current list.private voidaddSchemaType(JavaType type) Add schema type handling override.private static ClassDecoratorCreate an instance of the appropriate class decorator class, to be used for unmarshalling.Get binding definition file name.(package private) ClassDecorator[]Get class decorators.Get the enumeration representation text value set specifically for this element.intGet the enumeration representation type code to be applied for this schema or set of schemas.intGet the preferred maximum line width used for generated classes.(package private) NameConverterGet name converter.Get fully-qualified package name.Get prefix used for namespace.Get the repeated value representation text value set specifically for this element.intGet the repeated value representation type code to be applied for this schema or set of schemas.Get parent customization (which will either benull, or another instance of this class).(package private) MapGet map from schema type local name to type information.booleanCheck if a separate binding should be generated for each schema.booleanCheck whether annotations are to be deleted.booleanCheck whether unused definitions should be included in code generation.booleanCheck whether xs:group and xs:attributeGroup definitions should be inlined by default.booleanCheck whether schema documentation is to be used for JavaDocs in the generated code.booleanCheck whether collection holder (array, list, etc.) can benull.booleanCheck whether inlining of components is preferred.booleanCheck whether schema fragments matching a generated class are to be included in the class JavaDocs.booleanCheck whether references to classes with no associated element and all components optional should be made optional in the generated binding.booleanCheck whether inner classes are preferred for components used only by one definition.private voidsetEnumerationTypeText(String text, IUnmarshallingContext ictx) Set the enumeration representation text value.voidsetEnumType(int code) Set the enumeration representation type code.private voidsetNameConverter(NameConverter nconv, IUnmarshallingContext ictx) Set name converter to be used.voidsetPackage(String pack) Set fully-qualified package name.private voidsetRepeatedTypeText(String text, IUnmarshallingContext ictx) Set the repeated value representation text value.voidsetRepeatType(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, validateMethods inherited from class org.jibx.schema.codegen.custom.CustomBase
getContainingObject, getParent, getSchemaRoot, setParent, validateAttributes
-
Field Details
-
EMPTY_DECORATORS_ARRAY
-
s_allowedAttributes
Enumeration of allowed attribute names -
s_defaultNameConverter
Default converter used if none set. -
s_nameToFormat
Default format name to definition map. -
REPEAT_ARRAY
public static final int REPEAT_ARRAY- See Also:
-
REPEAT_LIST
public static final int REPEAT_LIST- See Also:
-
REPEAT_TYPED
public static final int REPEAT_TYPED- See Also:
-
s_repeatValues
-
ENUM_JAVA5
public static final int ENUM_JAVA5- See Also:
-
ENUM_SIMPLE
public static final int ENUM_SIMPLE- See Also:
-
s_enumValues
-
m_package
Fully-qualified package name. -
m_bindingPerSchema
Generate one binding for each schema flag (binding per namespace iffalse). -
m_bindingFileName
Binding file name (only allowed if single namespace,nullif derived from schema name). -
m_prefix
Prefix used for namespace (only allowed if single namespace,nullif from schema). -
m_generateAll
Generate even unused global definitions. -
m_inlineGroups
Inline xs:group and xs:attributeGroup definitions by default. -
m_preferInline
Prefer inline definitions (separate classes for all iffalse). -
m_useInner
Use inner classes for substructures (top-level classes for all iffalse). -
m_deleteAnnotations
Delete annotations flag. -
m_importDocs
Convert schema documentation to JavaDocs in generated code flag. -
m_showSchema
Include schema fragments in generated class JavaDocs flag. -
m_nullCollection
Force separate class for collection flag. -
m_structureOptional
Set references as optional structure where possible flag. -
m_schemaTypes
Map from schema type name to Java type information (lazy create,nullif not used at level). -
m_nameConverter
Name converter instance (nullif none set at level). -
m_inheritDecorators
Inherit code generation class decorators from parent flag. -
m_classDecorators
Decorators to be used in code generation (nullif none set at level). -
m_lineWidth
Preferred maximum line width for generated code. -
m_repeatCode
private int m_repeatCodeCode for repeated value representation (-1if not set at level). -
m_enumCode
private int m_enumCodeCode for enumeration representation (-1if not set at level).
-
-
Constructor Details
-
SchemaRootBase
Constructor.- Parameters:
parent-
-
-
Method Details
-
getRootParent
Get parent customization (which will either benull, or another instance of this class).- Returns:
- parent, or
nullif none
-
isBindingPerSchema
public boolean isBindingPerSchema()Check if a separate binding should be generated for each schema. The default isfalseif 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 istrueif 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 isfalseif not overridden at any level.- Returns:
- generate unused flag
-
isPreferInline
public boolean isPreferInline()Check whether inlining of components is preferred. The default isfalseif 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 istrueif not overridden at any level.- Returns:
- inline components flag
-
isDeleteAnnotations
public boolean isDeleteAnnotations()Check whether annotations are to be deleted. The default istrueif 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 istrueif 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 istrueif 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 istrueanullcollection holder indicates the element is missing; otherwise a class is created to wrap the collection holder, and anullfor that class indicates the element is missing. The default istrueif 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 setnullwhen unmarshalling if none of the components are present, and will be checked fornullwhen marshalling. The default istrueif 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_TYPEDif not overridden at any level.- Returns:
- code
-
setRepeatType
public void setRepeatType(int code) Set the repeated value representation type code.- Parameters:
code- type code,-1if to be unset
-
getRepeatedTypeText
Get the repeated value representation text value set specifically for this element.- Returns:
- text (
nullif not set)
-
setRepeatedTypeText
Set the repeated value representation text value. This method is provided only for use when unmarshalling.- Parameters:
text- (nullif 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_JAVA5if not overridden at any level.- Returns:
- code
-
setEnumType
public void setEnumType(int code) Set the enumeration representation type code.- Parameters:
code- type code,-1if to be unset
-
getEnumerationTypeText
Get the enumeration representation text value set specifically for this element.- Returns:
- text (
nullif not set)
-
setEnumerationTypeText
Set the enumeration representation text value. This method is provided only for use when unmarshalling.- Parameters:
text- (nullif not set)ictx-
-
getPackage
Get fully-qualified package name. This is inherited by nested schemas if set at any level.- Returns:
- package (
nullif none set)
-
setPackage
Set fully-qualified package name. This is inherited by nested schemas if set at any level.- Parameters:
pack- (nullif none)
-
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,
nullif to be derived from schema name
-
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,
nullif to be found from schema
-
addSchemaType
Add schema type handling override.- Parameters:
type-
-
getSchemaTypes
Map getSchemaTypes()Get map from schema type local name to type information.- Returns:
- map
-
setNameConverter
Set name converter to be used.- Parameters:
nconv-ictx-
-
getNameConverter
NameConverter getNameConverter()Get name converter.- Returns:
- converter (
nullif none defined)
-
addClassDecorator
Add a class decorator to the current list.- Parameters:
decor-
-
getClassDecorators
ClassDecorator[] getClassDecorators()Get class decorators.- Returns:
- decorators
-
classDecoratorFactory
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
nullif error
-