Package org.openwms.common.location
Class LocationPK
java.lang.Object
org.openwms.common.location.LocationPK
- All Implemented Interfaces:
Serializable
A LocationPK, is a value type and is used as an unique natural key for
Location entities.- Author:
- Heiko Scherrer
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate @Size(max=4) StringExpresses the aisle theLocationbelongs to.private @Size(max=4) StringExpresses the area theLocationbelongs to.static final shortstatic final shortstatic final shortReturns the complete length of all keys.private @Size(max=4) StringExpresses the x-dimension theLocationbelongs to.private @Size(max=4) StringExpresses the y-dimension theLocationbelongs to.private @Size(max=4) StringExpresses the z-dimension theLocationbelongs to. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDear JPA ...privateLocationPK(String... keys) Weak constructor to create a new LocationPK with a couple of keys only. -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic LocationPKfromString(String s) Create aLocationPKfrom the given String.getAisle()Get the aisle region.getArea()Get the area region.getX()Get the x-dimension.getY()Get the y-dimension.getZ()Get the z-dimension.inthashCode()static booleanChecks whether the givenlocationPKString is in valid format.static LocationPKCreate a new LocationPK with all required fields.toString()Return a String like AREA/AISLE/X/Y/Z.
-
Field Details
-
KEY_LENGTH
public static final short KEY_LENGTH- See Also:
-
NUMBER_OF_KEYS
public static final short NUMBER_OF_KEYS- See Also:
-
PK_LENGTH
public static final short PK_LENGTHReturns the complete length of all keys. Currently, all keys have the same length, therefore it is the 5 times the length of a single key (KEY_LENGTH). But since this can change the actual length is encapsulated within this method.- See Also:
-
area
Expresses the area theLocationbelongs to. -
aisle
Expresses the aisle theLocationbelongs to. -
x
Expresses the x-dimension theLocationbelongs to. -
y
Expresses the y-dimension theLocationbelongs to. -
z
Expresses the z-dimension theLocationbelongs to.
-
-
Constructor Details
-
LocationPK
protected LocationPK()Dear JPA ... -
LocationPK
Weak constructor to create a new LocationPK with a couple of keys only.- Parameters:
keys- The array of keys, currently expected to be 5- Throws:
IllegalArgumentException- if the number of keys does not matchNUMBER_OF_KEYS
-
-
Method Details
-
of
Create a new LocationPK with all required fields. -
fromString
Create aLocationPKfrom the given String.- Parameters:
s- The String, not null- Returns:
- An instance
-
isValid
Checks whether the givenlocationPKString is in valid format.- Parameters:
locationPk- The String to verify- Returns:
- true if valid
-
getArea
Get the area region.- Returns:
- The area
-
getAisle
Get the aisle region.- Returns:
- The aisle
-
getX
Get the x-dimension.- Returns:
- The x-dimension
-
getY
Get the y-dimension.- Returns:
- The y-dimension
-
getZ
Get the z-dimension.- Returns:
- The z-dimension
-
equals
-
hashCode
public int hashCode() -
toString
Return a String like AREA/AISLE/X/Y/Z.
-