Package org.jibx.schema.codegen
Class DefinitionItem
- java.lang.Object
-
- org.jibx.schema.codegen.Item
-
- org.jibx.schema.codegen.GroupItem
-
- org.jibx.schema.codegen.DefinitionItem
-
public class DefinitionItem extends GroupItem
Information for a global definition.
-
-
Field Summary
Fields Modifier and Type Field Description private booleanm_checkedChecked flag used by the code generation handling to track which definitions have already been processed.private booleanm_classifiedFlag for definition structure classified.private booleanm_inlineBlockedInlining not allowed flag.private QNamem_qnameQualified name for definition in binding (lazy create,nullif not yet set).private intm_referenceCountNumber of references to this definition.private booleanm_referencedTracking flag for reference seen, used during checking for inline to detect circular definitions.private booleanm_typeIsomorphicType-isomorphic element flag.private static Loggers_loggerLogger for class.
-
Constructor Summary
Constructors Constructor Description DefinitionItem(GroupItem group)Constructor from group.DefinitionItem(AnnotatedBase comp)Constructor for new top-level structure.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclassifyContent()Classify the content of this item as attribute, element, and/or character data content.voidcountReference()Count a reference to this definition.protected java.lang.Stringdescribe()Build a description of the definition, including all nested items.protected java.lang.Stringdescribe(int depth, boolean classified)Build a description of the item, including all nested items.TypeDatagetGenerateClass()Get information for class to be generated.QNamegetQName()Get qualified name for definition in binding.intgetReferenceCount()Get the number of references to this definition.booleanhasDirectGenerateClass()Check if this definition has a class directly assigned for code generation.booleanisChecked()Check if definition has been processed.booleanisInlineBlocked()Check if inlining is blocked (due to non-singleton references).booleanisPregenerated()Check if definition has been pregenerated.booleanisReferenced()Check if definition has been referenced during inline checking.booleanisTypeIsomorphic()Check if this is a type-isomorphic element definition.voidsetChecked(boolean checked)Set definition has been processed flag.voidsetInlineBlocked(boolean blocked)Set inlining blocked flag.voidsetReferenced(boolean refed)Set definition has been referenced during inline checking flag.voidsetTypeIsomorphic(boolean iso)Set the type-isomorphic element definition flag.-
Methods inherited from class org.jibx.schema.codegen.GroupItem
addAny, addGroup, addReference, addValue, adoptChildren, convertToDefinition, convertTypeReference, copy, forceAttributePresent, forceContentPresent, forceElementPresent, forceRequiredPresent, getChildCount, getClassName, getEffectiveClassName, getFirstChild, isAllOptional, isAttributePresent, isContentPresent, isElementPresent, isEnumeration, isExtensionReference, isFixedClassName, isInline, nestedString, replaceChild, setClassName, setEnumeration, setGenerateClass, setInline
-
Methods inherited from class org.jibx.schema.codegen.Item
findDisjointParent, getComponentExtension, getEffectiveName, getName, getNext, getParent, getSchemaComponent, getTopmost, isCollection, isFixedName, isIgnored, isImplicit, isOptional, isTopmost, leadString, reparent, setImplicit, setName
-
-
-
-
Field Detail
-
s_logger
private static final Logger s_logger
Logger for class.
-
m_referenceCount
private int m_referenceCount
Number of references to this definition.
-
m_inlineBlocked
private boolean m_inlineBlocked
Inlining not allowed flag.
-
m_checked
private boolean m_checked
Checked flag used by the code generation handling to track which definitions have already been processed.
-
m_referenced
private boolean m_referenced
Tracking flag for reference seen, used during checking for inline to detect circular definitions.
-
m_classified
private boolean m_classified
Flag for definition structure classified.
-
m_typeIsomorphic
private boolean m_typeIsomorphic
Type-isomorphic element flag.
-
m_qname
private QName m_qname
Qualified name for definition in binding (lazy create,nullif not yet set).
-
-
Constructor Detail
-
DefinitionItem
public DefinitionItem(AnnotatedBase comp)
Constructor for new top-level structure. Child structures should always be created using the containing structure'sGroupItem.addGroup(AnnotatedBase)method.- Parameters:
comp- schema component
-
DefinitionItem
DefinitionItem(GroupItem group)
Constructor from group. This supports replacing an embedded group with a definition, as needed when an embedded group is used in multiple locations and cannot be inlined.- Parameters:
group-
-
-
Method Detail
-
getReferenceCount
public int getReferenceCount()
Get the number of references to this definition.- Returns:
- count
-
countReference
public void countReference()
Count a reference to this definition.
-
isInlineBlocked
public boolean isInlineBlocked()
Check if inlining is blocked (due to non-singleton references).- Returns:
- blocked
-
setInlineBlocked
public void setInlineBlocked(boolean blocked)
Set inlining blocked flag.- Parameters:
blocked-
-
isChecked
public boolean isChecked()
Check if definition has been processed.- Returns:
- checked
-
setChecked
public void setChecked(boolean checked)
Set definition has been processed flag.- Parameters:
checked-
-
isReferenced
public boolean isReferenced()
Check if definition has been referenced during inline checking.- Returns:
- referenced
-
setReferenced
public void setReferenced(boolean refed)
Set definition has been referenced during inline checking flag.- Parameters:
refed-
-
isTypeIsomorphic
public boolean isTypeIsomorphic()
Check if this is a type-isomorphic element definition. Type-isomorphic elements use the same generation class as the referenced type, but with a separate mapping definition.- Returns:
- type-isomorphic
-
setTypeIsomorphic
public void setTypeIsomorphic(boolean iso)
Set the type-isomorphic element definition flag.- Parameters:
iso- type-isomorphic flag
-
isPregenerated
public boolean isPregenerated()
Check if definition has been pregenerated.- Returns:
- pregenerated
-
hasDirectGenerateClass
public boolean hasDirectGenerateClass()
Check if this definition has a class directly assigned for code generation.- Returns:
trueif class directly assigned,falseif not
-
getGenerateClass
public TypeData getGenerateClass()
Get information for class to be generated. This override of the base class implementation checks for the case of a definition which has been inlined, as occurs when a global element definition is the only use of a global type definition. If no generate class is available, this throws an exception.- Overrides:
getGenerateClassin classGroupItem- Returns:
- class
-
getQName
public QName getQName()
Get qualified name for definition in binding.- Returns:
- qname
-
classifyContent
public void classifyContent()
Classify the content of this item as attribute, element, and/or character data content. For a definition item, this checks if the classification has already been done, and if not flags it done and invokes the superclass handling.- Overrides:
classifyContentin classGroupItem
-
describe
protected java.lang.String describe(int depth, boolean classified)Build a description of the item, including all nested items.
-
describe
protected java.lang.String describe()
Build a description of the definition, including all nested items.- Returns:
- description
-
-