Class Author

  • All Implemented Interfaces:
    XMLSerializable, java.lang.Comparable

    public final class Author
    extends java.lang.Object
    implements java.lang.Comparable, XMLSerializable
    A class holding one author name.
    • Constructor Summary

      Constructors 
      Constructor Description
      Author()
      Constructs an author with no properties
      Author​(java.lang.String firstName, java.lang.String initials, java.lang.String surname)
      Constructs an author with first name, initials and surname.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(java.lang.Object o)  
      void fromXML​(org.jdom.Element element)
      Restore the object from the JDOM Element returned by XMLSerializable.toXML().
      java.lang.String getFirstName()
      Returns the first name of the author.
      java.lang.String getInitials()
      Returns the initials of the author.
      java.lang.String getSurname()
      Returns the surname of the author.
      void setFirstName​(java.lang.String firstName)
      Sets the first name of the author.
      void setInitials​(java.lang.String initials)
      Sets the initials of the author.
      void setSurname​(java.lang.String surname)
      Sets the surname of the author.
      java.lang.String toCompactString()
      Returns the same value as toString().
      java.lang.String toString()  
      org.jdom.Element toXML()
      Convert object to a JDOM element.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Author

        public Author()
        Constructs an author with no properties
      • Author

        public Author​(java.lang.String firstName,
                      java.lang.String initials,
                      java.lang.String surname)
        Constructs an author with first name, initials and surname.
        Parameters:
        firstName - the author's first name
        initials - the author's initials
        surname - the author's surname
    • Method Detail

      • getSurname

        public java.lang.String getSurname()
        Returns the surname of the author.
        Returns:
        the author's surname
      • setSurname

        public void setSurname​(java.lang.String surname)
        Sets the surname of the author.
        Parameters:
        surname - the author's surname
      • getFirstName

        public java.lang.String getFirstName()
        Returns the first name of the author.
        Returns:
        the author's first name
      • setFirstName

        public void setFirstName​(java.lang.String firstName)
        Sets the first name of the author.
        Parameters:
        firstName - the author's first name
      • getInitials

        public java.lang.String getInitials()
        Returns the initials of the author.
        Returns:
        the author's initials
      • setInitials

        public void setInitials​(java.lang.String initials)
        Sets the initials of the author.
        Parameters:
        initials - the author's initials
      • compareTo

        public int compareTo​(java.lang.Object o)
        Specified by:
        compareTo in interface java.lang.Comparable
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • toCompactString

        public java.lang.String toCompactString()
        Returns the same value as toString().
        Returns:
        the same as toString()
      • toXML

        public org.jdom.Element toXML()
        Description copied from interface: XMLSerializable
        Convert object to a JDOM element. The representation should be complete so that XMLSerializable.fromXML(org.jdom.Element) can completely restore the object's 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.

        Specified by:
        toXML in interface XMLSerializable
        Returns:
        object encoded as a JDOM element
      • fromXML

        public void fromXML​(org.jdom.Element element)
                     throws XMLSerializationException
        Description copied from interface: XMLSerializable
        Restore the object from the JDOM Element returned by XMLSerializable.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().

        Specified by:
        fromXML in interface XMLSerializable
        Parameters:
        element - representation from a previous call to XMLSerializable.toXML()
        Throws:
        XMLSerializationException - if the Element can't be converted into this type of object