things.data
Class Entity<O>

java.lang.Object
  extended by things.data.Entity<O>
All Implemented Interfaces:
java.io.Serializable, Data
Direct Known Subclasses:
RESULT

public class Entity<O>
extends java.lang.Object
implements Data

An entry is with object data and attributes and and has an identity.
The metadata and attributes are immutable, but the object data is not.

Version:
1.0

Version History

EPG - Rewrite from another project - 12 MAY 06
 
Author:
Erich P. Gatejen
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface things.data.Data
Data.Priority, Data.Type
 
Field Summary
 AttributeReader attributes
          Attributes, if needed.
 
Constructor Summary
Entity()
          The default constructor is not allowed.
Entity(int n, Data.Type t, Data.Priority p, O thing, WhoAmI imposedId, WhoAmI creatorId)
          Constructor.
Entity(int n, Data.Type t, Data.Priority p, O thing, WhoAmI imposedId, WhoAmI creatorId, AttributeReader a)
          Constructor.
Entity(int n, Data.Type t, Data.Priority p, O thing, WhoAmI imposedId, WhoAmI creatorId, java.lang.String... a)
          Constructor.
Entity(int n, O thing)
          Constructor.
Entity(int n, O thing, AttributeReader a)
          Constructor.
Entity(int n, O thing, java.lang.String... a)
          Constructor.
 
Method Summary
 WhoAmI birthMyChild(java.lang.String childsName)
          Create a child ID using the given name.
 WhoAmI birthMyChild(java.lang.String childsName, java.lang.String childsTag)
          Create a child ID using the given name and tag.
 AttributeReader getAttributes()
          Get the attributes.
 WhoAmI getCreatorID()
          Get the creator's ID.
 WhoAmI getID()
          Get the objects ID.
 int getNumeric()
          Get the numeric value.
 java.lang.String getNumericString()
          Get the numeric value.
 Data.Priority getPriority()
          Get the priority.ed.
 long getStamp()
          Get the timestamp.
 java.lang.Object getThing()
          Get the thing (Object).
 Data.Type getType()
          Get the type.
 O getTypedThing()
          Get the thing (Object).
 java.lang.String toString()
          Give a textual representation of the data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

attributes

public AttributeReader attributes
Attributes, if needed.

Constructor Detail

Entity

public Entity()
       throws java.lang.Throwable
The default constructor is not allowed.

Throws:
java.lang.Throwable

Entity

public Entity(int n,
              O thing)
Constructor. Sets everything but the text, priority, and the numeric.

Parameters:
n - the numeric
thing - The thing to keep

Entity

public Entity(int n,
              O thing,
              AttributeReader a)
       throws ThingsException
Constructor. Sets everything but the text, priority, and the numeric.

Parameters:
n - the numeric
thing - The thing to keep.
a - attributes. This cannot be null.
Throws:
ThingsException
See Also:
AttributeReader

Entity

public Entity(int n,
              O thing,
              java.lang.String... a)
       throws ThingsException
Constructor. Sets everything but the text, priority, and the numeric.

Parameters:
n - the numeric
thing - The thing to keep.
a - attributes in name value pairs. This cannot be null.
Throws:
ThingsException
See Also:
AttributeReader

Entity

public Entity(int n,
              Data.Type t,
              Data.Priority p,
              O thing,
              WhoAmI imposedId,
              WhoAmI creatorId)
       throws ThingsException
Constructor. Sets everything except attributes. Note, if either WhoAmI is null, they will be stuffed with a Nobody id.

Parameters:
n - the numeric
t - the type
p - the priority
thing - The thing to keep
imposedId - The id of the new Entity.
creatorId - The if of the caller (or other creator).
Throws:
ThingsException
See Also:
AttributeReader, WhoAmI, IAmNobody

Entity

public Entity(int n,
              Data.Type t,
              Data.Priority p,
              O thing,
              WhoAmI imposedId,
              WhoAmI creatorId,
              AttributeReader a)
       throws ThingsException
Constructor. Sets everything. Note, if either WhoAmI is null, they will be stuffed with a Nobody id.

Parameters:
n - the numeric
t - the type
p - the priority
thing - The thing to keep
imposedId - The id of the new Entity.
creatorId - The if of the caller (or other creator).
a - attributes. This cannot be null.
Throws:
ThingsException
See Also:
AttributeReader, WhoAmI, IAmNobody

Entity

public Entity(int n,
              Data.Type t,
              Data.Priority p,
              O thing,
              WhoAmI imposedId,
              WhoAmI creatorId,
              java.lang.String... a)
       throws ThingsException
Constructor. Sets everything. Note, if either WhoAmI is null, they will be stuffed with a Nobody id.

Parameters:
n - the numeric
t - the type
p - the priority
thing - The thing to keep
imposedId - The id of the new Entity.
creatorId - The if of the caller (or other creator).
a - attributes in name value pairs. This cannot be null.
Throws:
ThingsException
See Also:
AttributeReader, WhoAmI, IAmNobody
Method Detail

getTypedThing

public O getTypedThing()
Get the thing (Object).

Returns:
the thing

birthMyChild

public WhoAmI birthMyChild(java.lang.String childsName)
Create a child ID using the given name.

Specified by:
birthMyChild in interface Data
Parameters:
childsName - the given name for the child.
Returns:
the textual representation of the ID.
See Also:
WhoAmI

birthMyChild

public WhoAmI birthMyChild(java.lang.String childsName,
                           java.lang.String childsTag)
Create a child ID using the given name and tag. It must yield the same ID if the same value is used for childsName.

Specified by:
birthMyChild in interface Data
Parameters:
childsName - the given name for the child.
childsTag - the tag for the child.
Returns:
the id
See Also:
WhoAmI

toString

public java.lang.String toString()
Give a textual representation of the data.

Specified by:
toString in interface Data
Overrides:
toString in class java.lang.Object
Returns:
the textual representation.

getID

public WhoAmI getID()
Get the objects ID.

Specified by:
getID in interface Data
Returns:
the id
See Also:
WhoAmI

getCreatorID

public WhoAmI getCreatorID()
Get the creator's ID.

Specified by:
getCreatorID in interface Data
Returns:
the id
See Also:
WhoAmI

getNumeric

public int getNumeric()
Get the numeric value. It is completely up to the setter as to what this means.

Specified by:
getNumeric in interface Data
Returns:
value as an int

getNumericString

public java.lang.String getNumericString()
Get the numeric value. It is completely up to the setter as to what this means.

Specified by:
getNumericString in interface Data
Returns:
value as a string

getPriority

public Data.Priority getPriority()
Get the priority.ed.

Specified by:
getPriority in interface Data
Returns:
the priority.

getStamp

public long getStamp()
Get the timestamp.

Specified by:
getStamp in interface Data
Returns:
timestamp as a long

getThing

public java.lang.Object getThing()
Get the thing (Object).

Specified by:
getThing in interface Data
Returns:
the thing

getType

public Data.Type getType()
Get the type.

Specified by:
getType in interface Data
Returns:
the type

getAttributes

public AttributeReader getAttributes()
Get the attributes.

Specified by:
getAttributes in interface Data
Returns:
the attributes associated with the Data, if any.


Things.