Package org.jibx.schema.codegen.custom
Class SchemaCustom
java.lang.Object
org.jibx.schema.codegen.custom.CustomBase
org.jibx.schema.codegen.custom.NestingCustomBase
org.jibx.schema.codegen.custom.SchemaRootBase
org.jibx.schema.codegen.custom.SchemaCustom
- All Implemented Interfaces:
TypeReplacer
Individual schema customization information.
- Author:
- Dennis M. Sosnoski
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classVisitor to delete annotations from schema components.private static classVisitor to build basic extensions for schema components.private static classVisitor to flag extensions to remove unused facets.Nested classes/interfaces inherited from class org.jibx.schema.codegen.custom.SchemaRootBase
SchemaRootBase.ClassDecoratorUnmarshaller, SchemaRootBase.ExtensionUnmarshaller, SchemaRootBase.NameConverterUnmarshaller, SchemaRootBase.SchemaTypeUnmarshaller -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String[]Global names excluded from code generation.private SchemaExtensionExtension attached to actual schema element (only used for children).private booleanAlways specify property types flag.private String[]Global names included in code generation.private StringSchema name.private StringSchema namespace.private SchemaElementSchema definition.static final StringArrayEnumeration of allowed attribute namesprivate static final LoggerLogger for class.Fields inherited from class org.jibx.schema.codegen.custom.SchemaRootBase
ENUM_JAVA5, ENUM_SIMPLE, REPEAT_ARRAY, REPEAT_LIST, REPEAT_TYPED, s_enumValues, s_repeatValuesFields 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
ConstructorsConstructorDescriptionSchemaCustom(SchemasetCustom parent) Constructor.SchemaCustom(SchemasetCustom parent, String name, String namespace, String[] includes, String[] excludes) Constructor for constructing instance directly. -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidapplyRemainingCustomizationPath(SchemaPath path, OpenAttrBase match, ComponentCustom custom, ValidationContext vctx) Evaluate the remaining path for a customization after the first step, and apply it to the extension for each matching schema component.booleancheckMatch(String name, SchemaElement schema) Check if this customization matches a particular schema.voidextend(PackageHolder pack, ValidationContext vctx) Build the schema extension structure.private voidextendGlobal(SchemaCustom.ExtensionBuilderVisitor visitor, TreeWalker wlkr, GlobalExtension anno) Build the extensions tree for a global definition.private static SchemaCustomfactory(IUnmarshallingContext ictx) Factory used during unmarshalling.String[]Get the names of definitions to be excluded from generation.String[]Get the names of definitions to be included in generation.getName()Get schema name.Get schema namespace.Get schema definition.booleanCheck if type specifications forced for schema.private voidpreSet(IUnmarshallingContext uctx) Make sure all attributes are defined.voidsetExcludes(String[] excludes) Set the names of definitions to be excluded from generation.voidsetForceTypes(Boolean force) Set type specifications forced for schema.voidsetIncludes(String[] includes) Set the names of definitions to be included in generation.voidSet schema name.voidsetNamespace(String namespace) Set schema namespace.voidsetSchema(String name, SchemaElement schema) Set schema definition.voidStrip the annotation components (at any level) from a schema definitions.Methods inherited from class org.jibx.schema.codegen.custom.SchemaRootBase
getBindingFileName, getClassDecorators, getEnumerationTypeText, getEnumType, getLineWidth, getNameConverter, getPackage, getPrefix, getRepeatedTypeText, getRepeatType, getRootParent, getSchemaTypes, isBindingPerSchema, isDeleteAnnotations, isGenerateAll, isInlineGroups, isJavaDocDocumentation, isNullCollectionAllowed, isPreferInline, isSchemaFragmentDocumentation, isStructureOptional, isUseInner, setEnumType, setPackage, setRepeatTypeMethods 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
-
s_logger
private static final Logger s_loggerLogger for class. -
s_allowedAttributes
Enumeration of allowed attribute names -
m_name
Schema name. -
m_namespace
Schema namespace. -
m_forceTypes
private boolean m_forceTypesAlways specify property types flag. -
m_includes
Global names included in code generation. -
m_excludes
Global names excluded from code generation. -
m_schema
Schema definition. -
m_extension
Extension attached to actual schema element (only used for children).
-
-
Constructor Details
-
SchemaCustom
Constructor.- Parameters:
parent-
-
SchemaCustom
public SchemaCustom(SchemasetCustom parent, String name, String namespace, String[] includes, String[] excludes) Constructor for constructing instance directly.- Parameters:
parent-name- schema namenamespace- target namespace URIincludes- definition names to be included in generationexcludes- definition names to be excluded from generation
-
-
Method Details
-
preSet
Make sure all attributes are defined.- Parameters:
uctx- unmarshalling context
-
getIncludes
Get the names of definitions to be included in generation.- Returns:
- names
-
setIncludes
Set the names of definitions to be included in generation. This only has any effect on the code generation if called beforeextend(PackageHolder, ValidationContext)is called.- Parameters:
includes-
-
getExcludes
Get the names of definitions to be excluded from generation.- Returns:
- names
-
setExcludes
Set the names of definitions to be excluded from generation. This only has any effect on the code generation if called beforeextend(PackageHolder, ValidationContext)is called.- Parameters:
excludes-
-
getName
Get schema name.- Returns:
- name
-
setName
Set schema name.- Parameters:
name-
-
getNamespace
Get schema namespace.- Returns:
- namespace
-
setNamespace
Set schema namespace.- Parameters:
namespace-
-
isForceTypes
public boolean isForceTypes()Check if type specifications forced for schema.- Returns:
trueif types forced,falseif not
-
setForceTypes
Set type specifications forced for schema.- Parameters:
force-trueif types forced,falseif not
-
getSchema
Get schema definition.- Returns:
- schema
-
setSchema
Set schema definition.- Parameters:
name-schema-
-
checkMatch
Check if this customization matches a particular schema.- Parameters:
name-schema-- Returns:
trueif a match,falseif not
-
extendGlobal
private void extendGlobal(SchemaCustom.ExtensionBuilderVisitor visitor, TreeWalker wlkr, GlobalExtension anno) Build the extensions tree for a global definition.- Parameters:
visitor-wlkr-anno-
-
stripAnnotations
public void stripAnnotations()Strip the annotation components (at any level) from a schema definitions. -
applyRemainingCustomizationPath
private static void applyRemainingCustomizationPath(SchemaPath path, OpenAttrBase match, ComponentCustom custom, ValidationContext vctx) Evaluate the remaining path for a customization after the first step, and apply it to the extension for each matching schema component. If no matches are found or multiple matches are found this generates a warning.- Parameters:
path- customization pathmatch- starting point for pathcustom- customization informationvctx- validation context
-
extend
Build the schema extension structure. This first builds extensions for all the global definitions in the schema, marking the ones specified to be included or excluded from the schema, and for all the child components of the non-excluded globals. It then applies the customizations to the extensions.- Parameters:
pack- package for generated classes (nullif no code generation)vctx- validation context
-
factory
Factory used during unmarshalling.- Parameters:
ictx-- Returns:
- instance
-