org.purl.sword.base
Class BasicContentElement

java.lang.Object
  extended by org.purl.sword.base.XmlElement
      extended by org.purl.sword.base.BasicContentElement
All Implemented Interfaces:
SwordElementInterface
Direct Known Subclasses:
BasicBooleanContentElement, BasicIntegerContentElement, BasicStringContentElement

public abstract class BasicContentElement
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, DATE_FORMATS, xmlName
 
Constructor Summary
BasicContentElement(String prefix, String name, String namespaceUri)
           
BasicContentElement(XmlName name)
           
 
Method Summary
protected abstract  String getContentAsString()
           
 nu.xom.Element marshall()
          Marshal the data in this object to an Element object.
protected abstract  void marshallContent(nu.xom.Element element)
           
 void unmarshall(nu.xom.Element element)
          Unmarshall the data in the specified element and store it in the object.
 SwordValidationInfo unmarshall(nu.xom.Element element, Properties validationProperties)
          Unmarshal the text element into this object.
protected abstract  void unmarshallContent(nu.xom.Element element)
           
protected  SwordValidationInfo validate(List<SwordValidationInfo> existing, List<SwordValidationInfo> attributeItems, Properties validationContext)
           
 SwordValidationInfo validate(Properties validationContext)
           
protected abstract  SwordValidationInfo validateContent(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, toString, wait, wait, wait
 

Constructor Detail

BasicContentElement

public BasicContentElement(String prefix,
                           String name,
                           String namespaceUri)

BasicContentElement

public BasicContentElement(XmlName name)
Method Detail

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.

marshallContent

protected abstract void marshallContent(nu.xom.Element element)

unmarshall

public SwordValidationInfo unmarshall(nu.xom.Element element,
                                      Properties validationProperties)
                               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.

Parameters:
element - The text element.
validationProperties -
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 void unmarshall(nu.xom.Element element)
                throws UnmarshallException
Description copied from interface: SwordElementInterface
Unmarshall the data in the specified element and store it in the object.

Specified by:
unmarshall in interface SwordElementInterface
Parameters:
element - The data to unmarshall.
Throws:
UnmarshallException - If the element is not of the correct type, or if there is an error unmarshalling the data.

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:

unmarshallContent

protected abstract void unmarshallContent(nu.xom.Element element)
                                   throws UnmarshallException
Throws:
UnmarshallException

validateContent

protected abstract SwordValidationInfo validateContent(Properties validationContext)

getContentAsString

protected abstract String getContentAsString()


Copyright © 2013 DuraSpace. All Rights Reserved.