com.sap.scheduler.runtime

Class AbstractIdentifier

java.lang.Object
  extended by com.sap.scheduler.runtime.AbstractIdentifier
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
JobDefinitionID, JobID, SchedulerID, SchedulerTaskID

public abstract class AbstractIdentifier
extends Object
implements Serializable, Cloneable

XML Serializable

See Also:
Serialized Form

Nested Class Summary
static interface AbstractIdentifier.ConcreteInstanceFactory
          A helper interface.
 
Field Summary
static long serialVersionUID
          Serial Version UID.
 
Constructor Summary
AbstractIdentifier()
           
 
Method Summary
 Object clone()
          Clones this AbstractIdentifier This is a deep copy operation.
 boolean equals(Object other)
          Compares another object to this AbstractIdentifier instance.
 byte[] getBytes()
          Obtains a byte representation of this id.
 int hashCode()
           
protected static AbstractIdentifier parseID(byte[] byteGUID, AbstractIdentifier.ConcreteInstanceFactory cf)
          This is helper method used by ancestor to implement creation of an instance of the given ancestor class from a byte array representation of a guid.
protected static AbstractIdentifier parseID(String stringGUID, AbstractIdentifier.ConcreteInstanceFactory cf)
          This is helper method used by heir to implement creation of an instance of the given heir class from a hex-string representation of a guid.
 void setBytes(byte[] byteGUID)
          This method sets the guid contained in this AbstractIdentifier.
protected  void setBytesNoCloneAndCheck(byte[] byteGUID)
          Sets the byte representation of guid for this identity object.
 String toString()
          Obtains a hex-string representation of this GUID
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

public static final long serialVersionUID
Serial Version UID. Used for enforcing binary compatibility.

See Also:
Constant Field Values
Constructor Detail

AbstractIdentifier

public AbstractIdentifier()
Method Detail

getBytes

public byte[] getBytes()
Obtains a byte representation of this id. The return byte representation is a valid GUID and it can be used to construct a new GUID.

Returns:
- a byte representation of this ID.

clone

public Object clone()
             throws CloneNotSupportedException
Clones this AbstractIdentifier This is a deep copy operation.

Overrides:
clone in class Object
Returns:
the cloned copy.
Throws:
CloneNotSupportedException - - thrown if some clone error occurred. Generally this exception should not be thrown but it's left to allow subclasses to prohibit clonning.

setBytes

public void setBytes(byte[] byteGUID)
              throws IllegalArgumentException
This method sets the guid contained in this AbstractIdentifier.

Parameters:
byteGUID - - a byte array representation of a GUID
Throws:
IllegalArgumentException - - if the byte array does not represent a valid guid.
NullPointerException - - if byteGUID is null.

setBytesNoCloneAndCheck

protected void setBytesNoCloneAndCheck(byte[] byteGUID)
                                throws IllegalStateException
Sets the byte representation of guid for this identity object. This method does not perform any checking on the validity the passed byte array.

Parameters:
byteGUID - - the byte array representation of guid.
Throws:
IllegalStateException - - if this AbstractIdentifier has already been initialized.

equals

public boolean equals(Object other)
Compares another object to this AbstractIdentifier instance. Two abstract identifiers are considered equal if they both contain the same guid.

Overrides:
equals in class Object
Parameters:
other - - the other object to compare to this one.
Returns:
True if the two objects are of the same class and contain the same guid.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Obtains a hex-string representation of this GUID

Overrides:
toString in class Object
Returns:
a hex-string representation of this GUID

parseID

protected static AbstractIdentifier parseID(byte[] byteGUID,
                                            AbstractIdentifier.ConcreteInstanceFactory cf)
This is helper method used by ancestor to implement creation of an instance of the given ancestor class from a byte array representation of a guid.

Parameters:
byteGUID - - a byte array representation of a guid.
cf - - ConcreteInstanceFactory used to create instance of the concrete ancestor.
Returns:
Null if byteGUID is null. Otherwise this method returns the object return by cf.createNotInitialized(), holding the guid represented by byteGUID
Throws:
IllegalStateException - - if the supplied byte array does not contain a valid guid.

parseID

protected static AbstractIdentifier parseID(String stringGUID,
                                            AbstractIdentifier.ConcreteInstanceFactory cf)
This is helper method used by heir to implement creation of an instance of the given heir class from a hex-string representation of a guid.

Parameters:
stringGUID - - a hex-string representation of a guid.
cf - - ConcreteInstanceFactory used to create instance of the concrete heir.
Returns:
Null if stringGUID is null. Otherwise this method returns the object return by cf.createNotInitialized(), holding the guid represented by stringGUID
Throws:
IllegalStateException - - if the supplied hex-string does not contain a valid guid.


Copyright 2009 SAP AG Complete Copyright Notice