Codota Logo
Range.getUpperBound
Code IndexAdd Codota to your IDE (free)

How to use
getUpperBound
method
in
org.springframework.data.domain.Range

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

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
LocalDateTime l =
  • Codota Iconnew LocalDateTime()
  • Codota IconLocalDateTime.now()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseLocalDateTime(text)
  • Smart code suggestions by Codota
}
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-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-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

  /**
   * 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

@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

@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

@Override
public Document toDocument() {
  Document doc = new Document(super.toDocument());
  if (length != null) {
    length.getLowerBound().getValue().ifPresent(it -> doc.append("minLength", it));
    length.getUpperBound().getValue().ifPresent(it -> doc.append("maxLength", it));
  }
  if (!StringUtils.isEmpty(pattern)) {
    doc.append("pattern", pattern);
  }
  return doc;
}
origin: spring-projects/spring-data-mongodb

/**
 * Set {@literal minimum} to given {@code min} value and {@literal exclusiveMinimum} to {@literal true}.
 *
 * @param min must not be {@literal null}.
 * @return new instance of {@link NumericJsonSchemaObject}.
 */
@SuppressWarnings("unchecked")
public NumericJsonSchemaObject gt(Number min) {
  Assert.notNull(min, "Min must not be null!");
  Bound upper = this.range != null ? this.range.getUpperBound() : Bound.unbounded();
  return within(Range.of(createBound(min, false), upper));
}
origin: spring-projects/spring-data-mongodb

/**
 * Set {@literal minimum} to given {@code min} value and {@literal exclusiveMinimum} to {@literal false}.
 *
 * @param min must not be {@literal null}.
 * @return new instance of {@link NumericJsonSchemaObject}.
 */
@SuppressWarnings("unchecked")
public NumericJsonSchemaObject gte(Number min) {
  Assert.notNull(min, "Min must not be null!");
  Bound upper = this.range != null ? this.range.getUpperBound() : Bound.unbounded();
  return within(Range.of(createBound(min, true), upper));
}
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-mongodb

/**
 * Define the {@literal maxItems}.
 *
 * @param count the allowed minimal number of array items.
 * @return new instance of {@link ArrayJsonSchemaObject}.
 */
public ArrayJsonSchemaObject minItems(int count) {
  Bound<Integer> upper = this.range != null ? this.range.getUpperBound() : Bound.unbounded();
  return range(Range.of(Bound.inclusive(count), upper));
}
origin: spring-projects/spring-data-mongodb

/**
 * Define the valid length range ({@literal minLength}) for a valid field.
 *
 * @param length
 * @return new instance of {@link StringJsonSchemaObject}.
 */
public StringJsonSchemaObject minLength(int length) {
  Bound<Integer> upper = this.length != null ? this.length.getUpperBound() : Bound.unbounded();
  return length(Range.of(Bound.inclusive(length), upper));
}
origin: spring-projects/spring-data-redis

/**
 * Applies a lower bound to the {@link Range}. Constructs a new command instance with all previously configured
 * properties.
 *
 * @param start
 * @return a new {@link RangeCommand} with the lower bound applied.
 */
public RangeCommand fromIndex(long start) {
  return new RangeCommand(getKey(), Range.of(Bound.inclusive(start), range.getUpperBound()));
}
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: spring-projects/spring-data-mongodb

@Override
public Document toDocument() {
  Document doc = new Document(super.toDocument());
  if (multipleOf != null) {
    doc.append("multipleOf", multipleOf);
  }
  if (range != null) {
    if (range.getLowerBound().isBounded()) {
      range.getLowerBound().getValue().ifPresent(it -> doc.append("minimum", it));
      if (!range.getLowerBound().isInclusive()) {
        doc.append("exclusiveMinimum", true);
      }
    }
    if (range.getUpperBound().isBounded()) {
      range.getUpperBound().getValue().ifPresent(it -> doc.append("maximum", it));
      if (!range.getUpperBound().isInclusive()) {
        doc.append("exclusiveMaximum", true);
      }
    }
  }
  return doc;
}
origin: spring-projects/spring-data-mongodb

