Tabnine Logo
Range$Bound
Code IndexAdd Tabnine to your IDE (free)

How to use
Range$Bound
in
org.springframework.data.domain

Best Java code snippets using org.springframework.data.domain.Range$Bound (Showing top 20 results out of 315)

Refine searchRefine arrow

  • Range
  • Optional
origin: spring-projects/spring-data-redis

@Override
public Long bitPos(byte[] key, boolean bit, Range<Long> range) {
  Assert.notNull(key, "Key must not be null!");
  Assert.notNull(range, "Range must not be null! Use Range.unbounded() instead.");
  List<byte[]> args = new ArrayList<>(3);
  args.add(LettuceConverters.toBit(bit));
  if (range.getLowerBound().isBounded()) {
    args.add(range.getLowerBound().getValue().map(LettuceConverters::toBytes).get());
  }
  if (range.getUpperBound().isBounded()) {
    args.add(range.getUpperBound().getValue().map(LettuceConverters::toBytes).get());
  }
  return Long.class.cast(connection.execute("BITPOS", key, args));
}
origin: spring-projects/spring-data-mongodb

/**
 * Define the {@literal minProperties}.
 *
 * @param count the allowed minimal number of properties.
 * @return new instance of {@link ObjectJsonSchemaObject}.
 */
public ObjectJsonSchemaObject minProperties(int count) {
  Bound<Integer> upper = this.propertiesCount != null ? this.propertiesCount.getUpperBound() : Bound.unbounded();
  return propertiesCount(Range.of(Bound.inclusive(count), upper));
}
origin: spring-projects/spring-data-redis

Boolean inclusive = upper ? source.getUpperBound().isInclusive() : source.getLowerBound().isInclusive();
Object value = upper ? source.getUpperBound().getValue().orElse(null)
    : source.getLowerBound().getValue().orElse(null);
origin: apache/servicemix-bundles

String toPrefixString() {
  return getValue() //
      .map(Object::toString) //
      .map(it -> isInclusive() ? "[".concat(it) : "(".concat(it)) //
      .orElse("unbounded");
}
origin: spring-projects/spring-data-redis

@Nullable
@Override
public Long bitPos(byte[] key, boolean bit, Range<Long> range) {
  Assert.notNull(key, "Key must not be null!");
  Assert.notNull(range, "Range must not be null! Use Range.unbounded() instead.");
  BitPosParams params = null;
  if (range.getLowerBound().isBounded()) {
    params = range.getUpperBound().isBounded()
        ? new BitPosParams(range.getLowerBound().getValue().get(), range.getUpperBound().getValue().get())
        : new BitPosParams(range.getLowerBound().getValue().get());
  }
  try {
    if (isPipelined()) {
      pipeline(connection.newJedisResult(params != null ? connection.getRequiredPipeline().bitpos(key, bit, params)
          : connection.getRequiredPipeline().bitpos(key, bit)));
      return null;
    }
    if (isQueueing()) {
      transaction(
          connection.newJedisResult(params != null ? connection.getRequiredTransaction().bitpos(key, bit, params)
              : connection.getRequiredTransaction().bitpos(key, bit)));
      return null;
    }
    return params != null ? connection.getJedis().bitpos(key, bit, params) : connection.getJedis().bitpos(key, bit);
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}
origin: spring-projects/spring-data-mongodb

Optional<Distance> distance = range.getUpperBound().getValue();
Optional<Distance> minDistance = range.getLowerBound().getValue();
return distance.map(it -> {
  minDistance.ifPresent(min -> criteria.minDistance(min.getNormalizedValue()));
}).orElseGet(() -> isSpherical ? criteria.nearSphere(pointToUse) : criteria.near(pointToUse));
origin: spring-projects/spring-data-mongodb

@Override
public Document toDocument() {
  Document doc = new Document(super.toDocument());
  if (!CollectionUtils.isEmpty(items)) {
    doc.append("items", items.size() == 1 ? items.iterator().next()
        : items.stream().map(JsonSchemaObject::toDocument).collect(Collectors.toList()));
  }
  if (range != null) {
    range.getLowerBound().getValue().ifPresent(it -> doc.append("minItems", it));
    range.getUpperBound().getValue().ifPresent(it -> doc.append("maxItems", it));
  }
  if (ObjectUtils.nullSafeEquals(uniqueItems, Boolean.TRUE)) {
    doc.append("uniqueItems", true);
  }
  if (additionalItems != null) {
    doc.append("additionalItems", additionalItems);
  }
  return doc;
}
origin: spring-projects/spring-data-mongodb

  /**
   * Converts the given {@link Range} into an array of values.
   *
   * @param range must not be {@literal null}.
   * @return
   */
  public static List<Long> toRangeValues(Range<Long> range) {

    Assert.notNull(range, "Range must not be null!");

    List<Long> result = new ArrayList<Long>(2);
    result.add(range.getLowerBound().getValue()
        .orElseThrow(() -> new IllegalArgumentException("Lower bound of range must be bounded!")));
    range.getUpperBound().getValue().ifPresent(it -> result.add(it));

    return result;
  }
}
origin: spring-projects/spring-data-redis

  private static <T extends Comparable<T>> T getLowerValue(Range<T> range) {
    return range.getLowerBound().getValue()
        .orElseThrow(() -> new IllegalArgumentException("Range does not contain lower bound value!"));
  }
}
origin: spring-projects/spring-data-redis

