org.qtitools.qti.attribute
Class MultipleAttribute

java.lang.Object
  extended by org.qtitools.qti.attribute.AbstractAttribute
      extended by org.qtitools.qti.attribute.MultipleAttribute
All Implemented Interfaces:
java.io.Serializable, Attribute, Validatable
Direct Known Subclasses:
CoordsAttribute, FloatMultipleAttribute, IdentifierMultipleAttribute, StringMultipleAttribute, ViewMultipleAttribute

public abstract class MultipleAttribute
extends AbstractAttribute

Implementation of attribute with multiple value (e.g. attr="1 2 3").

Author:
Jiri Kajaba
See Also:
Serialized Form

Field Summary
 java.lang.String FIELDS_SEPARATOR
          Values separator.
 
Fields inherited from class org.qtitools.qti.attribute.AbstractAttribute
logger
 
Constructor Summary
MultipleAttribute(XmlNode parent, java.lang.String name)
          Constructs attribute.
MultipleAttribute(XmlNode parent, java.lang.String name, java.util.List<? extends java.lang.Object> defaultValue)
          Constructs attribute.
MultipleAttribute(XmlNode parent, java.lang.String name, java.util.List<? extends java.lang.Object> value, java.util.List<? extends java.lang.Object> defaultValue, boolean required)
          Constructs attribute.
 
Method Summary
 java.lang.String defaultValueToString()
          Gets attribute's defaultValue converted to string.
 java.util.List<? extends java.lang.Object> getDefaultValues()
          Gets default value of attribute.
 java.util.List<? extends java.lang.Object> getValues()
          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.
 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
 

Field Detail

FIELDS_SEPARATOR

public java.lang.String FIELDS_SEPARATOR
Values separator.

Constructor Detail

MultipleAttribute

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

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

MultipleAttribute

public MultipleAttribute(XmlNode parent,
                         java.lang.String name,
                         java.util.List<? extends java.lang.Object> defaultValue)
Constructs attribute.

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

MultipleAttribute

public MultipleAttribute(XmlNode parent,
                         java.lang.String name,
                         java.util.List<? extends java.lang.Object> value,
                         java.util.List<? extends 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

getValues

public java.util.List<? extends java.lang.Object> getValues()
Gets value of attribute.

Returns:
value of attribute

getDefaultValues

public java.util.List<? extends java.lang.Object> getDefaultValues()
Gets default value of attribute.

Returns:
default value of attribute

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.