org.qtitools.qti.attribute
Interface Attribute
- All Superinterfaces:
- java.io.Serializable, Validatable
- All Known Subinterfaces:
- EnumerateAttribute
- All Known Implementing Classes:
- AbstractAttribute, BaseTypeAttribute, BooleanAttribute, CardinalityAttribute, CoordsAttribute, DateAttribute, DurationAttribute, FloatAttribute, FloatMultipleAttribute, IdentifierAttribute, IdentifierMultipleAttribute, IntegerAttribute, LongAttribute, MultipleAttribute, NavigationModeAttribute, OrientationAttribute, ParamTypeAttribute, RoundingModeAttribute, SessionStatusAttribute, ShapeAttribute, SingleAttribute, SingleValueAttribute, StringAttribute, StringMultipleAttribute, SubmissionModeAttribute, TableCellScopeAttribute, TestFeedbackAccessAttribute, TextFormatAttribute, ToleranceModeAttribute, UriAttribute, ViewMultipleAttribute, VisibilityModeAttribute
public interface Attribute
- extends Validatable
Node's attribute interface.
- Author:
- Jiri Kajaba
|
Method Summary |
java.lang.String |
defaultValueToString()
Gets attribute's defaultValue converted to string. |
java.lang.String |
getFullName()
Gets full name of attribute (full path from root node up to node's parent and node's name). |
java.lang.String |
getLoadedValue()
Gets loaded attribute's value. |
QTIParseException |
getLoadingProblem()
Gets parse exception (if there were problem while loading) or null. |
java.lang.String |
getName()
Gets name of attribute. |
XmlNode |
getParent()
Gets parent node of attribute. |
boolean |
isRequired()
Returns true if attribute is mandatory; false otherwise (attribute is optional). |
boolean |
isSupported()
Returns true if attribute is supported; false otherwise (attribute is not supported). |
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. |
void |
setSupported(boolean supported)
Sets whenever this attribute is supported or not. |
java.lang.String |
toXmlString(boolean printDefaultValue)
Gets attribute converted to string (name="value"). |
java.lang.String |
valueToString()
Gets attribute's value converted to string. |
getParent
XmlNode getParent()
- Gets parent node of attribute.
- Returns:
- parent node of attribute
getName
java.lang.String getName()
- Gets name of attribute.
- Returns:
- name of attribute
getFullName
java.lang.String getFullName()
- Gets full name of attribute (full path from root node up to node's parent and node's name).
- Returns:
- full name of attribute (full path from root node up to node's parent and node's name)
isRequired
boolean isRequired()
- Returns true if attribute is mandatory; false otherwise (attribute is optional).
- Returns:
- true if attribute is mandatory; false otherwise (attribute is optional)
isSupported
boolean isSupported()
- Returns true if attribute is supported; false otherwise (attribute is not supported).
This approach enables to load test even if there are unknown (not supported) attributes.
- Returns:
- true if attribute is supported; false otherwise (attribute is not supported)
setSupported
void setSupported(boolean supported)
- Sets whenever this attribute is supported or not.
- Parameters:
supported - if true this attribute is supported; otherwise this attribute is unsupported
load
void load(org.w3c.dom.Node node)
- 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
void load(java.lang.String value)
- Loads attribute's value from given source string.
Source string must contain only attribute's value, nothing else.
- Parameters:
value - source string
getLoadedValue
java.lang.String getLoadedValue()
- Gets loaded attribute's value.
If attribute has not string baseType loaded value can be different from value.
For example if we have integer attribute, loaded value is a10, but value is null (a10 is not valid integer).
This approach enables to load test even if there are errors.
- Returns:
- loaded attribute's value
getLoadingProblem
QTIParseException getLoadingProblem()
- Gets parse exception (if there were problem while loading) or null.
- Returns:
- parse exception (if there were problem while loading) or null
toXmlString
java.lang.String toXmlString(boolean printDefaultValue)
- Gets attribute converted to string (name="value").
If value is not defined or is same as defaultValue (and printDefaultValue is false),
returns empty (but not null) string.
- Parameters:
printDefaultValue - if true, default value is printed; otherwise default value is not printed
- Returns:
- attribute converted to string (name="value")
valueToString
java.lang.String valueToString()
- 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
java.lang.String defaultValueToString()
- 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.