com.metamatrix.core.id
Interface ObjectIDFactory

All Known Implementing Classes:
IntegerIDFactory, LongIDFactory, StringIDFactory, TransactionIDFactory, UUIDFactory

public interface ObjectIDFactory

The ObjectIDDescriptor defines the interface that is used to describe a particular type of ObjectID.


Method Summary
 ObjectID create()
          Create a new GlobalUID instance using this protocol.
 java.lang.String getDescription()
          Return the description for the type of ObjectID described by this object.
 java.lang.String getProtocol()
          Return the protocol for the type of ObjectID described by this object.
 ObjectID stringToObject(java.lang.String value)
          Attempt to convert the specified string to the appropriate ObjectID instance.
 ObjectID stringWithoutProtocolToObject(java.lang.String value)
          Attempt to convert the specified string to the appropriate ObjectID instance.
 

Method Detail

getProtocol

java.lang.String getProtocol()
Return the protocol for the type of ObjectID described by this object.

Returns:
the protocol

getDescription

java.lang.String getDescription()
Return the description for the type of ObjectID described by this object.

Returns:
the description

create

ObjectID create()
Create a new GlobalUID instance using this protocol.

Returns:
the new instance

stringToObject

ObjectID stringToObject(java.lang.String value)
                        throws InvalidIDException
Attempt to convert the specified string to the appropriate ObjectID instance.

Parameters:
value - the stringified id (the result of ObjectID.toString()), and should never null or zero length
Returns:
the ObjectID instance for the stringified ID if this factory is able to parse the string, or null if the factory is unaware of the specified format.
Throws:
InvalidIDException - if the parser is aware of this protocol, but it is of the wrong format for this type of ObjectID.

stringWithoutProtocolToObject

ObjectID stringWithoutProtocolToObject(java.lang.String value)
                                       throws InvalidIDException
Attempt to convert the specified string to the appropriate ObjectID instance. This method is called by the IDGenerator.stringToObject(String) method, which must process the protocol to determine the correct parser to use. As such, it guarantees that the parser that receives this call can assume that the protocol was equal to the protocol returned by the parser's ObjectIDDescriptor#getProtocol().

Parameters:
value - the stringified id with the protocol and ObjectID.DELIMITER already removed, and should never null or zero length
Returns:
the ObjectID instance for the stringified ID if this factory is able to parse the string, or null if the factory is unaware of the specified format.
Throws:
InvalidIDException - if the parser is aware of this protocol, but it is of the wrong format for this type of ObjectID.


Copyright © 2009. All Rights Reserved.