SPT Core API

com.sptci.jpa
Class NameDescription

java.lang.Object
  extended by com.sptci.jpa.JPAObject
      extended by com.sptci.jpa.NameDescription
All Implemented Interfaces:
Serializable, Cloneable, Comparable<JPAObject>

public abstract class NameDescription
extends JPAObject

A JavaBean that represents a simple name and description pair. This may be used as the base class for a number of data types that represent similar data. This object will be enhanced by a JDO byte code enhancer to convert into a persistence aware object.

© Copyright 2007, Sans Pareil Technologies, Inc.

Version:
$Id: NameDescription.java 4853 2009-08-10 21:10:14Z rakesh $
Author:
Rakesh Vidyadharan 2007-05-24
See Also:
Serialized Form

Field Summary
protected  String description
          A textual description for the name.
protected  String name
          The name fulfilled by the person.
 
Fields inherited from class com.sptci.jpa.JPAObject
hash, HASH, logger, oid, startLetter
 
Constructor Summary
protected NameDescription()
          Default constructor.
  NameDescription(String name)
          Create a new instance of the class with the specified values.
  NameDescription(String name, String description)
          Create a new instance of the class with the specified values.
 
Method Summary
 int compareTo(JPAObject object)
          Compares this object with the specified object for order.
protected static XStream createXStream()
          Return the utility used to convert the object to and from XML representation.
 boolean equals(Object object)
          Compare the specified object with this object for equality.
 String getDescription()
          Returns description.
 String getName()
          Returns name.
 int hashCode()
          Return a hash code for this object.
 void setDescription(String description)
          Set description.
 void setName(String name)
          Set name.
 
Methods inherited from class com.sptci.jpa.JPAObject
clone, fromXML, getObjectId, getStartLetter, jdoPostLoad, jdoPreDelete, jdoPreStore, resetHash, toString, toXML
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected String name
The name fulfilled by the person.


description

protected String description
A textual description for the name.

Constructor Detail

NameDescription

protected NameDescription()
Default constructor.


NameDescription

public NameDescription(String name)
Create a new instance of the class with the specified values. Calls NameDescription( String, String ) with a value of null for description.

Parameters:
name - The name value to set.

NameDescription

public NameDescription(String name,
                       String description)
Create a new instance of the class with the specified values.

Parameters:
name - The name value to set.
description - The description value to set.
Method Detail

createXStream

protected static XStream createXStream()
Return the utility used to convert the object to and from XML representation. This method must be used by the JPAObject.toXML() and JPAObject.fromXML(java.lang.String) methods to initialise the serialiser in a standard manner.

Returns:
The serialiser for the class.

equals

public boolean equals(Object object)
Compare the specified object with this object for equality. Returns true if the specified object is of the same type as this object, and the values of all the fields match.

Overrides:
equals in class JPAObject
Parameters:
object - The object that is to compared with this object.
Returns:
boolean Returns true if the objects have the same field values.

hashCode

public int hashCode()
Return a hash code for this object. Returns a hash code derived from the class fields.

Overrides:
hashCode in class JPAObject
Returns:
The hash code for this object.

compareTo

public int compareTo(JPAObject object)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Compare the values of name

Specified by:
compareTo in interface Comparable<JPAObject>
Overrides:
compareTo in class JPAObject
Parameters:
object - The object that is to be compared with this object.
Returns:
int A negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

getName

public String getName()
Returns name.

Returns:
String The value/reference of/to name.

setName

public void setName(String name)
Set name.

Parameters:
name - The value to set.

getDescription

public String getDescription()
Returns description.

Returns:
String The value/reference of/to description.

setDescription

public void setDescription(String description)
Set description.

Parameters:
description - The value to set.

SPT Core API