JXTA

net.jxta.codat
Class CodatID

java.lang.Object
  extended by net.jxta.id.ID
      extended by net.jxta.codat.CodatID
All Implemented Interfaces:
Serializable

public abstract class CodatID
extends ID

An identifier that enables canonical references to be made to a Codat within the context of a specific peer group.

A CodatID is formed by the conjuction of:

Codats which contain static content will normally include the hash value as part of their CodatID.

See Also:
Codat, PeerGroupID, Serialized Form

Field Summary
 
Fields inherited from class net.jxta.id.ID
nullID, URIEncodingName, URNNamespace
 
Constructor Summary
CodatID()
           
 
Method Summary
static CodatID create(URI fromURI)
          Creates an ID by parsing the given URI.
abstract  ID getPeerGroupID()
          Returns PeerGroupID of the Peer Group to which this Codat ID belongs.
 CodatID intern()
          Returns a canonical representation for the ID object.
abstract  boolean isStatic()
          Returns true if this CodatID is associated with a static Codat.
 
Methods inherited from class net.jxta.id.ID
getIDFormat, getUniqueValue, getURL, toString, toURI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CodatID

public CodatID()
Method Detail

create

public static CodatID create(URI fromURI)
Creates an ID by parsing the given URI.

This convenience factory method works as if by invoking the IDFactory.fromURI(URI) method; any URISyntaxException thrown is caught and wrapped in a new IllegalArgumentException object, which is then thrown.

This method is provided for use in situations where it is known that the given string is a legal ID, for example for ID constants declared within in a program, and so it would be considered a programming error for the URI not to parse as such. The IDFactory, which throws URISyntaxException directly, should be used situations where a ID is being constructed from user input or from some other source that may be prone to errors.

Parameters:
fromURI - The URI to be parsed into an ID
Returns:
The new ID
Throws:
NullPointerException - If fromURI is null.
IllegalArgumentException - If the given URI is not a valid ID.

intern

public CodatID intern()
Returns a canonical representation for the ID object.

A pool of IDs, is maintained privately by the class.

When the intern() method is invoked, if the pool already contains a ID equal to this ID object as determined by the equals(Object) method, then the ID from the pool is returned. Otherwise, this ID object is added to the pool and a reference to this ID object is returned.

It follows that for any two ID s and t, s.intern() == t.intern() is true if and only if s.equals(t) is true.

Overrides:
intern in class ID
Returns:
a ID that has the same value as this type, but is guaranteed to be from a pool of unique types.

getPeerGroupID

public abstract ID getPeerGroupID()
Returns PeerGroupID of the Peer Group to which this Codat ID belongs.

Returns:
PeerGroupID of the Peer Group which this ID is part of.

isStatic

public abstract boolean isStatic()
Returns true if this CodatID is associated with a static Codat.

Returns:
true if the codatId is for a Codat with static content otherwise false.

JXSE