Class Assertions


  • public final class Assertions
    extends Object
    Attribute value assertion utilities.
    • Method Detail

      • equalityAssertion

        public static Assertion equalityAssertion​(String indexId,
                                                  ByteString normalizedAssertionValue,
                                                  ByteString assertionValue)
        Returns an assertion suitable for implementing simple equality matching rules whose assertion syntax is the same as the attribute value syntax. Specifically, the returned assertion will perform a byte by byte comparison between the normalized assertion value and the attribute values.
        Parameters:
        indexId - The index id.
        normalizedAssertionValue - The normalized assertion value which will be compared directly against the normalized values of an attribute.
        assertionValue - The raw assertion value, which may be used as a fall-back in cases where an attribute does not have direct access to normalized attribute values (for example, some virtual attribute implementations).
        Returns:
        An assertion for equality comparisons.
      • anyOfEqualityAssertion

        public static Assertion anyOfEqualityAssertion​(String indexId,
                                                       Map<ByteString,​ByteString> assertions)
        Returns an "anyOf" assertion suitable for implementing simple equality matching rules whose assertion syntax is the same as the attribute value syntax. Specifically, the returned assertion will perform a byte by byte comparison between the normalized assertion value and the attribute values.
        Parameters:
        indexId - The index id.
        assertions - The map of assertions, whose keys are the normalized assertion values and whose values are the raw assertion values. The raw assertion values may be used as a fall-back in cases where an attribute does not have direct access to normalized attribute values (for example, some virtual attribute implementations).
        Returns:
        An assertion for "anyOf" equality comparisons, which returns true when an attribute contains at least one of the provided assertion values.
      • orderingAssertion

        public static Assertion orderingAssertion​(String indexId,
                                                  ByteString lower,
                                                  ByteString lowerNormalized,
                                                  ByteString upper,
                                                  ByteString upperNormalized,
                                                  boolean lowerIncluded,
                                                  boolean upperIncluded)
        Returns an assertion suitable for implementing ordering matching rules.
        Parameters:
        indexId - The index id.
        lower - The lower bound raw assertion value, or null if there is no lower bound and the range will start from the smallest key.
        lowerNormalized - The lower bound normalized assertion value, or null if there is no lower bound and the range will start from the smallest key.
        upper - The upper bound raw assertion value, or null if there is no upper bound and the range will end at the largest key.
        upperNormalized - The upper bound normalized assertion value, or null if there is no upper bound and the range will end at the largest key.
        lowerIncluded - true if a key exactly matching the lower bound is included in the range, false if only keys strictly greater than the lower bound are included. This value is ignored if the lower bound is not specified.
        upperIncluded - true if a key exactly matching the upper bound is included in the range, false if only keys strictly less than the upper bound are included. This value is ignored if the upper bound is not specified.
        Returns:
        An assertion for ordering comparisons.