Interface KeyExpression

    • Method Detail

      • evaluateSingleton

        @Nonnull
        default <M extends MessageKey.Evaluated evaluateSingleton​(@Nullable
                                                                    FDBRecord<M> record)
        Evaluate this expression with the expectation of getting exactly one result.
        Type Parameters:
        M - the type of record
        Parameters:
        record - the record
        Returns:
        the evaluated keys for the given record
      • evaluateMessage

        @Nonnull
        <M extends MessageList<Key.Evaluated> evaluateMessage​(@Nullable
                                                                FDBRecord<M> record,
                                                                @Nullable
                                                                Message message)
        Evaluate this expression against a record or a Protobuf message. The message might be the Protobuf form of a record or a piece of that record. If the key expression is meaningful against a subrecord, it should evaluate against the message. Otherwise, it should evaluate against the record and ignore what part of that record is being considered. There should not be any reason to call this method outside of the implementation of another evaluateMessage. Under ordinary circumstances, if record is null, then message will be null. Otherwise, message will be record.getRecord() or some submessage of that, possibly null if the corresponding field is missing.
        Type Parameters:
        M - the type of record
        Parameters:
        record - the record
        message - the Protobuf message to evaluate against
        Returns:
        the evaluated keys for the given record
        See Also:
        evaluate(com.apple.foundationdb.record.provider.foundationdb.FDBRecord<M>)
      • createsDuplicates

        boolean createsDuplicates()
        This states whether the given expression type is capable of evaluating more to more than one value when applied to a single record. In practice, this can happen if this expression is evaluated on a repeated field with FanType.FanOut set (either directly or indirectly).
        Returns:
        true if this expression can evaluate to multiple values and false otherwise
      • getColumnSize

        int getColumnSize()
        Returns the number of items in each KeyValue that will be returned. For key expressions that support KeyExpression.FanType.Concatenate, this will the count of non-nested lists, i.e. this will be value of evaluate(r).get(i).toList().size() for any i or r.
        Returns:
        the number of elements that will be produced for every key
      • normalizeKeyForPositions

        @Nonnull
        default List<KeyExpression> normalizeKeyForPositions()
        Get key in normalized form for comparing field-by-field. Does not take account of fan-type, so only valid when this has already been taken care of, such as individual index entries.
        Returns:
        a list of key expressions in order
      • hasLosslessNormalization

        @API(INTERNAL)
        default boolean hasLosslessNormalization()
        Method that indicates to the caller if this key expression can be normalized and re-composed in a way that yields the original expression.
        Returns:
        true if the key expression has a lossless normalization, false otherwise
      • getValueFields

        @API(EXPERIMENTAL)
        static List<KeyExpression> getValueFields​(@Nonnull
                                                  KeyExpression rootExpression)
        Return the value fields for an expression.
        Parameters:
        rootExpression - a key expression
        Returns:
        the parts of the key expression that are in the value
      • versionColumns

        default int versionColumns()
        Returns the number of version columns produced by this key expression.
        Returns:
        the number of version columns
      • hasRecordTypeKey

        default boolean hasRecordTypeKey()
        Check whether a key expression uses record type key in some way.
        Returns:
        true if record type key is used
      • getSubKey

        @Nonnull
        KeyExpression getSubKey​(int start,
                                int end)
        Returns a sub-set of the key expression.
        Parameters:
        start - starting position
        end - ending position
        Returns:
        a key expression for the subkey between start and end
      • isPrefixKey

        boolean isPrefixKey​(@Nonnull
                            KeyExpression key)
        Check whether a key is a prefix of another key.
        Parameters:
        key - the whole key to check
        Returns:
        true if prefix is a left subset of key
      • hasProperInterfaces

        default boolean hasProperInterfaces()