Class ContentKey

  • All Implemented Interfaces:
    java.lang.Comparable<ContentKey>

    @Immutable
    public abstract class ContentKey
    extends java.lang.Object
    implements java.lang.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 Detail

      • MAX_LENGTH

        public static final int MAX_LENGTH
        Maximum number of characters in a key. Note: characters can take up to 3 bytes via UTF-8.
        See Also:
        Constant Field Values
      • MAX_ELEMENTS

        public static final int MAX_ELEMENTS
        Maximum number of elements.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ContentKey

        public ContentKey()
    • Method Detail

      • getElements

        @NotNull
        @NotNull
        @Size
        @Size(min=1)
        @Parameter(order=1)
        public abstract @NotNull @NotNull @Size @Size(min=1) java.util.List<java.lang.String> getElements()
      • getElementsArray

        @Redacted
        public java.lang.String[] getElementsArray()
      • getElementCount

        @Redacted
        public int getElementCount()
      • getNamespace

        @Redacted
        public Namespace getNamespace()
        Returns the namespace that is always consisting of the first N-1 elements from getElements().
        Returns:
        A Namespace instance that is always consisting of the first N-1 elements from getElements().
      • getName

        @Redacted
        public java.lang.String getName()
      • getParent

        @Redacted
        public ContentKey getParent()
      • truncateToLength

        public ContentKey truncateToLength​(int targetMaxLength)
        Return the content key, truncated to the given maximum length if the number of elements is greater than targetMaxLength, otherwise returns this content key.
      • startsWith

        public boolean startsWith​(ContentKey other)
      • startsWith

        public boolean startsWith​(Namespace other)
      • of

        public static ContentKey of​(java.lang.String... elements)
      • of

        public static ContentKey of​(java.util.List<java.lang.String> elements)
      • validate

        @Check
        protected void validate()
      • fromPathString

        public static ContentKey fromPathString​(java.lang.String encoded)
        Convert from path encoded string to normal string.
        Parameters:
        encoded - Path encoded string
        Returns:
        Actual key.
      • toPathString

        public java.lang.String toPathString()
        Convert this key to a url encoded path string.
        Returns:
        String encoded for path use.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • compareTo

        public final int compareTo​(ContentKey that)
        Specified by:
        compareTo in interface java.lang.Comparable<ContentKey>