private static <T extends Comparable<T>> T getUpperValue(Range<T> range) {
  return range.getUpperBound().getValue()
      .orElseThrow(() -> new IllegalArgumentException("Range does not contain upper bound value!"));
}
origin: spring-projects/spring-data-mongodb

/**
 * Set {@literal maximum} to given {@code max} value and {@literal exclusiveMaximum} to {@literal false}.
 *
 * @param max must not be {@literal null}.
 * @return new instance of {@link NumericJsonSchemaObject}.
 */
@SuppressWarnings("unchecked")
NumericJsonSchemaObject lte(Number max) {
  Assert.notNull(max, "Max must not be null!");
  Bound lower = this.range != null ? this.range.getLowerBound() : Bound.unbounded();
  return within(Range.of(lower, createBound(max, true)));
}
origin: spring-projects/spring-data-redis

  RedisClusterAsyncCommands<byte[], byte[]> connection = getAsyncConnection();
  if (range.getLowerBound().isBounded()) {
    if (range.getUpperBound().isBounded()) {
      futureResult = connection.bitpos(key, bit, getLowerValue(range), getUpperValue(range));
    } else {
if (range.getLowerBound().isBounded()) {
  if (range.getUpperBound().isBounded()) {
    return getConnection().bitpos(key, bit, getLowerValue(range), getUpperValue(range));
origin: spring-projects/spring-data-redis

/**
 * Return {@link Optional} lower bound from {@link Range}.
 *
 * @param range
 * @param <T>
 * @return
 * @since 2.0.9
 */
static <T extends Comparable<T>> Optional<T> getLowerBound(org.springframework.data.domain.Range<T> range) {
  return range.getLowerBound().getValue();
}
origin: spring-projects/spring-data-redis

/**
 * Return {@link Optional} upper bound from {@link Range}.
 *
 * @param range
 * @param <T>
 * @return
 * @since 2.0.9
 */
static <T extends Comparable<T>> Optional<T> getUpperBound(org.springframework.data.domain.Range<T> range) {
  return range.getUpperBound().getValue();
}
origin: spring-projects/spring-data-mongodb

public Range<Distance> getDistanceRange() {
  MongoParameters mongoParameters = method.getParameters();
  int rangeIndex = mongoParameters.getRangeIndex();
  if (rangeIndex != -1) {
    return getValue(rangeIndex);
  }
  int maxDistanceIndex = mongoParameters.getMaxDistanceIndex();
  Bound<Distance> maxDistance = maxDistanceIndex == -1 ? Bound.unbounded() : Bound.inclusive((Distance) getValue(maxDistanceIndex));
  return Range.of(Bound.unbounded(), maxDistance);
}
origin: st-tu-dresden/salespoint

private OrderLine getRequiredOrderLineByIndex(int index) {
  Range<Integer> allowedIndexRange = Range.from(Bound.inclusive(0))//
      .to(Bound.exclusive(orderLines.size()));
  Assert.isTrue(allowedIndexRange.contains(index),
      String.format("Invalid order line index %s. Required: %s!", index, allowedIndexRange));
  return this.orderLines.get(index);
}
origin: apache/servicemix-bundles

/**
 * Creates a new {@link QuotationMap} for the query.
 * 
 * @param query can be {@literal null}.
 */
public QuotationMap(@Nullable String query) {
  if (query == null) {
    return;
  }
  Character inQuotation = null;
  int start = 0;
  for (int i = 0; i < query.length(); i++) {
    char currentChar = query.charAt(i);
    if (QUOTING_CHARACTERS.contains(currentChar)) {
      if (inQuotation == null) {
        inQuotation = currentChar;
        start = i;
      } else if (currentChar == inQuotation) {
        inQuotation = null;
        quotedRanges.add(Range.from(Bound.inclusive(start)).to(Bound.inclusive(i)));
      }
    }
  }
  if (inQuotation != null) {
    throw new IllegalArgumentException(
        String.format("The string <%s> starts a quoted range at %d, but never ends it.", query, start));
  }
}
origin: spring-projects/spring-data-mongodb

private static Bound<?> createBound(Number number, boolean inclusive) {
  if (number instanceof Long) {
    return inclusive ? Bound.inclusive((Long) number) : Bound.exclusive((Long) number);
  }
  if (number instanceof Double) {
    return inclusive ? Bound.inclusive((Double) number) : Bound.exclusive((Double) number);
  }
  if (number instanceof Float) {
    return inclusive ? Bound.inclusive((Float) number) : Bound.exclusive((Float) number);
  }
  if (number instanceof Integer) {
    return inclusive ? Bound.inclusive((Integer) number) : Bound.exclusive((Integer) number);
  }
  if (number instanceof BigDecimal) {
    return inclusive ? Bound.inclusive((BigDecimal) number) : Bound.exclusive((BigDecimal) number);
  }
  throw new IllegalArgumentException("Unsupported numeric value.");
}
origin: org.springframework.data/spring-data-mongodb

private static Bound<?> createBound(Number number, boolean inclusive) {
  if (number instanceof Long) {
    return inclusive ? Bound.inclusive((Long) number) : Bound.exclusive((Long) number);
  }
  if (number instanceof Double) {
    return inclusive ? Bound.inclusive((Double) number) : Bound.exclusive((Double) number);
  }
  if (number instanceof Float) {
    return inclusive ? Bound.inclusive((Float) number) : Bound.exclusive((Float) number);
  }
  if (number instanceof Integer) {
    return inclusive ? Bound.inclusive((Integer) number) : Bound.exclusive((Integer) number);
  }
  if (number instanceof BigDecimal) {
    return inclusive ? Bound.inclusive((BigDecimal) number) : Bound.exclusive((BigDecimal) number);
  }
  throw new IllegalArgumentException("Unsupported numeric value.");
}
origin: apache/servicemix-bundles

/**
 * @return
 * @deprecated since 2.0, use {@link #getLowerBound()} and {@link Bound#isInclusive()}.
 */
@Deprecated
public boolean isLowerInclusive() {
  return lowerBound.isInclusive();
}
org.springframework.data.domainRange$Bound

Javadoc

Value object representing a boundary. A boundary can either be #unbounded(), #inclusive(Comparable) or #exclusive(Comparable).

Most used methods

  • getValue
  • inclusive
  • isInclusive
  • exclusive
  • isBounded
  • unbounded
  • <init>
  • toPrefixString
  • toSuffixString

Popular in Java

  • Making http post requests using okhttp
  • scheduleAtFixedRate (ScheduledExecutorService)
  • findViewById (Activity)
  • requestLocationUpdates (LocationManager)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now