org.purl.sword.atom
Class TextConstruct

java.lang.Object
  extended by org.purl.sword.base.XmlElement
      extended by org.purl.sword.atom.TextConstruct
All Implemented Interfaces:
SwordElementInterface
Direct Known Subclasses:
Rights, Summary, Title

public class TextConstruct
extends XmlElement
implements SwordElementInterface

Represents a text construct in the ATOM elements. This is a superclass of several elements within this implementation.

Author:
Neil Taylor

Field Summary
static String ATTRIBUTE_TYPE
          label for the type attribute.
 
Fields inherited from class org.purl.sword.base.XmlElement
DATE_FORMAT, DATE_FORMATS, xmlName
 
Constructor Summary
TextConstruct(String name)
          Create a new instance.
TextConstruct(String prefix, String name)
          Create a new instance, specifying the prefix and local name.
TextConstruct(String prefix, String name, String namespaceUri)
           
TextConstruct(XmlName name)
          Create a new instance.
 
Method Summary
 String getContent()
          Get the content in this TextConstruct.
 ContentType getType()
          Get the type.
protected  void initialise()
           
 nu.xom.Element marshall()
          Marshal the data in this object to an Element object.
 void setContent(String content)
          Set the content.
 void setType(ContentType type)
          Set the type.
 String toString()
          Get a string representation.
 void unmarshall(nu.xom.Element text)
          Unmarshal the text element into this object.
 SwordValidationInfo unmarshall(nu.xom.Element text, Properties validationProperties)
           
protected  SwordValidationInfo validate(List<SwordValidationInfo> existing, List<SwordValidationInfo> attributeItems, Properties validationContext)
           
 SwordValidationInfo validate(Properties validationContext)
           
 
Methods inherited from class org.purl.sword.base.XmlElement
createValidAttributeInfo, getQualifiedName, getQualifiedName, getQualifiedNameWithPrefix, getXmlName, handleIncorrectElement, isInstanceOf, isInstanceOf, processUnexpectedAttributes, processUnexpectedAttributes, unmarshallBoolean, unmarshallInteger, unmarshallString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ATTRIBUTE_TYPE

public static final String ATTRIBUTE_TYPE
label for the type attribute.

See Also:
Constant Field Values
Constructor Detail

TextConstruct

public TextConstruct(String prefix,
                     String name)
Create a new instance, specifying the prefix and local name.

Parameters:
prefix - The prefix.
name - The local name.

TextConstruct

public TextConstruct(String name)
Create a new instance. Set the default type to TextConstructType.TEXT.

Parameters:
name - The name that will be applied.

TextConstruct

public TextConstruct(XmlName name)
Create a new instance. Set the XML name for the element.

Parameters:
name - The name to set.

TextConstruct

public TextConstruct(String prefix,
                     String name,
                     String namespaceUri)
Parameters:
prefix -
name -
namespaceUri -
Method Detail

initialise

protected final void initialise()

marshall

public nu.xom.Element marshall()
Marshal the data in this object to an Element object.

Specified by:
marshall in interface SwordElementInterface
Returns:
The data expressed in an Element.

unmarshall

public void unmarshall(nu.xom.Element text)
                throws UnmarshallException
Unmarshal the text element into this object. This unmarshaller only handles plain text content, although it can recognise the three different type elements of text, html and xhtml. This is an area that can be improved in a future implementation, if necessary.

Specified by:
unmarshall in interface SwordElementInterface
Parameters:
text - The text element.
Throws:
UnmarshallException - If the specified element is not of the correct type, where the localname is used to specify the valid name. Also thrown if there is an issue accessing the data.

unmarshall

public SwordValidationInfo unmarshall(nu.xom.Element text,
                                      Properties validationProperties)
                               throws UnmarshallException
Parameters:
text -
validationProperties -
Returns:
Throws:
UnmarshallException

validate

public SwordValidationInfo validate(Properties validationContext)
Specified by:
validate in class XmlElement

validate

protected SwordValidationInfo validate(List<SwordValidationInfo> existing,
                                       List<SwordValidationInfo> attributeItems,
                                       Properties validationContext)
Parameters:
existing -
attributeItems -
Returns:

getContent

public String getContent()
Get the content in this TextConstruct.

Returns:
The content, expressed as a string.

setContent

public void setContent(String content)
Set the content. This only supports text content.

Parameters:
content - The content.

getType

public ContentType getType()
Get the type.

Returns:
The type.

setType

public void setType(ContentType type)
Set the type.

Parameters:
type - The type.

toString

public String toString()
Get a string representation.

Overrides:
toString in class Object
Returns:
The string.


Copyright © 2011 DuraSpace. All Rights Reserved.