org.jibx.schema.codegen
Class DefinitionItem

java.lang.Object
  extended by org.jibx.schema.codegen.Item
      extended by org.jibx.schema.codegen.GroupItem
          extended by org.jibx.schema.codegen.DefinitionItem

public class DefinitionItem
extends GroupItem

Information for a global definition.


Field Summary
private  boolean m_checked
          Checked flag used by the code generation handling to track which definitions have already been processed.
private  boolean m_classified
          Flag for definition structure classified.
private  boolean m_inlineBlocked
          Inlining not allowed flag.
private  QName m_qname
          Qualified name for definition in binding (lazy create, null if not yet set).
private  int m_referenceCount
          Number of references to this definition.
private  boolean m_referenced
          Tracking flag for reference seen, used during checking for inline to detect circular definitions.
private  boolean m_typeIsomorphic
          Type-isomorphic element flag.
private static Logger s_logger
          Logger for class.
 
Fields inherited from class org.jibx.schema.codegen.Item
m_last, m_next
 
Constructor Summary
DefinitionItem(AnnotatedBase comp)
          Constructor for new top-level structure.
DefinitionItem(GroupItem group)
          Constructor from group.
 
Method Summary
 void classifyContent()
          Classify the content of this item as attribute, element, and/or character data content.
 void countReference()
          Count a reference to this definition.
protected  java.lang.String describe()
          Build a description of the definition, including all nested items.
protected  java.lang.String describe(int depth, boolean classified)
          Build a description of the item, including all nested items.
 TypeData getGenerateClass()
          Get information for class to be generated.
 QName getQName()
          Get qualified name for definition in binding.
 int getReferenceCount()
          Get the number of references to this definition.
 boolean hasDirectGenerateClass()
          Check if this definition has a class directly assigned for code generation.
 boolean isChecked()
          Check if definition has been processed.
 boolean isInlineBlocked()
          Check if inlining is blocked (due to non-singleton references).
 boolean isPregenerated()
          Check if definition has been pregenerated.
 boolean isReferenced()
          Check if definition has been referenced during inline checking.
 boolean isTypeIsomorphic()
          Check if this is a type-isomorphic element definition.
 void setChecked(boolean checked)
          Set definition has been processed flag.
 void setInlineBlocked(boolean blocked)
          Set inlining blocked flag.
 void setReferenced(boolean refed)
          Set definition has been referenced during inline checking flag.
 void setTypeIsomorphic(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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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, null if 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's GroupItem.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:
true if class directly assigned, false if 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:
getGenerateClass in class GroupItem
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:
classifyContent in class GroupItem

describe

protected java.lang.String describe(int depth,
                                    boolean classified)
Build a description of the item, including all nested items.

Overrides:
describe in class GroupItem
Parameters:
depth - current nesting depth
classified - include classification details flag
Returns:
description

describe

protected java.lang.String describe()
Build a description of the definition, including all nested items.

Returns:
description


Project Web Site