net.jxta.id
Class IDFactory
java.lang.Object
|
+--net.jxta.util.ClassFactory
|
+--net.jxta.id.IDFactory
- public class IDFactory
- extends ClassFactory
This class is a factory class for constructing sub-classes of ID from external
representations such as strings or URIs
- Since:
- JXTA 1.0
- See Also:
ID
,
UUID
,
UUIDFactory
Method Summary |
static ID |
fromURL(java.net.URL source)
Construct a CodatId from a jxta URI. |
protected java.util.Hashtable |
getAssocTable()
Used by ClassFactory methods to get the mapping of ID types to constructors. |
protected java.lang.Class |
getBaseClassForFactory()
Used by ClassFactory methods to ensure that all of the instance classes
which register with this factory have the correct base class |
protected java.lang.Class |
getClassForKey()
Used by ClassFactory methods to ensure that all keys used with the mapping are
of the correct type. |
protected java.lang.Class[][] |
getRequiredConstructors()
Used by ClassFactory methods to determine the required set of constructors
needed by the instance classes generated by this factory. |
protected java.lang.Object[][] |
getRequiredStaticMethods()
Used by ClassFactory methods to determine the required set of static
methods needed by classes registering with this factory. |
static boolean |
registerIDType(int type,
java.lang.Class instanceClass)
Register a constructor for an ID type to enable IDs of that type to be
constructed. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
IDFactory
public IDFactory()
getAssocTable
protected java.util.Hashtable getAssocTable()
- Used by ClassFactory methods to get the mapping of ID types to constructors.
- Overrides:
- getAssocTable in class ClassFactory
- Returns:
- Hashtable the hashtable containing the mappings.
- Since:
- JXTA 1.0
getClassForKey
protected java.lang.Class getClassForKey()
- Used by ClassFactory methods to ensure that all keys used with the mapping are
of the correct type.
- Overrides:
- getClassForKey in class ClassFactory
- Returns:
- Class object of the key type.
- Since:
- JXTA 1.0
getBaseClassForFactory
protected java.lang.Class getBaseClassForFactory()
- Used by ClassFactory methods to ensure that all of the instance classes
which register with this factory have the correct base class
- Overrides:
- getBaseClassForFactory in class ClassFactory
- Returns:
- Class object of the key type.
- Since:
- JXTA 1.0
getRequiredConstructors
protected java.lang.Class[][] getRequiredConstructors()
- Used by ClassFactory methods to determine the required set of constructors
needed by the instance classes generated by this factory.
- Overrides:
- getRequiredConstructors in class ClassFactory
- Returns:
- Class object of the key type.
- Since:
- JXTA 1.0
getRequiredStaticMethods
protected java.lang.Object[][] getRequiredStaticMethods()
- Used by ClassFactory methods to determine the required set of static
methods needed by classes registering with this factory.
- Overrides:
- getRequiredStaticMethods in class ClassFactory
- Returns:
- Object
- Since:
- JXTA 1.0
fromURL
public static ID fromURL(java.net.URL source)
throws java.net.MalformedURLException,
java.net.UnknownServiceException,
java.lang.reflect.InvocationTargetException
- Construct a CodatId from a jxta URI.
- Parameters:
source
- URI which will be decoded to initialize this Codat ID.- Throws:
- java.net.UnknownServiceException - thrown if the URI provided is not
a jxta URI.
- java.net.MalformedURLException - bad URL
- java.lang.reflect.InvocationTargetException - error during invocation
- Since:
- JXTA 1.0
registerIDType
public static boolean registerIDType(int type,
java.lang.Class instanceClass)
throws java.lang.NoSuchMethodException,
java.lang.SecurityException
- Register a constructor for an ID type to enable IDs of that type to be
constructed.
- Parameters:
type
- the identifying value for this id typeitsConstructor
- the constructor to use in constructing objects
of this ID type. It should be the parameterless
constructor.- Throws:
- java.lang.NoSuchMethodException - invalid method
- java.lang.SecurityException - security violation
- Since:
- JXTA 1.0