Class TechKey
java.lang.Object
de.hybris.platform.sap.core.common.TechKey
- All Implemented Interfaces:
Serializable
Class representing the concept of an unique identifier for an object. The key may be a database primary key, a GUID
or some other identifier.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanCompares this TechKey to the specified object.static TechKeyfromUUIDString(String uuidString) Creates a new unique technical key using as GUID with length 32 using the UUID string format.static TechKeyCreates a new unique technical key using as GUID with length 32 using the class UUID.Retrieves the id as aString.inthashCode()Returns the hash code of the key.static booleanChecks if the passed TechKey instance is empty.booleanTells you, whether the actual key is initial or not.toString()Returns the string representation of the TechKey.Returns the UUID string representation of the given object.
-
Field Details
-
EMPTY_KEY
An empty TechKey. Use this if you need an empty technical key for your purposes. Do not create them with new TechKey(""). If you ask this key if its initial it says "yes I am".
-
-
Constructor Details
-
TechKey
Creates a new instance by providing a string representation of the key. Do not create new technical keys using newTechKey(null)but use the defined static finalEMPTY_KEY.- Parameters:
id- key to be used for the construction
-
-
Method Details
-
isInitial
public boolean isInitial()Tells you, whether the actual key is initial or not.- Returns:
trueif the key is initial orfalseif its not.
-
getIdAsString
Retrieves the id as aString.- Returns:
- String representation of the key
-
isEmpty
Checks if the passed TechKey instance is empty.It is empty, if the id is
nullor if the content asStringcontains whitespaces only.- Parameters:
techKey- TechKey instance- Returns:
trueif the providedtechKeyis empty
-
toString
Returns the string representation of the TechKey. -
toUUIDString
Returns the UUID string representation of the given object.Example:
12345678-9012-3456-7890-1234567890AB- Returns:
- UUID String representation
-
hashCode
public int hashCode()Returns the hash code of the key. -
equals
Compares this TechKey to the specified object. The result istrueif and only if the argument is notnulland is aTechKeyobject that represents the same key value as this object. -
generateKey
Creates a new unique technical key using as GUID with length 32 using the class UUID.- Returns:
- new unique technical key
-
fromUUIDString
Creates a new unique technical key using as GUID with length 32 using the UUID string format.- Parameters:
uuidString- UUID formatted String- Returns:
- new unique technical key
-