org.hd.d.pg2k.svrCore.props
Class GenProps.AuthData

java.lang.Object
  extended by org.hd.d.pg2k.svrCore.props.GenProps.AuthData
All Implemented Interfaces:
java.io.ObjectInputValidation, java.io.Serializable, java.lang.Comparable<GenProps.AuthData>, MemoryTools.Internable
Enclosing class:
GenProps

public static final class GenProps.AuthData
extends java.lang.Object
implements java.io.Serializable, java.io.ObjectInputValidation, java.lang.Comparable<GenProps.AuthData>, MemoryTools.Internable

Class holding details of one author; immutable, serialisable. Author initial must be valid syntactically; text must be 7-bit printable (32--126) ASCII/HTML data.

We assume that the on-the-wire format for members is reasonably efficient, especially if the transport layer includes compression.

This supports equals(), hashCode() and compareTo(); two objects are equal iff all the fields are, and the sort order is by author.

See Also:
Serialized Form

Field Summary
 java.lang.String auth
          Author initials: must be syntactically valid; non-null.
 java.lang.String desc
          Description HTML code as 7-bit ASCII; never empty but can be null.
 java.lang.String email
          Author email: should be syntactically valid email address or null.
static int MAX_DESC_CHARACTERS
          Maximum HTML description length in bytes/characters.
 java.lang.String name
          Author name: must be pure 7-bit printable ASCII HTML with possible entities; not empty, non-null.
private static long serialVersionUID
          Our serialisation version.
 java.lang.String www
          Author home-page URL: should be syntactically valid URL or null.
 
Constructor Summary
GenProps.AuthData(java.lang.String authInitials, java.lang.String pipeDelimitedString)
          Construct new author details from single string.
GenProps.AuthData(java.lang.String authInitials, java.lang.String authName, java.lang.String homePageURL, java.lang.String emailAddress, java.lang.String descriptionText)
          Construct new author details from individial components.
 
Method Summary
private static java.lang.String _getSection(java.lang.String s, int section)
          Extract given section from pipe-delimited String.
 int compareTo(GenProps.AuthData o)
          Provides total ordering, by author.
 boolean equals(java.lang.Object o)
          Equality depends on all fields.
 int hashCode()
          Hash depends on author.
private  void readObject(java.io.ObjectInputStream in)
          Deserialise.
 void validateObject()
          Validate fields/state.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

auth

public final java.lang.String auth
Author initials: must be syntactically valid; non-null.


name

public final java.lang.String name
Author name: must be pure 7-bit printable ASCII HTML with possible entities; not empty, non-null.


www

public final java.lang.String www
Author home-page URL: should be syntactically valid URL or null.


email

public final java.lang.String email
Author email: should be syntactically valid email address or null.


desc

public final java.lang.String desc
Description HTML code as 7-bit ASCII; never empty but can be null.


MAX_DESC_CHARACTERS

public static final int MAX_DESC_CHARACTERS
Maximum HTML description length in bytes/characters.

See Also:
Constant Field Values

serialVersionUID

private static final long serialVersionUID
Our serialisation version.

See Also:
Constant Field Values
Constructor Detail

GenProps.AuthData

GenProps.AuthData(java.lang.String authInitials,
                  java.lang.String pipeDelimitedString)
Construct new author details from single string. The String should be of the form: Real Name|HomePageURL|email|description where any item can be blank except the name.


GenProps.AuthData

GenProps.AuthData(java.lang.String authInitials,
                  java.lang.String authName,
                  java.lang.String homePageURL,
                  java.lang.String emailAddress,
                  java.lang.String descriptionText)
Construct new author details from individial components.

Parameters:
authInitials - the syntactally-valid author initials; non-null
authName - real name of author; not empty nor null
homePageURL - valid http URL, will be stripped, empty text is converted to null
emailAddress - valid email address, will be stripped, empty text is converted to null
descriptionText - the descriptive text, will be stripped, empty text is converted to null Not given public access as only GenProps should need to construct.
Method Detail

equals

public boolean equals(java.lang.Object o)
Equality depends on all fields.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Hash depends on author.

Overrides:
hashCode in class java.lang.Object

compareTo

public int compareTo(GenProps.AuthData o)
Provides total ordering, by author.

Specified by:
compareTo in interface java.lang.Comparable<GenProps.AuthData>

_getSection

private static java.lang.String _getSection(java.lang.String s,
                                            int section)
Extract given section from pipe-delimited String. Skip given number of pipe symbols ("|") then return next up to following one if present. Returns null if section not present.


readObject

private void readObject(java.io.ObjectInputStream in)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException
Deserialise.

Throws:
java.io.IOException
java.lang.ClassNotFoundException

validateObject

public void validateObject()
                    throws java.io.InvalidObjectException
Validate fields/state. Called in the constructor and possibly after de-serialising.

Barf if something bad is found. (Maybe allow some extra info in debug version.)

Specified by:
validateObject in interface java.io.ObjectInputValidation
Throws:
java.io.InvalidObjectException

DHD Multimedia Gallery V1.57.21

Copyright (c) 1996-2011, Damon Hart-Davis. All rights reserved.