Package cdc.kernel.rids
Class RawId
java.lang.Object
cdc.kernel.rids.RawId
- All Implemented Interfaces:
Comparable<RawId>
RawId (raw identifier) is used to identify an object in a generic way.
It is a kind of global identifier that carries semantic.
It is an immutable (class, id) pair, where class
is the class of the identified object and id its identifier.
RawId is intended for in-memory use.
The sister class RawIdProxy is intended for persistence.
WARNING: Creating a RawId does not means that the corresponding RawIdProxy can be created.
Appropriate class and id converters must exist.
- Author:
- Damien Carbonne
-
Constructor Summary
ConstructorsConstructorDescriptionRawId(RawIdProxy ridp) Creates a RawId from its RawIdProxy.Creates a RawId from an object class and identifier. -
Method Summary
Modifier and TypeMethodDescriptionintstatic RawIdbooleanstatic RawIdfromRawIdProxy(RawIdProxy ridp) getId()<T> TReturns the object identifier converted to a type.Class<?>inthashCode()static RawIdProxytoRawIdProxy(RawId rid) toString()
-
Constructor Details
-
RawId
Creates a RawId from an object class and identifier.WARNING: Compatibility between
objectClassandidis not checked.
WARNING: Conversion to a RawIdProxy is not guaranteed.- Parameters:
objectClass- The object class.id- The identifier.- Throws:
IllegalArgumentException- WhenobjectClassisnull.
-
RawId
Creates a RawId from its RawIdProxy.- Parameters:
ridp- The RawIdProxy.
-
-
Method Details
-
create
-
getObjectClass
- Returns:
- The object class.
-
getObjectClassCode
- Returns:
- The String encoding of object class.
-
getId
- Returns:
- The object identifier (possibly
null).
-
getId
Returns the object identifier converted to a type.- Type Parameters:
T- The conversion type.- Parameters:
type- The conversion class.- Returns:
- The object identifier converted as
type.
-
getIdCode
- Returns:
- The String encoding of the id.
-
hashCode
public int hashCode() -
toRawIdProxy
-
fromRawIdProxy
-
equals
-
compareTo
- Specified by:
compareToin interfaceComparable<RawId>
-
toString
-