org.jibx.binding.model
Class NestingElementBase

java.lang.Object
  extended by org.jibx.binding.model.ElementBase
      extended by org.jibx.binding.model.NestingElementBase
Direct Known Subclasses:
BindingElement, ContainerElementBase, IncludeElement, InputElement, OutputElement, SplitElement

public abstract class NestingElementBase
extends ElementBase

Model component for elements that can contain other component elements. TODO: The list of child elements here conflicts with that in BindingElement; should change the type hierarchy to better reflect usage

Author:
Dennis M. Sosnoski

Field Summary
private  java.util.ArrayList m_children
          List of child elements.
private  DefinitionContext m_defContext
          Definition context for this nesting (created by validation).
private  NestingAttributes m_nestingAttrs
          Value style attribute information.
static StringArray s_allowedAttributes
          Enumeration of allowed attribute names
 
Fields inherited from class org.jibx.binding.model.ElementBase
BINDING_ELEMENT, COLLECTION_ELEMENT, ELEMENT_NAMES, FORMAT_ELEMENT, INCLUDE_ELEMENT, INPUT_ELEMENT, MAPPING_ELEMENT, NAMESPACE_ELEMENT, OUTPUT_ELEMENT, SPLIT_ELEMENT, STRUCTURE_ELEMENT, TEMPLATE_ELEMENT, VALUE_ELEMENT
 
Constructor Summary
protected NestingElementBase(int type)
          Constructor.
 
Method Summary
 void addChild(java.lang.Object child)
          Add child element.
 java.util.Iterator childIterator()
          Get iterator for child elements.
 java.util.ArrayList children()
          Get list of child elements.
 int getDefaultStyle()
          Get default style value for child components.
 DefinitionContext getDefinitions()
          Get definition context.
 int getStyle()
          Get style value set on this nesting element.
 java.lang.String getStyleName()
          Get style name set on this nesting element.
 void prevalidate(ValidationContext vctx)
          Prevalidate element information.
(package private)  void setDefinitions(DefinitionContext ctx)
          Set definition context.
 void setStyleName(java.lang.String name)
          Set style name on this nesting element.
 void validate(ValidationContext vctx)
          Validate element information.
 
Methods inherited from class org.jibx.binding.model.ElementBase
getComment, name, setComment, toString, type, validateAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

s_allowedAttributes

public static final StringArray s_allowedAttributes
Enumeration of allowed attribute names


m_nestingAttrs

private NestingAttributes m_nestingAttrs
Value style attribute information.


m_defContext

private DefinitionContext m_defContext
Definition context for this nesting (created by validation).


m_children

private java.util.ArrayList m_children
List of child elements.

Constructor Detail

NestingElementBase

protected NestingElementBase(int type)
Constructor.

Parameters:
type - element type code
Method Detail

addChild

public final void addChild(java.lang.Object child)
Add child element. TODO: should be ElementBase argument, but JiBX doesn't allow yet

Parameters:
child - element to be added as child of this element

children

public final java.util.ArrayList children()
Get list of child elements.

Returns:
list of child elements (never null)

childIterator

public final java.util.Iterator childIterator()
Get iterator for child elements.

Returns:
iterator for child elements

getDefinitions

public final DefinitionContext getDefinitions()
Get definition context. This method may only be called after validation.

Returns:
definition context, or null if no definition context for this element

setDefinitions

void setDefinitions(DefinitionContext ctx)
Set definition context.

Parameters:
ctx - definition context to be set

getStyleName

public java.lang.String getStyleName()
Get style name set on this nesting element.

Returns:
style string value (null if undefined at this level)

getStyle

public int getStyle()
Get style value set on this nesting element. This call is only meaningful after validation.

Returns:
style value (-1 if undefined at this level)

setStyleName

public void setStyleName(java.lang.String name)
Set style name on this nesting element.

Parameters:
name - style name (null to undefine style at this level)

getDefaultStyle

public int getDefaultStyle()
Get default style value for child components. This call is only meaningful after validation.

Returns:
default style value for child components (-1 if not defined at this level)

prevalidate

public void prevalidate(ValidationContext vctx)
Description copied from class: ElementBase
Prevalidate element information. The prevalidation step is used to check isolated aspects of an element, such as the settings for enumerated values on the element and attributes. This empty base class implementation should be overridden by each subclass that requires prevalidation handling.

Overrides:
prevalidate in class ElementBase
Parameters:
vctx - validation context

validate

public void validate(ValidationContext vctx)
Description copied from class: ElementBase
Validate element information. The validation step is used for checking the interactions between elements, such as name references to other elements. The ElementBase.prevalidate(org.jibx.binding.model.ValidationContext) method will always be called for every element in the binding definition before this method is called for any element. This empty base class implementation should be overridden by each subclass that requires validation handling.

Overrides:
validate in class ElementBase
Parameters:
vctx - validation context


Project Web Site