Package org.projectnessie.model
Class ContentKey
java.lang.Object
org.projectnessie.model.ContentKey
- All Implemented Interfaces:
Comparable<ContentKey>
Key for the content of an object.
For URL encoding, embedded periods within a segment are replaced with zero byte values before passing in a url string.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intMaximum number of elements.static final intMaximum number of characters in a key. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal intcompareTo(ContentKey that) static ContentKeyfromPathString(String encoded) Convert from path encoded string to normal string.intString[]getName()Returns the namespace that is always consisting of the first N-1 elements fromgetElements().inthashCode()static ContentKeystatic ContentKeystatic ContentKeybooleanstartsWith(ContentKey other) booleanstartsWith(Namespace other) Convert this key to a url encoded path string.toString()truncateToLength(int targetMaxLength) Return the content key, truncated to the given maximum length if the number of elements is greater thantargetMaxLength, otherwise returns this content key.protected voidvalidate()
-
Field Details
-
MAX_LENGTH
public static final int MAX_LENGTHMaximum number of characters in a key. Note: characters can take up to 3 bytes via UTF-8.- See Also:
-
MAX_ELEMENTS
public static final int MAX_ELEMENTSMaximum number of elements.- See Also:
-
-
Constructor Details
-
ContentKey
public ContentKey()
-
-
Method Details
-
getElements
-
getElementsArray
-
getElementCount
@Redacted public int getElementCount() -
getNamespace
Returns the namespace that is always consisting of the first N-1 elements fromgetElements().- Returns:
- A
Namespaceinstance that is always consisting of the first N-1 elements fromgetElements().
-
getName
-
getParent
-
truncateToLength
Return the content key, truncated to the given maximum length if the number of elements is greater thantargetMaxLength, otherwise returns this content key. -
startsWith
-
startsWith
-
of
-
of
-
of
-
validate
@Check protected void validate() -
fromPathString
Convert from path encoded string to normal string.- Parameters:
encoded- Path encoded string- Returns:
- Actual key.
-
toPathString
Convert this key to a url encoded path string.- Returns:
- String encoded for path use.
-
toString
-
hashCode
public int hashCode() -
compareTo
- Specified by:
compareToin interfaceComparable<ContentKey>
-