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 intcompareTo(Object o)booleanequals(Object obj)URIgetUri()Return this identifier as aURI.inthashCode()booleanisTrivial()Is the underlying URI trivial, i.e.static voidmain(String[] args)static IdentifiernewID(String id)Create a new identifier from a given string.static IdentifiernewID(URI uri)Create a new identifier from a given URI.static IdentifierrandomID()Create a random id.StringtoString()
-
-
-
Method Detail
-
isTrivial
public boolean isTrivial()
Description copied from interface:IdentifierIs the underlying URI trivial, i.e. null or an empty string?- Specified by:
isTrivialin interfaceIdentifier- Returns:
-
getUri
public URI getUri()
Description copied from interface:IdentifierReturn this identifier as aURI.- Specified by:
getUriin 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:
compareToin interfaceComparable
-
main
public static void main(String[] args)
-
-