Codota Logo
KeyValueOperations.find
Code IndexAdd Codota to your IDE (free)

How to use
find
method
in
org.springframework.data.keyvalue.core.KeyValueOperations

Best Java code snippets using org.springframework.data.keyvalue.core.KeyValueOperations.find (Showing top 6 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ScheduledThreadPoolExecutor s =
  • Codota Iconnew ScheduledThreadPoolExecutor(corePoolSize)
  • Codota IconThreadFactory threadFactory;new ScheduledThreadPoolExecutor(corePoolSize, threadFactory)
  • Codota IconString str;new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(str).build())
  • Smart code suggestions by Codota
}
origin: com.hazelcast/spring-data-hazelcast

/**
 * Execute a "delete" query, not really a query more of an operation.
 * <p>
 *
 * @param query       The query to run
 * @param queryMethod Used here to find the type of object to match the query
 * @return Collection of deleted objects or the number of deleted objects
 */
private Object executeDeleteQuery(final KeyValueQuery<?> query, final QueryMethod queryMethod) {
  Iterable<?> resultSet = this.keyValueOperations.find(query, queryMethod.getEntityInformation().getJavaType());
  Iterator<?> iterator = resultSet.iterator();
  List<Object> result = new ArrayList<>();
  while (iterator.hasNext()) {
    result.add(this.keyValueOperations.delete(iterator.next()));
  }
  if (queryMethod.isCollectionQuery()) {
    return result;
  } else if (long.class.equals(queryMethod.getReturnedObjectType()) || Long.class
      .equals(queryMethod.getReturnedObjectType())) {
    return result.size();
  } else {
    throw new UnsupportedOperationException(String.format(
        "Illegal returned type: %s. The operation 'deleteBy' accepts only 'long' and 'Collection' as the returned "
            + "object type", queryMethod.getReturnedObjectType()));
  }
}
origin: com.hazelcast/spring-data-hazelcast

/**
 * <p>
 * Execute a retrieval query. The query engine will return this in an iterator, which may need conversion to a single
 * domain entity or a stream.
 * </P>
 *
 * @param query       The query to run
 * @param queryMethod Holds metadata about the query, is paging etc
 * @return Query result
 */
private Object executeFindQuery(final KeyValueQuery<?> query, final QueryMethod queryMethod) {
  Iterable<?> resultSet = this.keyValueOperations.find(query, queryMethod.getEntityInformation().getJavaType());
  if (!queryMethod.isCollectionQuery() && !queryMethod.isPageQuery() && !queryMethod.isSliceQuery() && !queryMethod
      .isStreamQuery()) {
    // Singleton result
    return resultSet.iterator().hasNext() ? resultSet.iterator().next() : null;
  }
  if (queryMethod.isStreamQuery()) {
    return StreamUtils.createStreamFromIterator(resultSet.iterator());
  }
  return resultSet;
}
origin: apache/servicemix-bundles

/**
 * @param parameters
 * @param query
 */
@Nullable
@SuppressWarnings({ "unchecked", "rawtypes" })
protected Object doExecute(Object[] parameters, KeyValueQuery<?> query) {
  if (queryMethod.isPageQuery() || queryMethod.isSliceQuery()) {
    Pageable page = (Pageable) parameters[queryMethod.getParameters().getPageableIndex()];
    query.setOffset(page.getOffset());
    query.setRows(page.getPageSize());
    Iterable<?> result = this.keyValueOperations.find(query, queryMethod.getEntityInformation().getJavaType());
    long count = queryMethod.isSliceQuery() ? 0
        : keyValueOperations.count(query, queryMethod.getEntityInformation().getJavaType());
    return new PageImpl(IterableConverter.toList(result), page, count);
  } else if (queryMethod.isCollectionQuery()) {
    return this.keyValueOperations.find(query, queryMethod.getEntityInformation().getJavaType());
  } else if (queryMethod.isQueryForEntity()) {
    Iterable<?> result = this.keyValueOperations.find(query, queryMethod.getEntityInformation().getJavaType());
    return result.iterator().hasNext() ? result.iterator().next() : null;
  }
  throw new UnsupportedOperationException("Query method not supported.");
}
origin: spring-projects/spring-data-keyvalue