@Override
public Document toDocument() {
  Document doc = new Document(super.toDocument());
  if (!CollectionUtils.isEmpty(requiredProperties)) {
    doc.append("required", requiredProperties);
  }
  if (propertiesCount != null) {
    propertiesCount.getLowerBound().getValue().ifPresent(it -> doc.append("minProperties", it));
    propertiesCount.getUpperBound().getValue().ifPresent(it -> doc.append("maxProperties", it));
  }
  if (!CollectionUtils.isEmpty(properties)) {
    doc.append("properties", reduceToDocument(properties));
  }
  if (!CollectionUtils.isEmpty(patternProperties)) {
    doc.append("patternProperties", reduceToDocument(patternProperties));
  }
  if (additionalProperties != null) {
    doc.append("additionalProperties", additionalProperties instanceof JsonSchemaObject
        ? ((JsonSchemaObject) additionalProperties).toDocument() : additionalProperties);
  }
  return doc;
}
origin: spring-projects/spring-data-mongodb

@SuppressWarnings({ "unchecked", "rawtypes" })
protected Flux<GeoResult<Object>> doExecuteQuery(@Nullable Query query, Class<?> type, String collection) {
  Point nearLocation = accessor.getGeoNearLocation();
  NearQuery nearQuery = NearQuery.near(nearLocation);
  if (query != null) {
    nearQuery.query(query);
  }
  Range<Distance> distances = accessor.getDistanceRange();
  distances.getUpperBound().getValue().ifPresent(it -> nearQuery.maxDistance(it).in(it.getMetric()));
  distances.getLowerBound().getValue().ifPresent(it -> nearQuery.minDistance(it).in(it.getMetric()));
  Pageable pageable = accessor.getPageable();
  nearQuery.with(pageable);
  return (Flux) operations.geoNear(nearQuery, type, collection);
}
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

@SuppressWarnings("unchecked")
GeoResults<Object> doExecuteQuery(Query query) {
  Point nearLocation = accessor.getGeoNearLocation();
  NearQuery nearQuery = NearQuery.near(nearLocation);
  if (query != null) {
    nearQuery.query(query);
  }
  Range<Distance> distances = accessor.getDistanceRange();
  distances.getLowerBound().getValue().ifPresent(it -> nearQuery.minDistance(it).in(it.getMetric()));
  distances.getUpperBound().getValue().ifPresent(it -> nearQuery.maxDistance(it).in(it.getMetric()));
  Pageable pageable = accessor.getPageable();
  nearQuery.with(pageable);
  return (GeoResults<Object>) operation.near(nearQuery).all();
}
origin: spring-projects/spring-data-redis

@Override
public Flux<NumericResponse<BitPosCommand, Long>> bitPos(Publisher<BitPosCommand> commands) {
  return connection.execute(cmd -> {
    return Flux.from(commands).flatMap(command -> {
      Mono<Long> result;
      Range<Long> range = command.getRange();
      if (range.getLowerBound().isBounded()) {
        result = cmd.bitpos(command.getKey(), command.getBit(), getLowerValue(range));
        if (range.getUpperBound().isBounded()) {
          result = cmd.bitpos(command.getKey(), command.getBit(), getLowerValue(range), getUpperValue(range));
        }
      } else {
        result = cmd.bitpos(command.getKey(), command.getBit());
      }
      return result.map(respValue -> new NumericResponse<>(command, respValue));
    });
  });
}
org.springframework.data.domainRangegetUpperBound

Popular methods of Range

  • <init>
  • getLowerBound
  • of
  • contains
    Returns whether the Range contains the given value.
  • equals
  • from
    Create a RangeBuilder given the lower Bound.
  • unbounded

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getSupportFragmentManager (FragmentActivity)
  • onRequestPermissionsResult (Fragment)
  • orElseThrow (Optional)
  • BufferedReader (java.io)
    Reads text from a character-input stream, buffering characters so as to provide for the efficient re
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • Properties (java.util)
    The Properties class represents a persistent set of properties. The Properties can be saved to a st
  • JButton (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now