public class AbstractObjectKey extends java.lang.Object implements java.io.Serializable, java.lang.Comparable<AbstractObjectKey>, BinarySerializable, java.lang.Cloneable
Modifier | Constructor and Description |
---|---|
protected |
AbstractObjectKey(BinaryInput input,
BinarySerializator serializator)
Creates a new instance of AbstractObjectKey loaded from binary input.
|
|
AbstractObjectKey(java.lang.String locatorURI)
Creates a new instance of AbstractObjectKey given the locator URI.
|
Modifier and Type | Method and Description |
---|---|
int |
binarySerialize(BinaryOutput output,
BinarySerializator serializator)
Binary-serialize this object into the
output . |
AbstractObjectKey |
clone(java.lang.String locatorURI)
Returns a copy of this key with the given locator URI.
|
int |
compareTo(AbstractObjectKey o)
Compare the keys according to their locators.
|
static <T extends AbstractObjectKey> |
create(java.lang.Class<? extends T> keyClass,
java.lang.String keyData)
Factory method for creating object key instances of arbitrary class.
|
boolean |
equals(java.lang.Object obj)
Returns whether this key is equal to the
obj . |
int |
getBinarySize(BinarySerializator serializator)
Returns the exact size of the binary-serialized version of this object in bytes.
|
static java.lang.String |
getKeyStringPart(java.lang.String keyString,
java.lang.String delimiter,
int partIndex)
Auxiliary method for retrieving a part of a more complex abstract key string-representation value.
|
java.lang.String |
getLocatorURI()
Returns the URI from this key as a string.
|
int |
hashCode()
Return the hashCode of the locator URI or 0, if it is null.
|
java.lang.String |
toString()
Returns the URI string.
|
void |
write(java.io.OutputStream stream)
Writes this object key into the output text stream.
|
protected void |
writeData(java.io.OutputStream stream)
Store this key's data to a text stream.
|
public AbstractObjectKey(java.lang.String locatorURI)
locatorURI
- the URI locatorprotected AbstractObjectKey(BinaryInput input, BinarySerializator serializator) throws java.io.IOException
input
- the input to read the AbstractObjectKey fromserializator
- the serializator used to write objectsjava.io.IOException
- if there was an I/O error reading from the inputpublic static <T extends AbstractObjectKey> T create(java.lang.Class<? extends T> keyClass, java.lang.String keyData)
String
argument.T
- the class of created the object keykeyClass
- the class of created the object keykeyData
- the data from which to create the keypublic static java.lang.String getKeyStringPart(java.lang.String keyString, java.lang.String delimiter, int partIndex) throws java.lang.IndexOutOfBoundsException, java.lang.IllegalArgumentException
keyString
- string of the string-representationdelimiter
- delimiter used to separate the partspartIndex
- zero-based index of the part to returnjava.lang.IndexOutOfBoundsException
- is thrown if the requested index is not presentjava.lang.IllegalArgumentException
- if the specified keyString, delimiter or partIndex are invalidpublic java.lang.String getLocatorURI()
public final void write(java.io.OutputStream stream) throws java.io.IOException
#objectKey keyClass key value
stream
- the stream to write the key tojava.io.IOException
- if any problem occures during comment writingprotected void writeData(java.io.OutputStream stream) throws java.io.IOException
stream
- the stream to store this object tojava.io.IOException
- if there was an error while writing to streampublic int compareTo(AbstractObjectKey o)
compareTo
in interface java.lang.Comparable<AbstractObjectKey>
o
- the key to compare this key withpublic int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
obj
.
It is only and only if the obj
is descendant of
AbstractObjectKey
and has an equal locator URI.equals
in class java.lang.Object
obj
- the object to compare this object toobj
argument; false otherwisepublic AbstractObjectKey clone(java.lang.String locatorURI) throws java.lang.CloneNotSupportedException
locatorURI
- the new locator URI for the keyjava.lang.CloneNotSupportedException
- if there was an error cloning this objectpublic java.lang.String toString()
toString
in class java.lang.Object
public int binarySerialize(BinaryOutput output, BinarySerializator serializator) throws java.io.IOException
output
.binarySerialize
in interface BinarySerializable
output
- the output that this object is binary-serialized intoserializator
- the serializator used to write objectsjava.io.IOException
- if there was an I/O error during serializationpublic int getBinarySize(BinarySerializator serializator)
getBinarySize
in interface BinarySerializable
serializator
- the serializator used to write objects