org.w3.atom
Class TextConstruct

java.lang.Object
  extended by org.purl.sword.base.XmlElement
      extended by org.w3.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
 
Fields inherited from class org.purl.sword.base.XmlElement
DATE_FORMAT, localName, prefix
 
Constructor Summary
TextConstruct(String name)
          Create a new instance.
TextConstruct(String prefix, String name)
          Create a new instance, specifying the prefix and local name.
 
Method Summary
 String getContent()
          Get the content in this TextConstruct.
 ContentType getType()
          Get the type.
 nu.xom.Element marshall()
          Marshall the data in this object to an Element object.
 void setContent(String content)
          Set the content.
 void setType(ContentType type)
          Set the type.
 void unmarshall(nu.xom.Element text)
          Unmarshall the text element into this object.
 
Methods inherited from class org.purl.sword.base.XmlElement
dateToString, getQualifiedName, getQualifiedName, isInstanceOf, stringToDate, unmarshallBoolean, unmarshallDate, unmarshallInteger, unmarshallString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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.
Method Detail

marshall

public nu.xom.Element marshall()
Marshall 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
Unmarshall 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.

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.


Copyright © 2008 The DSpace Foundation. All Rights Reserved.