Package org.jibx.binding.model
Class TemplateElementBase
java.lang.Object
org.jibx.binding.model.ElementBase
org.jibx.binding.model.NestingElementBase
org.jibx.binding.model.ContainerElementBase
org.jibx.binding.model.TemplateElementBase
- Direct Known Subclasses:
MappingElementBase
,TemplateElement
Model component for elements that define how instances of a particular class
are converted to or from XML. This includes both mapping and
template elements.
- Author:
- Dennis M. Sosnoski
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String
Name of handled class.private ArrayList
Templates or mappings that can be used in place of this one (as substitution group using mapping, or xsi:type with template).private IClass
Handled class information.protected ArrayList
List of child elements.static final StringArray
Enumeration of allowed attribute namesFields 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Add template or mapping which derives from this one.void
addTopChild
(Object child) Add top-level child element.Get mapped class name.Get templates or mappings which derive from this one.Get handled class information.Get class linked to binding element.getType()
boolean
Check if this container defines a context object.abstract boolean
Check if default template for type.boolean
boolean
void
prevalidate
(ValidationContext vctx) Prevalidate element information.void
setClassName
(String name) Set mapped class name.Get iterator for top-level child elements.Get list of top-level child elements.void
validate
(ValidationContext vctx) Validate element information.Methods inherited from class org.jibx.binding.model.ContainerElementBase
checkCompatibleChildren, classifyComponents, getAttributeComponents, getChildObjectType, getContentComponents, getCreateClass, getCreateType, getFactory, getFactoryName, getId, getLabel, getMarshaller, getMarshallerName, getPostset, getPostsetName, getPreget, getPregetName, getPreset, getPresetName, getUnmarshaller, getUnmarshallerName, getUsing, isAllowRepeats, isChoice, isClassified, isFlexible, isNillable, isOrdered, setAllowRepeats, setChoice, setComponents, setCreateType, setFactoryName, setFlexible, setIdChild, setLabel, setMarshallerName, setNillable, setOrdered, setPostsetName, setPregetName, setPresetName, setUnmarshallerName, setUsing, verifyConstruction
Methods inherited from class org.jibx.binding.model.NestingElementBase
addChild, childIterator, children, getDefaultStyle, getDefinitions, getStyle, getStyleName, setDefinitions, setStyleName
Methods inherited from class org.jibx.binding.model.ElementBase
getComment, name, setComment, toString, type, validateAttributes
-
Field Details
-
s_allowedAttributes
Enumeration of allowed attribute names -
m_className
Name of handled class. -
m_handledClass
Handled class information. -
m_topChildren
List of child elements. -
m_extensionTypes
Templates or mappings that can be used in place of this one (as substitution group using mapping, or xsi:type with template).
-
-
Constructor Details
-
TemplateElementBase
public TemplateElementBase(int type) Constructor.- Parameters:
type
- element type code
-
-
Method Details
-
setClassName
Set mapped class name.- Parameters:
name
- mapped class name
-
getClassName
Get mapped class name.- Returns:
- class name
-
getHandledClass
Get handled class information. This call is only meaningful after prevalidation.- Returns:
- mapped class information
-
addExtensionType
Add template or mapping which derives from this one.- Parameters:
ext
- derived template or mapping information
-
getExtensionTypes
Get templates or mappings which derive from this one.- Returns:
- list of derived templates or mappings
-
isDefaultTemplate
public abstract boolean isDefaultTemplate()Check if default template for type. Needs to be implemented by subclasses for common handling.- Returns:
true
if default for type,false
if not
-
addTopChild
Add top-level child element.- Parameters:
child
- element to be added as child of this element
-
topChildren
Get list of top-level child elements.- Returns:
- list of child elements, or
null
if none
-
topChildIterator
Get iterator for top-level child elements.- Returns:
- iterator for child elements
-
isOptional
public boolean isOptional() -
getType
-
isImplicit
public boolean isImplicit() -
hasObject
public boolean hasObject()Description copied from class:ContainerElementBase
Check if this container defines a context object.- Specified by:
hasObject
in classContainerElementBase
- Returns:
true
if defines context object,false
if not
-
getObjectType
Description copied from class:ContainerElementBase
Get class linked to binding element. This call is only meaningful after validation.- Specified by:
getObjectType
in classContainerElementBase
- Returns:
- information for class linked by binding
-
prevalidate
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 classContainerElementBase
- Parameters:
vctx
- validation context
-
validate
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. TheElementBase.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 classContainerElementBase
- Parameters:
vctx
- validation context
-