org.purl.sword.atom
Class Content

java.lang.Object
  extended by org.purl.sword.base.XmlElement
      extended by org.purl.sword.atom.Content
All Implemented Interfaces:
SwordElementInterface

public class Content
extends XmlElement
implements SwordElementInterface

Represents an ATOM Content element.

Author:
Neil Taylor

Field Summary
static String ATTRIBUTE_SRC
          The identifier for the src attribute.
static String ATTRIBUTE_TYPE
          The identifier for the type attribute.
 
Fields inherited from class org.purl.sword.base.XmlElement
DATE_FORMAT, DATE_FORMATS, xmlName
 
Constructor Summary
Content()
          Create a new instance and set the prefix to 'atom' and the local name to 'content'.
 
Method Summary
static XmlName elementName()
           
 String getSource()
          Get the Source.
 String getType()
          Get the type.
 nu.xom.Element marshall()
          Marshall the data in this object to an Element object.
 void setSource(String source)
          Set the Source.
 void setType(String type)
          Set the type for the content.
 String toString()
          Get a string representation.
 void unmarshall(nu.xom.Element content)
          Unmarshall the data in the specified element and store it in the object.
 SwordValidationInfo unmarshall(nu.xom.Element content, Properties validationProperties)
          Unmarshall the content element into the data in this object.
protected  SwordValidationInfo validate(List<SwordValidationInfo> elements, List<SwordValidationInfo> attributes, 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_SRC

public static final String ATTRIBUTE_SRC
The identifier for the src attribute.

See Also:
Constant Field Values

ATTRIBUTE_TYPE

public static final String ATTRIBUTE_TYPE
The identifier for the type attribute.

See Also:
Constant Field Values
Constructor Detail

Content

public Content()
Create a new instance and set the prefix to 'atom' and the local name to 'content'.

Method Detail

elementName

public static XmlName elementName()

getSource

public String getSource()
Get the Source.

Returns:
The Source.

setSource

public void setSource(String source)
Set the Source.

Parameters:
source - The source.

getType

public String getType()
Get the type.

Returns:
The type.

setType

public void setType(String type)
             throws InvalidMediaTypeException
Set the type for the content. This should match the pattern ".* /.*" [Note, there is no space before the /, this has been added to allow this text to be written in a Java comment.]. An example of the type is application/zip.

Parameters:
type - The specified type.
Throws:
InvalidMediaTypeException - If the specified type is null or it does not match the specified pattern.

marshall

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

Specified by:
marshall in interface SwordElementInterface
Returns:
A XOM Element that holds the data for this Content element.

unmarshall

public void unmarshall(nu.xom.Element content)
                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:
content - The data to unmarshall.
Throws:
UnmarshallException - If the element is not of the correct type, or if there is an error unmarshalling the data.

unmarshall

public SwordValidationInfo unmarshall(nu.xom.Element content,
                                      Properties validationProperties)
                               throws UnmarshallException
Unmarshall the content element into the data in this object.

Throws:
UnmarshallException - If the element does not contain a content element or if there are problems accessing the data.

validate

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

validate

protected SwordValidationInfo validate(List<SwordValidationInfo> elements,
                                       List<SwordValidationInfo> attributes,
                                       Properties validationContext)
Parameters:
elements -
attributes -
Returns:

toString

public String toString()
Get a string representation.

Overrides:
toString in class Object
Returns:
String


Copyright © 2011 DuraSpace. All Rights Reserved.