/**
 * @param parameters
 * @param query
 */
@Nullable
@SuppressWarnings({ "unchecked", "rawtypes" })
protected Object doExecute(Object[] parameters, KeyValueQuery<?> query) {
  if (queryMethod.isPageQuery() || queryMethod.isSliceQuery()) {
    Pageable page = (Pageable) parameters[queryMethod.getParameters().getPageableIndex()];
    query.setOffset(page.getOffset());
    query.setRows(page.getPageSize());
    Iterable<?> result = this.keyValueOperations.find(query, queryMethod.getEntityInformation().getJavaType());
    long count = queryMethod.isSliceQuery() ? 0
        : keyValueOperations.count(query, queryMethod.getEntityInformation().getJavaType());
    return new PageImpl(IterableConverter.toList(result), page, count);
  } else if (queryMethod.isCollectionQuery()) {
    return this.keyValueOperations.find(query, queryMethod.getEntityInformation().getJavaType());
  } else if (queryMethod.isQueryForEntity()) {
    Iterable<?> result = this.keyValueOperations.find(query, queryMethod.getEntityInformation().getJavaType());
    return result.iterator().hasNext() ? result.iterator().next() : null;
  }
  throw new UnsupportedOperationException("Query method not supported.");
}
origin: org.springframework.data/spring-data-keyvalue

/**
 * @param parameters
 * @param query
 */
@Nullable
@SuppressWarnings({ "unchecked", "rawtypes" })
protected Object doExecute(Object[] parameters, KeyValueQuery<?> query) {
  if (queryMethod.isPageQuery() || queryMethod.isSliceQuery()) {
    Pageable page = (Pageable) parameters[queryMethod.getParameters().getPageableIndex()];
    query.setOffset(page.getOffset());
    query.setRows(page.getPageSize());
    Iterable<?> result = this.keyValueOperations.find(query, queryMethod.getEntityInformation().getJavaType());
    long count = queryMethod.isSliceQuery() ? 0
        : keyValueOperations.count(query, queryMethod.getEntityInformation().getJavaType());
    return new PageImpl(IterableConverter.toList(result), page, count);
  } else if (queryMethod.isCollectionQuery()) {
    return this.keyValueOperations.find(query, queryMethod.getEntityInformation().getJavaType());
  } else if (queryMethod.isQueryForEntity()) {
    Iterable<?> result = this.keyValueOperations.find(query, queryMethod.getEntityInformation().getJavaType());
    return result.iterator().hasNext() ? result.iterator().next() : null;
  }
  throw new UnsupportedOperationException("Query method not supported.");
}
origin: com.hazelcast/spring-data-hazelcast

query.setRows(pageRequest.getPageSize());
Iterable<?> resultSet = this.keyValueOperations.find(query, queryMethod.getEntityInformation().getJavaType());
List<?> content = IterableConverter.toList(resultSet);
org.springframework.data.keyvalue.coreKeyValueOperationsfind

Javadoc

Get all elements matching the given query.
Respects KeySpace if present and therefore returns all elements that can be assigned to requested type..

Popular methods of KeyValueOperations

  • getMappingContext
  • count
    Total number of elements matching given query. Respects KeySpace if present and therefore counts all
  • delete
    Delete item of type with given id.
  • destroy
  • findAll
    Get all elements ordered by sort. Respects KeySpace if present and therefore returns all elements th
  • findById
    Get element of given type with given id. Respects KeySpace if present and therefore returns all elem
  • findInRange
    Get all elements in given range ordered by sort. Respects KeySpace if present and therefore returns
  • insert
    Add object with given id.
  • update

Popular in Java

  • Start an intent from android
  • scheduleAtFixedRate (ScheduledExecutorService)
  • setContentView (Activity)
  • getSystemService (Context)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • Kernel (java.awt.image)
  • Path (java.nio.file)
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • Vector (java.util)
    The Vector class implements a growable array of objects. Like an array, it contains components that
  • JCheckBox (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