Package org.hcjf.utils
Class NamedUuid
- java.lang.Object
-
- org.hcjf.utils.NamedUuid
-
public final class NamedUuid extends java.lang.ObjectThis king of uuid contains a hash code for some string in his internal structure.- Author:
- javaito
-
-
Method Summary
Modifier and Type Method Description static NamedUuidcreate(java.lang.String name)Creates an instance of named uuid from a name.static NamedUuidcreate(java.util.UUID uuid)Creates an instance of named uuid from a uuid instance.java.lang.IntegergetHash()Returns the hash code of the creation name.java.util.UUIDgetId()Returns the uuid instance.static java.lang.StringgetName(java.util.UUID uuid)Returns the name registered for the hash stored into the uuid instance.static voidregisterName(java.lang.String name)Register the hash code for the specific name.java.lang.StringtoString()Returns the string representation of internal id.
-
-
-
Method Detail
-
registerName
public static void registerName(java.lang.String name)
Register the hash code for the specific name.- Parameters:
name- Specific name.
-
getName
public static java.lang.String getName(java.util.UUID uuid)
Returns the name registered for the hash stored into the uuid instance.- Parameters:
uuid- Uuid instance.- Returns:
- Registered name.
- Throws:
java.lang.IllegalArgumentException- id the uuid instance is not a uuid version 5.
-
getId
public java.util.UUID getId()
Returns the uuid instance.- Returns:
- UUID instance.
-
getHash
public java.lang.Integer getHash()
Returns the hash code of the creation name.- Returns:
- Hash code of the name.
-
create
public static NamedUuid create(java.util.UUID uuid)
Creates an instance of named uuid from a uuid instance.- Parameters:
uuid- UUID instance.- Returns:
- Named uuid instance.
-
create
public static NamedUuid create(java.lang.String name)
Creates an instance of named uuid from a name.- Parameters:
name- Name- Returns:
- Named uuid instance.
-
toString
public java.lang.String toString()
Returns the string representation of internal id.- Overrides:
toStringin classjava.lang.Object- Returns:
- String representation of the internal id.
-
-