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 StringName of handled class.private ArrayListTemplates or mappings that can be used in place of this one (as substitution group using mapping, or xsi:type with template).private IClassHandled class information.protected ArrayListList of child elements.static final StringArrayEnumeration 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 voidAdd template or mapping which derives from this one.voidaddTopChild(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()booleanCheck if this container defines a context object.abstract booleanCheck if default template for type.booleanbooleanvoidprevalidate(ValidationContext vctx) Prevalidate element information.voidsetClassName(String name) Set mapped class name.Get iterator for top-level child elements.Get list of top-level child elements.voidvalidate(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, verifyConstructionMethods inherited from class org.jibx.binding.model.NestingElementBase
addChild, childIterator, children, getDefaultStyle, getDefinitions, getStyle, getStyleName, setDefinitions, setStyleNameMethods 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:
trueif default for type,falseif 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
nullif 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:ContainerElementBaseCheck if this container defines a context object.- Specified by:
hasObjectin classContainerElementBase- Returns:
trueif defines context object,falseif not
-
getObjectType
Description copied from class:ContainerElementBaseGet class linked to binding element. This call is only meaningful after validation.- Specified by:
getObjectTypein classContainerElementBase- Returns:
- information for class linked by binding
-
prevalidate
Description copied from class:ElementBasePrevalidate 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:
prevalidatein classContainerElementBase- Parameters:
vctx- validation context
-
validate
Description copied from class:ElementBaseValidate 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:
validatein classContainerElementBase- Parameters:
vctx- validation context
-