JXTA

net.jxta.impl.id.UUID
Class ModuleClassID

java.lang.Object
  extended by net.jxta.id.ID
      extended by net.jxta.platform.ModuleClassID
          extended by net.jxta.impl.id.UUID.ModuleClassID
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ModuleClassID

public class ModuleClassID
extends ModuleClassID

An implementation of the ModuleClassID ID Type.

See Also:
Serialized Form

Field Summary
protected  IDBytes id
          The id data
 
Fields inherited from class net.jxta.id.ID
nullID, URIEncodingName, URNNamespace
 
Constructor Summary
  ModuleClassID()
          See IDFactory.Instantiator.newModuleClassID().
protected ModuleClassID(IDBytes id)
          Constructor.
  ModuleClassID(ModuleClassID classID)
          See IDFactory.Instantiator.newModuleClassID(net.jxta.platform.ModuleClassID).
protected ModuleClassID(UUID classUUID, UUID roleUUID)
          Constructor.
 
Method Summary
 boolean equals(Object target)
          
 ModuleClassID getBaseClass()
          Return a ModuleClassID of the same base class but with the role portion set to zero. aka "the base class".
protected  UUID getClassUUID()
          get the class' unique id
 String getIDFormat()
          Returns a string identifier which indicates which ID format is used by this ID instance.
protected  UUID getRoleUUID()
          get the role unique id
 Object getUniqueValue()
          Returns an object containing the unique value of the ID.
 int hashCode()
          
 boolean isOfSameBaseClass(ModuleClassID classId)
          Returns true if this ModuleClassID is of the same base class than the given class.
 boolean isOfSameBaseClass(ModuleSpecID specId)
          Returns true if this ModuleClassID is of the same class than the the given ModuleSpecID.
 
Methods inherited from class net.jxta.platform.ModuleClassID
create, intern
 
Methods inherited from class net.jxta.id.ID
getURL, toString, toURI
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

id

protected IDBytes id
The id data

Constructor Detail

ModuleClassID

protected ModuleClassID(IDBytes id)
Constructor. Initializes contents from provided ID.

Parameters:
id - the ID data

ModuleClassID

protected ModuleClassID(UUID classUUID,
                        UUID roleUUID)
Constructor. Creates a ModuleClassID in a given class, with a given class unique id. A UUID of a class and another UUID are provided.

Parameters:
classUUID - the class to which this will belong.
roleUUID - the unique id of this role in that class.

ModuleClassID

public ModuleClassID()
See IDFactory.Instantiator.newModuleClassID().

A new class UUID is created. The role ID is left null. This is the only way to create a new class without supplying a new UUID explicitly.

Note that a null role is just as valid as any other, it just has a shorter string representation. So it is not mandatory to create a new role in a new class.


ModuleClassID

public ModuleClassID(ModuleClassID classID)
See IDFactory.Instantiator.newModuleClassID(net.jxta.platform.ModuleClassID).

Method Detail

equals

public boolean equals(Object target)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object

getIDFormat

public String getIDFormat()
Returns a string identifier which indicates which ID format is used by this ID instance.

Specified by:
getIDFormat in class ID
Returns:
a string identifier which indicates which ID format is used by this ID instance.

getUniqueValue

public Object getUniqueValue()
Returns an object containing the unique value of the ID. This object must provide implementations of toString(), equals() and hashCode() that are canonical and consistent from run-to-run given the same input values. Beyond this nothing should be assumed about the nature of this object. For some implementations the object returned may be this.

Specified by:
getUniqueValue in class ID
Returns:
Object which can provide canonical representations of the ID.

getBaseClass

public ModuleClassID getBaseClass()
Return a ModuleClassID of the same base class but with the role portion set to zero. aka "the base class".

Specified by:
getBaseClass in class ModuleClassID
Returns:
ModuleClassID the base class.

isOfSameBaseClass

public boolean isOfSameBaseClass(ModuleClassID classId)
Returns true if this ModuleClassID is of the same base class than the given class. Note: This method is NOT named "isOfClass" because a ModuleClassID may have two UUID; one that denotes a "base" class proper, and an optional second one that denotes a "Role", or subclass. Compatibility between ClassIDs is based on the "base" portion, hence the "isOfSame" naming. This routine can be used for comparison with a base class since a base class is just a class which role portion happens to be zero.

Specified by:
isOfSameBaseClass in class ModuleClassID
Parameters:
classId - Module class id to compare with
Returns:
boolean true if equals

isOfSameBaseClass

public boolean isOfSameBaseClass(ModuleSpecID specId)
Returns true if this ModuleClassID is of the same class than the the given ModuleSpecID.

Specified by:
isOfSameBaseClass in class ModuleClassID
Parameters:
specId - Module spec id to compare with
Returns:
boolean true if equals

getClassUUID

protected UUID getClassUUID()
get the class' unique id

Returns:
UUID module class' unique id

getRoleUUID

protected UUID getRoleUUID()
get the role unique id

Returns:
UUID module role unique id

JXSE