public final class Author extends Object implements Comparable, XMLSerializable
XMLSerializable.OldVersionCompatible, XMLSerializable.VersionSupportTypeROOT_ELEMENT_NAME| Constructor and Description |
|---|
Author()
Constructs an author with no properties
|
Author(String firstName,
String initials,
String surname)
Constructs an author with first name, initials and surname.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Object o) |
void |
fromXML(org.jdom.Element element)
Restore the object from the JDOM Element returned by
XMLSerializable.toXML(). |
String |
getFirstName()
Returns the first name of the author.
|
String |
getInitials()
Returns the initials of the author.
|
String |
getSurname()
Returns the surname of the author.
|
void |
setFirstName(String firstName)
Sets the first name of the author.
|
void |
setInitials(String initials)
Sets the initials of the author.
|
void |
setSurname(String surname)
Sets the surname of the author.
|
String |
toCompactString()
Returns the same value as
toString(). |
String |
toString() |
org.jdom.Element |
toXML()
Convert object to a JDOM element.
|
public String getSurname()
public void setSurname(String surname)
surname - the author's surnamepublic String getFirstName()
public void setFirstName(String firstName)
firstName - the author's first namepublic String getInitials()
public void setInitials(String initials)
initials - the author's initialspublic int compareTo(Object o)
compareTo in interface Comparablepublic String toCompactString()
toString().toString()public org.jdom.Element toXML()
XMLSerializableXMLSerializable.fromXML(org.jdom.Element) can completely
restore the objects representation.
It is recommended that the returned element use XMLSerializable.ROOT_ELEMENT_NAME as its name,
in which case it must not define an attribute called "type". In this case,
fromXML, will be called with an element whose name may differ from the element
return from this function. This recommendation allows a more compact representation
of the XML can be stored.
This method generally should not be called directly. Instead, you should usually call
XMLSerializer.classToXML(String, XMLSerializable)
which calls this method internally.
PluginDocument implementations of this method may choose to throw an XMLSerializationException,
enclosed in a RuntimeException.toXML in interface XMLSerializablepublic void fromXML(org.jdom.Element element)
throws XMLSerializationException
XMLSerializableXMLSerializable.toXML().
This method generally should not be called directly. Instead, you should usually call
XMLSerializer.classFromXML(org.jdom.Element)
or XMLSerializer.classFromXML(org.jdom.Element, Class)
which calls this method internally.
It is optional to implement this method. Instead of implementing an empty constructor and implementing
this method properly, the implementation may instead
throw an UnsupportedOperationException and implement a constructor
that takes a single Element as a parameter.
This allows for cleaner code such as support for final fields in the XMLSerializable class.
The element parameter should not be modified since it may be reused. If you need a modified version of it,
take a copy with Element.clone().fromXML in interface XMLSerializableelement - representation from a previous call to XMLSerializable.toXML()XMLSerializationException - if the Element can't be converted into this type of object