Package edu.uiuc.ncsa.security.core.util
Class BasicIdentifier
- java.lang.Object
-
- edu.uiuc.ncsa.security.core.util.BasicIdentifier
-
- All Implemented Interfaces:
Identifier
,Serializable
,Comparable
public class BasicIdentifier extends Object implements Identifier
Simple implementation of an identifier. This also has a couple of factory methods for creating identifiers.Created by Jeff Gaynor
on 4/3/12 at 3:41 PM- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description BasicIdentifier(String id)
BasicIdentifier(URI id)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Object o)
boolean
equals(Object obj)
URI
getUri()
Return this identifier as aURI
.int
hashCode()
static void
main(String[] args)
static Identifier
newID(String id)
Create a new identifier from a given string.static Identifier
newID(URI uri)
Create a new identifier from a given URI.static Identifier
randomID()
Create a random id.String
toString()
-
-
-
Method Detail
-
getUri
public URI getUri()
Description copied from interface:Identifier
Return this identifier as aURI
.- Specified by:
getUri
in interfaceIdentifier
- Returns:
-
newID
public static Identifier newID(String id)
Create a new identifier from a given string.- Parameters:
id
-- Returns:
-
newID
public static Identifier newID(URI uri)
Create a new identifier from a given URI.- Parameters:
uri
-- Returns:
-
randomID
public static Identifier randomID()
Create a random id. Never use random IDs in for things that grant security access, since these are random which does not imply they are unguessable. Random IDs are useful for internal identifiers (such as for objects) or for testing.- Returns:
-
compareTo
public int compareTo(Object o)
- Specified by:
compareTo
in interfaceComparable
-
main
public static void main(String[] args)
-
-