Class Key.Evaluated

  • Enclosing class:
    Key

    public static class Key.Evaluated
    extends Object
    Represents the list objects for a key in a secondary index or primary storage. To convert this into a Tuple for storage, simply call `Tuple.from(evaluated.toList())`
    • Field Detail

      • EMPTY

        public static final Key.Evaluated EMPTY
        A key containing no elements.
      • NULL

        public static final Key.Evaluated NULL
        A key containing just the null element.
    • Method Detail

      • scalar

        @Nonnull
        public static Key.Evaluated scalar​(@Nullable
                                           Object object)
        Creates a new key with just a single value.
        Parameters:
        object - the lone value in the key
        Returns:
        a new key for the one value
      • fan

        @Nonnull
        public static List<Key.Evaluated> fan​(@Nonnull
                                              List<Object> valuesToAdd)
        Fanout a list of scalars into a key for each value.
        Parameters:
        valuesToAdd - the list of scalars
        Returns:
        one key for each value in valuesToAdd
      • concatenate

        @Nonnull
        public static Key.Evaluated concatenate​(@Nonnull
                                                List<Object> values)
        Take a list of scalars and concatenate them in a single key. Note this is a key containing the list of values, as opposed to a key with a single value that is a list.
        Parameters:
        values - the values to combine together into a key
        Returns:
        a new key with the given values
      • concatenate

        @Nonnull
        public static Key.Evaluated concatenate​(@Nullable
                                                Object first,
                                                @Nullable
                                                Object... rest)
        Primarily for tests, shorthand for creating a concatenation with a bunch of elements, see concatenate.
        Parameters:
        first - the first value to be concatenated, avoids type conflicts with the other concatenate
        rest - the rest of the values
        Returns:
        a new key consisting of the provided values
      • fromTuple

        @Nonnull
        public static Key.Evaluated fromTuple​(@Nonnull
                                              Tuple tuple)
        Take a Tuple and create the corresponding key from it.
        Parameters:
        tuple - the tuple to convert
        Returns:
        a new key based on the given tuple
      • toTuple

        @Nonnull
        public Tuple toTuple()
        Convert this key to the corresponding Tuple that can then be serialized into the database.
        Returns:
        this key converted into a Tuple
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getObject

        @Nullable
        public <T> T getObject​(int idx,
                               Class<T> clazz)
      • getLong

        public long getLong​(int idx)
      • getNullableLong

        @Nullable
        public Long getNullableLong​(int idx)
      • getDouble

        public double getDouble​(int idx)
      • getNullableDouble

        @Nullable
        public Double getNullableDouble​(int idx)
      • getFloat

        public float getFloat​(int idx)
      • getNullableFloat

        @Nullable
        public Float getNullableFloat​(int idx)
      • append

        @Nonnull
        public Key.Evaluated append​(@Nonnull
                                    Key.Evaluated secondValue)
        Creates a new key by appending another key to this one.
        Parameters:
        secondValue - another key that will form the second part of the new key.
        Returns:
        a new key consisting of the elements in this key, and then the elements of the second key
      • toList

        @Nonnull
        public List<Object> toList()
        Converts to a list. Useful for creating tuples
        Returns:
        the elements of this key value
      • toTupleAppropriateList

        @Nonnull
        public List<Object> toTupleAppropriateList()
        Converts to a list. Useful for creating tuples. If possible the underlying objects will be converted to types that Tuple can handle.
        Returns:
        the elements of this key value
      • containsNonUniqueNull

        public boolean containsNonUniqueNull()
        Check for NULL value that inhibits unique indexes.
        Returns:
        true if this has a null value
      • size

        public int size()