Codota Logo
Sort$Order.withProperty
Code IndexAdd Codota to your IDE (free)

How to use
withProperty
method
in
org.springframework.data.domain.Sort$Order

Best Java code snippets using org.springframework.data.domain.Sort$Order.withProperty (Showing top 2 results out of 315)

  • Common ways to obtain Sort$Order
private void myMethod () {
Sort$Order s =
  • Codota IconSort sort;String property;sort.getOrderFor(property)
  • Smart code suggestions by Codota
}
origin: spring-projects/spring-data-rest

/**
 * Translates {@link Sort} orders from Jackson-mapped field names to {@link PersistentProperty} names. Properties
 * that cannot be resolved are dropped.
 *
 * @param input must not be {@literal null}.
 * @param rootEntity must not be {@literal null}.
 * @return {@link Sort} with translated field names or {@literal null} if translation dropped all sort fields.
 */
public Sort translateSort(Sort input, PersistentEntity<?, ?> rootEntity) {
  Assert.notNull(input, "Sort must not be null!");
  Assert.notNull(rootEntity, "PersistentEntity must not be null!");
  List<Order> filteredOrders = new ArrayList<Order>();
  for (Order order : input) {
    List<String> iteratorSource = new ArrayList<String>();
    Matcher matcher = SPLITTER.matcher("_" + order.getProperty());
    while (matcher.find()) {
      iteratorSource.add(matcher.group(1));
    }
    String mappedPropertyPath = getMappedPropertyPath(rootEntity, iteratorSource);
    if (mappedPropertyPath != null) {
      filteredOrders.add(order.withProperty(mappedPropertyPath));
    }
  }
  return filteredOrders.isEmpty() ? Sort.unsorted() : Sort.by(filteredOrders);
}
origin: org.springframework.data/spring-data-rest-webmvc

/**
 * Translates {@link Sort} orders from Jackson-mapped field names to {@link PersistentProperty} names. Properties
 * that cannot be resolved are dropped.
 *
 * @param input must not be {@literal null}.
 * @param rootEntity must not be {@literal null}.
 * @return {@link Sort} with translated field names or {@literal null} if translation dropped all sort fields.
 */
public Sort translateSort(Sort input, PersistentEntity<?, ?> rootEntity) {
  Assert.notNull(input, "Sort must not be null!");
  Assert.notNull(rootEntity, "PersistentEntity must not be null!");
  List<Order> filteredOrders = new ArrayList<Order>();
  for (Order order : input) {
    List<String> iteratorSource = new ArrayList<String>();
    Matcher matcher = SPLITTER.matcher("_" + order.getProperty());
    while (matcher.find()) {
      iteratorSource.add(matcher.group(1));
    }
    String mappedPropertyPath = getMappedPropertyPath(rootEntity, iteratorSource);
    if (mappedPropertyPath != null) {
      filteredOrders.add(order.withProperty(mappedPropertyPath));
    }
  }
  return filteredOrders.isEmpty() ? Sort.unsorted() : Sort.by(filteredOrders);
}
org.springframework.data.domainSort$OrderwithProperty

Javadoc

Returns a new Order

Popular methods of Sort$Order

  • getProperty
    Returns the property to order for.
  • getDirection
    Returns the order the property shall be sorted for.
  • <init>
    Creates a new Order instance. if order is null then order defaults to Sort#DEFAULT_DIRECTION
  • isAscending
    Returns whether sorting for this property shall be ascending.
  • isIgnoreCase
  • getNullHandling
  • ignoreCase
  • by
  • desc
    Creates a new Order instance. Takes a single property. Direction is Direction#ASC and NullHandling N
  • with
  • asc
    Creates a new Order instance. Takes a single property. Direction is Direction#ASC and NullHandling N
  • isDescending
    Returns whether sorting for this property shall be descending.
  • asc,
  • isDescending

Popular in Java

  • Reading from database using SQL prepared statement
  • scheduleAtFixedRate (Timer)
  • runOnUiThread (Activity)
  • setContentView (Activity)
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • JFrame (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