Package org.jibx.binding.model
Class ValueElement
- java.lang.Object
-
- org.jibx.binding.model.ElementBase
-
- org.jibx.binding.model.ValueElement
-
- All Implemented Interfaces:
IComponent
public class ValueElement extends ElementBase implements IComponent
Model component for value element. This element defines a value that can be represented as a simple text string, which may be expressed as an attribute, element, or text component of the XML document.- Author:
- Dennis M. Sosnoski
-
-
Field Summary
Fields Modifier and Type Field Description static intCDATA_STYLEstatic intDEF_IDENTprivate java.lang.Stringm_constantValueSupplied constant value.private intm_identIndexActual selected identity.private java.lang.Stringm_identNameSupplied identity name.private booleanm_isNillableNillable object flag.private NameAttributesm_nameAttrsName attributes information for value.private PropertyAttributesm_propertyAttrsProperty attributes information for value.private StringAttributesm_stringAttrsString attributes information for value.private intm_styleIndexActual selected style.private java.lang.Stringm_styleNameSupplied style name.static intNONE_IDENTstatic intREF_IDENTstatic StringArrays_allowedAttributesEnumeration of allowed attribute names(package private) static EnumSets_identEnumprivate static EnumSets_styleEnumstatic intTEXT_STYLE-
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
Constructors Constructor Description ValueElement()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetConstantValue()Get constant value.java.lang.StringgetDeclaredType()Get declared type name.java.lang.ObjectgetDefault()Get default value.java.lang.StringgetDefaultText()Get default value text.IClassItemgetDeserializer()Get deserializer method information.java.lang.StringgetDeserializerName()Get deserializer name.java.lang.StringgetEffectiveStyleName()Get name for style that applies to this value.IClassItemgetEnumValue()Get enum value method information.java.lang.StringgetEnumValueName()Get enum value method name.IClassItemgetField()Get field information.java.lang.StringgetFieldName()Get field name.java.lang.StringgetFormatName()Get base format name.QNamegetFormatQName()Get format qualified name.IClassItemgetGet()Get get method information.java.lang.StringgetGetName()Get get method name.IClassgetGetType()Get type for value loaded to stack.intgetIdent()Get identity value.java.lang.StringgetIdentName()Get identity string value.java.lang.StringgetName()Get name.NamespaceElementgetNamespace()Get effective namespace information.java.lang.StringgetPrefix()Get specified namespace prefix.IClassItemgetSerializer()Get serializer method information.java.lang.StringgetSerializerName()Get serializer name.IClassItemgetSet()Get set method information.java.lang.StringgetSetName()Get set method name.IClassgetSetType()Get type for value stored from stack.intgetStyle()Get style value.java.lang.StringgetStyleName()Get style string value.IClassItemgetTest()Get test method information.java.lang.StringgetTestName()Get test method name.IClassgetType()Get value type information.java.lang.StringgetUri()Get specified namespace URI.intgetUsage()Get usage value.java.lang.StringgetUsageName()Get usage name.booleanhasAttribute()Check if component defines one or more attribute values of the containing element.booleanhasContent()Check if component defines one or more elements or text values as children of the containing element.booleanhasName()Check if component has a name.booleanhasProperty()Check if property is defined.booleanisImplicit()Check if this value implicitly uses the containing object.booleanisNillable()Check if nillable object.booleanisOptional()Check if component is an optional item.private voidpreSet(IUnmarshallingContext uctx)Make sure all attributes are defined.voidprevalidate(ValidationContext vctx)Prevalidate element information.voidsetConstantValue(java.lang.String value)Set constant value.voidsetDeclaredType(java.lang.String type)Set declared type name.voidsetDefaultText(java.lang.String value)Set default value text.voidsetDeserializerName(java.lang.String name)Set deserializer method name.voidsetEffectiveStyle(int style)Set style that applies to this value.voidsetEnumValueName(java.lang.String name)Set enum value method name.voidsetFieldName(java.lang.String field)Set field name.voidsetFormatName(java.lang.String name)Set base format name.voidsetFormatQName(QName qname)Set format qualified name.voidsetGetName(java.lang.String get)Set get method name.voidsetIdentName(java.lang.String name)Set identity name.voidsetName(java.lang.String name)Set name.voidsetNillable(boolean nillable)Set nillable flag.voidsetPrefix(java.lang.String prefix)Set namespace prefix.voidsetSerializerName(java.lang.String name)Set serializer method name.voidsetSetName(java.lang.String set)Set set method name.voidsetStyleName(java.lang.String name)Set style name.voidsetTestName(java.lang.String test)Set test method name.voidsetUri(java.lang.String uri)Set namespace URI.voidsetUsage(int use)Set usage value.voidsetUsageName(java.lang.String name)Set usage name.voidvalidate(ValidationContext vctx)Validate element information.-
Methods inherited from class org.jibx.binding.model.ElementBase
getComment, name, setComment, toString, type, validateAttributes
-
-
-
-
Field Detail
-
s_allowedAttributes
public static final StringArray s_allowedAttributes
Enumeration of allowed attribute names
-
CDATA_STYLE
public static final int CDATA_STYLE
- See Also:
- Constant Field Values
-
TEXT_STYLE
public static final int TEXT_STYLE
- See Also:
- Constant Field Values
-
s_styleEnum
private static final EnumSet s_styleEnum
-
NONE_IDENT
public static final int NONE_IDENT
- See Also:
- Constant Field Values
-
DEF_IDENT
public static final int DEF_IDENT
- See Also:
- Constant Field Values
-
REF_IDENT
public static final int REF_IDENT
- See Also:
- Constant Field Values
-
s_identEnum
static final EnumSet s_identEnum
-
m_constantValue
private java.lang.String m_constantValue
Supplied constant value.
-
m_styleName
private java.lang.String m_styleName
Supplied style name.
-
m_styleIndex
private int m_styleIndex
Actual selected style.
-
m_identName
private java.lang.String m_identName
Supplied identity name.
-
m_isNillable
private boolean m_isNillable
Nillable object flag.
-
m_identIndex
private int m_identIndex
Actual selected identity.
-
m_nameAttrs
private NameAttributes m_nameAttrs
Name attributes information for value.
-
m_propertyAttrs
private PropertyAttributes m_propertyAttrs
Property attributes information for value.
-
m_stringAttrs
private StringAttributes m_stringAttrs
String attributes information for value.
-
-
Method Detail
-
getConstantValue
public java.lang.String getConstantValue()
Get constant value.- Returns:
- constant value, or
nullif not a constant
-
setConstantValue
public void setConstantValue(java.lang.String value)
Set constant value.- Parameters:
value- constant value, ornullif not a constant
-
getStyleName
public java.lang.String getStyleName()
Get style string value.- Returns:
- style string value
-
getStyle
public int getStyle()
Get style value. This call is only meaningful after validation.- Returns:
- style value
-
setStyleName
public void setStyleName(java.lang.String name)
Set style name.- Parameters:
name- style name (nullif to use inherited default)
-
getEffectiveStyleName
public java.lang.String getEffectiveStyleName()
Get name for style that applies to this value. This call is only meaningful after validation.- Returns:
- name for style
-
setEffectiveStyle
public void setEffectiveStyle(int style)
Set style that applies to this value. If the specified style is different from the nested default it is applied directly, otherwise this value is configured to use the default. This method should therefore only be used when the nested settings are considered fixed. TODO: implement this with parent links- Parameters:
style- style value
-
getIdentName
public java.lang.String getIdentName()
Get identity string value.- Returns:
- identity string value
-
getIdent
public int getIdent()
Get identity value. This call is only meaningful after validation.- Returns:
- identity value
-
setIdentName
public void setIdentName(java.lang.String name)
Set identity name.- Parameters:
name- identity name
-
getName
public java.lang.String getName()
Get name.- Specified by:
getNamein interfaceIComponent- Returns:
- name text
-
setName
public void setName(java.lang.String name)
Set name.- Parameters:
name- text for name
-
getUri
public java.lang.String getUri()
Get specified namespace URI.- Specified by:
getUriin interfaceIComponent- Returns:
- namespace URI (
nullif not set)
-
setUri
public void setUri(java.lang.String uri)
Set namespace URI.- Parameters:
uri- namespace URI (nullif not set)
-
getPrefix
public java.lang.String getPrefix()
Get specified namespace prefix.- Returns:
- namespace prefix (
nullif not set)
-
setPrefix
public void setPrefix(java.lang.String prefix)
Set namespace prefix.- Parameters:
prefix- namespace prefix (nullif not set)
-
getNamespace
public NamespaceElement getNamespace()
Get effective namespace information. This call is only meaningful after validation.- Returns:
- effective namespace information
-
getUsageName
public java.lang.String getUsageName()
Get usage name.- Returns:
- usage name
-
getUsage
public int getUsage()
Get usage value. This call is only meaningful after a call toprevalidate(ValidationContext).- Returns:
- usage value
-
setUsageName
public void setUsageName(java.lang.String name)
Set usage name.- Parameters:
name- usage name
-
setUsage
public void setUsage(int use)
Set usage value.- Parameters:
use- value
-
hasProperty
public boolean hasProperty()
Check if property is defined. This method is only meaningful after a call toprevalidate(ValidationContext).- Returns:
trueif property defined,falseif not
-
getDeclaredType
public java.lang.String getDeclaredType()
Get declared type name.- Returns:
- type name (or
nullif none)
-
setDeclaredType
public void setDeclaredType(java.lang.String type)
Set declared type name.- Parameters:
type- name (ornullif none)
-
getFieldName
public java.lang.String getFieldName()
Get field name.- Returns:
- field name (or
nullif none)
-
getField
public IClassItem getField()
Get field information. This call is only meaningful after a call toprevalidate(ValidationContext).- Returns:
- field information (or
nullif none)
-
setFieldName
public void setFieldName(java.lang.String field)
Set field name.- Parameters:
field- field name (ornullif none)
-
getTestName
public java.lang.String getTestName()
Get test method name.- Returns:
- test method name (or
nullif none)
-
getTest
public IClassItem getTest()
Get test method information. This call is only meaningful after a call toprevalidate(ValidationContext).- Returns:
- test method information (or
nullif none)
-
setTestName
public void setTestName(java.lang.String test)
Set test method name.- Parameters:
test- test method name (ornullif none)
-
getGetName
public java.lang.String getGetName()
Get get method name.- Returns:
- get method name (or
nullif none)
-
getGet
public IClassItem getGet()
Get get method information. This call is only meaningful after a call toprevalidate(ValidationContext).- Returns:
- get method information (or
nullif none)
-
getGetType
public IClass getGetType()
Get type for value loaded to stack. This call is only meaningful after a call toprevalidate(ValidationContext).- Returns:
- get value type (or
nullif none)
-
setGetName
public void setGetName(java.lang.String get)
Set get method name.- Parameters:
get- get method name (ornullif none)
-
getSetName
public java.lang.String getSetName()
Get set method name.- Returns:
- set method name (or
nullif none)
-
getSet
public IClassItem getSet()
Get set method information. This call is only meaningful after a call toprevalidate(ValidationContext).- Returns:
- set method information (or
nullif none)
-
getSetType
public IClass getSetType()
Get type for value stored from stack. This call is only meaningful after a call toprevalidate(ValidationContext).- Returns:
- set value type (or
nullif none)
-
setSetName
public void setSetName(java.lang.String set)
Set set method name.- Parameters:
set- set method name (ornullif none)
-
isNillable
public boolean isNillable()
Check if nillable object.- Returns:
- nillable flag
-
setNillable
public void setNillable(boolean nillable)
Set nillable flag.- Parameters:
nillable- flag
-
isImplicit
public boolean isImplicit()
Check if this value implicitly uses the containing object. This call is only meaningful after a call toprevalidate(ValidationContext).- Specified by:
isImplicitin interfaceIComponent- Returns:
trueif using the containing object,falseif own value
-
getDefaultText
public java.lang.String getDefaultText()
Get default value text.- Returns:
- default value text
-
getDefault
public java.lang.Object getDefault()
Get default value. This call is only meaningful after validation.- Returns:
- default value object
-
setDefaultText
public void setDefaultText(java.lang.String value)
Set default value text.- Parameters:
value- default value text
-
getEnumValue
public IClassItem getEnumValue()
Get enum value method information. This method is only usable after a call tovalidate(ValidationContext).- Returns:
- enum value method information (or
nullif none)
-
getEnumValueName
public java.lang.String getEnumValueName()
Get enum value method name.- Returns:
- enum value method name (or
nullif none)
-
setEnumValueName
public void setEnumValueName(java.lang.String name)
Set enum value method name.- Parameters:
name- enum value method name (nullif none)
-
getFormatName
public java.lang.String getFormatName()
Get base format name.- Returns:
- referenced base format
-
setFormatName
public void setFormatName(java.lang.String name)
Set base format name.- Parameters:
name- referenced base format
-
getFormatQName
public QName getFormatQName()
Get format qualified name.- Returns:
- format qualified name (
nullif none)
-
setFormatQName
public void setFormatQName(QName qname)
Set format qualified name. This method changes the label value to match the qualified name.- Parameters:
qname- format qualified name (nullif none)
-
getSerializerName
public java.lang.String getSerializerName()
Get serializer name.- Returns:
- fully qualified class and method name for serializer (or
nullif none)
-
getSerializer
public IClassItem getSerializer()
Get serializer method information. This call is only meaningful after validation.- Returns:
- serializer information (or
nullif none)
-
setSerializerName
public void setSerializerName(java.lang.String name)
Set serializer method name.- Parameters:
name- fully qualified class and method name for serializer
-
getDeserializerName
public java.lang.String getDeserializerName()
Get deserializer name.- Returns:
- fully qualified class and method name for deserializer (or
nullif none)
-
getDeserializer
public IClassItem getDeserializer()
Get deserializer method information. This call is only meaningful after validation.- Returns:
- deserializer information (or
nullif none)
-
setDeserializerName
public void setDeserializerName(java.lang.String name)
Set deserializer method name.- Parameters:
name- fully qualified class and method name for deserializer
-
hasAttribute
public boolean hasAttribute()
Description copied from interface:IComponentCheck if component defines one or more attribute values of the containing element. This method is only valid after validation.- Specified by:
hasAttributein interfaceIComponent- Returns:
trueif one or more attribute values defined for containing element,falseif not
-
hasContent
public boolean hasContent()
Description copied from interface:IComponentCheck if component defines one or more elements or text values as children of the containing element. This method is only valid after validation.- Specified by:
hasContentin interfaceIComponent- Returns:
trueif one or more content values defined for containing element,falseif not
-
isOptional
public boolean isOptional()
Description copied from interface:IComponentCheck if component is an optional item.- Specified by:
isOptionalin interfaceIComponent- Returns:
trueif optional,falseif required
-
hasName
public boolean hasName()
Description copied from interface:IComponentCheck if component has a name.- Specified by:
hasNamein interfaceIComponent- Returns:
trueif component has a name,falseif not
-
getType
public IClass getType()
Description copied from interface:IComponentGet value type information. This call is only meaningful after prevalidation.- Specified by:
getTypein interfaceIComponent- Returns:
- type information
-
preSet
private void preSet(IUnmarshallingContext uctx)
Make sure all attributes are defined.- Parameters:
uctx- unmarshalling context
-
prevalidate
public void prevalidate(ValidationContext vctx)
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 classElementBase- Parameters:
vctx- validation context
-
validate
public void validate(ValidationContext vctx)
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 classElementBase- Parameters:
vctx- validation context
-
-