org.qtitools.qti.attribute
Class SingleAttribute

java.lang.Object
  extended by org.qtitools.qti.attribute.AbstractAttribute
      extended by org.qtitools.qti.attribute.SingleAttribute
All Implemented Interfaces:
java.io.Serializable, Attribute, Validatable
Direct Known Subclasses:
BaseTypeAttribute, BooleanAttribute, CardinalityAttribute, DateAttribute, DurationAttribute, FloatAttribute, IdentifierAttribute, IntegerAttribute, LongAttribute, NavigationModeAttribute, OrientationAttribute, ParamTypeAttribute, RoundingModeAttribute, SessionStatusAttribute, ShapeAttribute, SingleValueAttribute, StringAttribute, SubmissionModeAttribute, TableCellScopeAttribute, TestFeedbackAccessAttribute, TextFormatAttribute, ToleranceModeAttribute, UriAttribute, VisibilityModeAttribute

public abstract class SingleAttribute
extends AbstractAttribute

Implementation of attribute with single value (normal attribute).

Author:
Jiri Kajaba
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.qtitools.qti.attribute.AbstractAttribute
logger
 
Constructor Summary
SingleAttribute(XmlNode parent, java.lang.String name)
          Constructs attribute.
SingleAttribute(XmlNode parent, java.lang.String name, java.lang.Object defaultValue)
          Constructs attribute.
SingleAttribute(XmlNode parent, java.lang.String name, java.lang.Object value, java.lang.Object defaultValue, boolean required)
          Constructs attribute.
 
Method Summary
 java.lang.String defaultValueToString()
          Gets attribute's defaultValue converted to string.
 java.lang.Object getDefaultValue()
          Gets default value of attribute.
 java.lang.Object getValue()
          Gets value of attribute.
 void load(org.w3c.dom.Node node)
          Loads attribute's value from given source node.
 void load(java.lang.String value)
          Loads attribute's value from given source string.
protected abstract  java.lang.Object parseValue(java.lang.String value)
          Parses value from given string.
protected  void setDefaultValue(java.lang.Object defaultValue)
          Sets new default value of attribute.
protected  void setValue(java.lang.Object value)
          Sets new value of attribute.
 java.lang.String valueToString()
          Gets attribute's value converted to string.
 
Methods inherited from class org.qtitools.qti.attribute.AbstractAttribute
getFullName, getLoadedValue, getLoadingProblem, getName, getParent, isRequired, isSupported, setLoadedValue, setLoadingProblem, setSupported, toString, toXmlString, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SingleAttribute

public SingleAttribute(XmlNode parent,
                       java.lang.String name)
Constructs attribute.

Parameters:
parent - attribute's parent
name - attribute's name

SingleAttribute

public SingleAttribute(XmlNode parent,
                       java.lang.String name,
                       java.lang.Object defaultValue)
Constructs attribute.

Parameters:
parent - attribute's parent
name - attribute's name
defaultValue - attribute's default value

SingleAttribute

public SingleAttribute(XmlNode parent,
                       java.lang.String name,
                       java.lang.Object value,
                       java.lang.Object defaultValue,
                       boolean required)
Constructs attribute.

Parameters:
parent - attribute's parent
name - attribute's name
value - attribute's value
defaultValue - attribute's default value
required - is this attribute required
Method Detail

getValue

public java.lang.Object getValue()
Gets value of attribute.

Returns:
value of attribute
See Also:
setValue(java.lang.Object)

setValue

protected void setValue(java.lang.Object value)
Sets new value of attribute.

Parameters:
value - new value of attribute
See Also:
getValue()

getDefaultValue

public java.lang.Object getDefaultValue()
Gets default value of attribute.

Returns:
default value of attribute
See Also:
setDefaultValue(java.lang.Object)

setDefaultValue

protected void setDefaultValue(java.lang.Object defaultValue)
Sets new default value of attribute.

Parameters:
defaultValue - new default value of attribute
See Also:
getDefaultValue()

load

public void load(org.w3c.dom.Node node)
Description copied from interface: Attribute
Loads attribute's value from given source node. Source node must contain attributes (one of them can be this attribute).

Parameters:
node - source node

load

public void load(java.lang.String value)
Description copied from interface: Attribute
Loads attribute's value from given source string. Source string must contain only attribute's value, nothing else.

Parameters:
value - source string

parseValue

protected abstract java.lang.Object parseValue(java.lang.String value)
Parses value from given string.

Parameters:
value - string value
Returns:
parsed value

valueToString

public java.lang.String valueToString()
Description copied from interface: Attribute
Gets attribute's value converted to string. If value is not defined, returns empty (but not null) string.

Returns:
attribute's value converted to string

defaultValueToString

public java.lang.String defaultValueToString()
Description copied from interface: Attribute
Gets attribute's defaultValue converted to string. If defaultValue is not defined, returns empty (but not null) string.

Returns:
attribute's defaultValue converted to string


Copyright © 2009. All Rights Reserved.