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 int
CDATA_STYLE
static int
DEF_IDENT
static int
NONE_IDENT
static int
REF_IDENT
static StringArray
s_allowedAttributes
Enumeration of allowed attribute namesstatic int
TEXT_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 String
getConstantValue()
Get constant value.String
getDeclaredType()
Get declared type name.Object
getDefault()
Get default value.String
getDefaultText()
Get default value text.IClassItem
getDeserializer()
Get deserializer method information.String
getDeserializerName()
Get deserializer name.String
getEffectiveStyleName()
Get name for style that applies to this value.IClassItem
getEnumValue()
Get enum value method information.String
getEnumValueName()
Get enum value method name.IClassItem
getField()
Get field information.String
getFieldName()
Get field name.String
getFormatName()
Get base format name.org.jibx.runtime.QName
getFormatQName()
Get format qualified name.IClassItem
getGet()
Get get method information.String
getGetName()
Get get method name.IClass
getGetType()
Get type for value loaded to stack.int
getIdent()
Get identity value.String
getIdentName()
Get identity string value.String
getName()
Get name.NamespaceElement
getNamespace()
Get effective namespace information.String
getPrefix()
Get specified namespace prefix.IClassItem
getSerializer()
Get serializer method information.String
getSerializerName()
Get serializer name.IClassItem
getSet()
Get set method information.String
getSetName()
Get set method name.IClass
getSetType()
Get type for value stored from stack.int
getStyle()
Get style value.String
getStyleName()
Get style string value.IClassItem
getTest()
Get test method information.String
getTestName()
Get test method name.IClass
getType()
Get value type information.String
getUri()
Get specified namespace URI.int
getUsage()
Get usage value.String
getUsageName()
Get usage name.boolean
hasAttribute()
Check if component defines one or more attribute values of the containing element.boolean
hasContent()
Check if component defines one or more elements or text values as children of the containing element.boolean
hasName()
Check if component has a name.boolean
hasProperty()
Check if property is defined.boolean
isImplicit()
Check if this value implicitly uses the containing object.boolean
isNillable()
Check if nillable object.boolean
isOptional()
Check if component is an optional item.void
prevalidate(ValidationContext vctx)
Prevalidate element information.void
setConstantValue(String value)
Set constant value.void
setDeclaredType(String type)
Set declared type name.void
setDefaultText(String value)
Set default value text.void
setDeserializerName(String name)
Set deserializer method name.void
setEffectiveStyle(int style)
Set style that applies to this value.void
setEnumValueName(String name)
Set enum value method name.void
setFieldName(String field)
Set field name.void
setFormatName(String name)
Set base format name.void
setFormatQName(org.jibx.runtime.QName qname)
Set format qualified name.void
setGetName(String get)
Set get method name.void
setIdentName(String name)
Set identity name.void
setName(String name)
Set name.void
setNillable(boolean nillable)
Set nillable flag.void
setPrefix(String prefix)
Set namespace prefix.void
setSerializerName(String name)
Set serializer method name.void
setSetName(String set)
Set set method name.void
setStyleName(String name)
Set style name.void
setTestName(String test)
Set test method name.void
setUri(String uri)
Set namespace URI.void
setUsage(int use)
Set usage value.void
setUsageName(String name)
Set usage name.void
validate(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
-
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
-
-
Method Detail
-
getConstantValue
public String getConstantValue()
Get constant value.- Returns:
- constant value, or
null
if not a constant
-
setConstantValue
public void setConstantValue(String value)
Set constant value.- Parameters:
value
- constant value, ornull
if not a constant
-
getStyleName
public 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(String name)
Set style name.- Parameters:
name
- style name (null
if to use inherited default)
-
getEffectiveStyleName
public 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 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(String name)
Set identity name.- Parameters:
name
- identity name
-
getName
public String getName()
Get name.- Specified by:
getName
in interfaceIComponent
- Returns:
- name text
-
setName
public void setName(String name)
Set name.- Parameters:
name
- text for name
-
getUri
public String getUri()
Get specified namespace URI.- Specified by:
getUri
in interfaceIComponent
- Returns:
- namespace URI (
null
if not set)
-
setUri
public void setUri(String uri)
Set namespace URI.- Parameters:
uri
- namespace URI (null
if not set)
-
getPrefix
public String getPrefix()
Get specified namespace prefix.- Returns:
- namespace prefix (
null
if not set)
-
setPrefix
public void setPrefix(String prefix)
Set namespace prefix.- Parameters:
prefix
- namespace prefix (null
if not set)
-
getNamespace
public NamespaceElement getNamespace()
Get effective namespace information. This call is only meaningful after validation.- Returns:
- effective namespace information
-
getUsageName
public 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(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:
true
if property defined,false
if not
-
getDeclaredType
public String getDeclaredType()
Get declared type name.- Returns:
- type name (or
null
if none)
-
setDeclaredType
public void setDeclaredType(String type)
Set declared type name.- Parameters:
type
- name (ornull
if none)
-
getFieldName
public String getFieldName()
Get field name.- Returns:
- field name (or
null
if none)
-
getField
public IClassItem getField()
Get field information. This call is only meaningful after a call toprevalidate(ValidationContext)
.- Returns:
- field information (or
null
if none)
-
setFieldName
public void setFieldName(String field)
Set field name.- Parameters:
field
- field name (ornull
if none)
-
getTestName
public String getTestName()
Get test method name.- Returns:
- test method name (or
null
if none)
-
getTest
public IClassItem getTest()
Get test method information. This call is only meaningful after a call toprevalidate(ValidationContext)
.- Returns:
- test method information (or
null
if none)
-
setTestName
public void setTestName(String test)
Set test method name.- Parameters:
test
- test method name (ornull
if none)
-
getGetName
public String getGetName()
Get get method name.- Returns:
- get method name (or
null
if none)
-
getGet
public IClassItem getGet()
Get get method information. This call is only meaningful after a call toprevalidate(ValidationContext)
.- Returns:
- get method information (or
null
if 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
null
if none)
-
setGetName
public void setGetName(String get)
Set get method name.- Parameters:
get
- get method name (ornull
if none)
-
getSetName
public String getSetName()
Get set method name.- Returns:
- set method name (or
null
if none)
-
getSet
public IClassItem getSet()
Get set method information. This call is only meaningful after a call toprevalidate(ValidationContext)
.- Returns:
- set method information (or
null
if 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
null
if none)
-
setSetName
public void setSetName(String set)
Set set method name.- Parameters:
set
- set method name (ornull
if 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:
isImplicit
in interfaceIComponent
- Returns:
true
if using the containing object,false
if own value
-
getDefaultText
public String getDefaultText()
Get default value text.- Returns:
- default value text
-
getDefault
public Object getDefault()
Get default value. This call is only meaningful after validation.- Returns:
- default value object
-
setDefaultText
public void setDefaultText(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
null
if none)
-
getEnumValueName
public String getEnumValueName()
Get enum value method name.- Returns:
- enum value method name (or
null
if none)
-
setEnumValueName
public void setEnumValueName(String name)
Set enum value method name.- Parameters:
name
- enum value method name (null
if none)
-
getFormatName
public String getFormatName()
Get base format name.- Returns:
- referenced base format
-
setFormatName
public void setFormatName(String name)
Set base format name.- Parameters:
name
- referenced base format
-
getFormatQName
public org.jibx.runtime.QName getFormatQName()
Get format qualified name.- Returns:
- format qualified name (
null
if none)
-
setFormatQName
public void setFormatQName(org.jibx.runtime.QName qname)
Set format qualified name. This method changes the label value to match the qualified name.- Parameters:
qname
- format qualified name (null
if none)
-
getSerializerName
public String getSerializerName()
Get serializer name.- Returns:
- fully qualified class and method name for serializer (or
null
if none)
-
getSerializer
public IClassItem getSerializer()
Get serializer method information. This call is only meaningful after validation.- Returns:
- serializer information (or
null
if none)
-
setSerializerName
public void setSerializerName(String name)
Set serializer method name.- Parameters:
name
- fully qualified class and method name for serializer
-
getDeserializerName
public String getDeserializerName()
Get deserializer name.- Returns:
- fully qualified class and method name for deserializer (or
null
if none)
-
getDeserializer
public IClassItem getDeserializer()
Get deserializer method information. This call is only meaningful after validation.- Returns:
- deserializer information (or
null
if none)
-
setDeserializerName
public void setDeserializerName(String name)
Set deserializer method name.- Parameters:
name
- fully qualified class and method name for deserializer
-
hasAttribute
public boolean hasAttribute()
Description copied from interface:IComponent
Check if component defines one or more attribute values of the containing element. This method is only valid after validation.- Specified by:
hasAttribute
in interfaceIComponent
- Returns:
true
if one or more attribute values defined for containing element,false
if not
-
hasContent
public boolean hasContent()
Description copied from interface:IComponent
Check 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:
hasContent
in interfaceIComponent
- Returns:
true
if one or more content values defined for containing element,false
if not
-
isOptional
public boolean isOptional()
Description copied from interface:IComponent
Check if component is an optional item.- Specified by:
isOptional
in interfaceIComponent
- Returns:
true
if optional,false
if required
-
hasName
public boolean hasName()
Description copied from interface:IComponent
Check if component has a name.- Specified by:
hasName
in interfaceIComponent
- Returns:
true
if component has a name,false
if not
-
getType
public IClass getType()
Description copied from interface:IComponent
Get value type information. This call is only meaningful after prevalidation.- Specified by:
getType
in interfaceIComponent
- Returns:
- type information
-
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 classElementBase
- 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. 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 classElementBase
- Parameters:
vctx
- validation context
-
-