com.karmasphere.share.persist
Class IdentityType

java.lang.Object
  extended by com.karmasphere.share.persist.IdentityType
All Implemented Interfaces:
Comparable
Direct Known Subclasses:
DomainIdentityType, EmailIdentityType, Ip4IdentityType, Ip6IdentityType, OpaqueIdentityType, UrlIdentityType

public class IdentityType
extends Object
implements Comparable


Nested Class Summary
static interface IdentityType.Discriminated
           
 
Field Summary
static Charset CHARSET
           
static int DOMAIN
           
static int EMAIL
           
static int IP4
           
static int IP6
           
static int MAX_TYPES
          The maximum number of type ids supported.
static int OPAQUE
           
static int URL
           
 
Constructor Summary
protected IdentityType(int id, String keyname, String name, String description)
           
 
Method Summary
 int compareTo(Object o)
          Compares this IdentityType with another IdentityType.
 boolean equals(Object o)
          Returns true if the argument is this IdentityType.
<T extends IdentityType.Discriminated>
Set<T>
filter(Set<T> in)
           
 byte[] fromString(String str)
          Converts a "common" human-readable version the identity data to a byte array.
static IdentityType get(int id)
           
static IdentityType get(String name)
           
 Condition<IdentityType.Discriminated> getCondition()
           
 String getDescription()
          Returns a short description of this IdentityType.
 int getId()
          Returns the id of this IdentityType.
 String getKeyname()
          Returns the keyname of this IdentityType.
 String getName()
          Returns the human-readable name of this IdentityType.
static Collection<IdentityType> getTypes()
           
 int hashCode()
           
 String toString()
          Returns a human-readble summary of this identitytype.
 String toString(byte[] data)
          Returns a human-readable version of the byte array associated with this identity type.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

IP4

public static final int IP4
See Also:
Constant Field Values

IP6

public static final int IP6
See Also:
Constant Field Values

DOMAIN

public static final int DOMAIN
See Also:
Constant Field Values

EMAIL

public static final int EMAIL
See Also:
Constant Field Values

URL

public static final int URL
See Also:
Constant Field Values

OPAQUE

public static final int OPAQUE
See Also:
Constant Field Values

MAX_TYPES

public static final int MAX_TYPES
The maximum number of type ids supported.

See Also:
Constant Field Values

CHARSET

public static final Charset CHARSET
Constructor Detail

IdentityType

protected IdentityType(int id,
                       String keyname,
                       String name,
                       String description)
Method Detail

get

public static IdentityType get(int id)

get

public static IdentityType get(String name)

getTypes

public static Collection<IdentityType> getTypes()

getId

public final int getId()
Returns the id of this IdentityType. The id is the unique identifier.


getKeyname

public String getKeyname()
Returns the keyname of this IdentityType. The keyname is a unique string identifier which may be used instead of the id where human-readability is important.


getName

public String getName()
Returns the human-readable name of this IdentityType. The human-readable name is never used in any processing. It is merely provided as a convenience for developers.


getDescription

public String getDescription()
Returns a short description of this IdentityType. The description is never used in any processing. It is merely provided as a convenience for developers.


toString

public String toString()
Returns a human-readble summary of this identitytype.

Overrides:
toString in class Object

toString

public String toString(byte[] data)
Returns a human-readable version of the byte array associated with this identity type.


fromString

public byte[] fromString(String str)
                  throws IdentityFormatException
Converts a "common" human-readable version the identity data to a byte array.

Throws:
IdentityFormatException

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Returns true if the argument is this IdentityType. IdentityTypes compare by id.

Overrides:
equals in class Object

compareTo

public int compareTo(Object o)
Compares this IdentityType with another IdentityType. IdentityTypes sort by id.

Specified by:
compareTo in interface Comparable

getCondition

public Condition<IdentityType.Discriminated> getCondition()

filter

public <T extends IdentityType.Discriminated> Set<T> filter(Set<T> in)


Copyright © 2004-2005 Karamsphere. All Rights Reserved.