Tabnine Logo
Sort$Order.isAscending
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: spring-projects/spring-data-mongodb

/**
 * @return the sort {@link Document}.
 */
public Document getSortObject() {
  if (this.sort.isUnsorted()) {
    return new Document();
  }
  Document document = new Document();
  this.sort.stream()//
      .forEach(order -> document.put(order.getProperty(), order.isAscending() ? 1 : -1));
  return document;
}
origin: spring-projects/spring-data-mongodb

  @Override
  public Document toDocument(AggregationOperationContext context) {

    Document object = new Document();

    for (Order order : sort) {

      // Check reference
      FieldReference reference = context.getReference(order.getProperty());
      object.put(reference.getRaw(), order.isAscending() ? 1 : -1);
    }

    return new Document("$sort", object);
  }
}
origin: spring-projects/spring-data-mongodb

private static Document getSortObject(Sort sort) {
  Document document = new Document();
  for (Order order : sort) {
    document.put(order.getProperty(), order.isAscending() ? 1 : -1);
  }
  return document;
}
origin: org.springframework.data/spring-data-neo4j

  public static SortOrder convert(Sort sort) {

    SortOrder sortOrder = new SortOrder();

    if (sort != Sort.unsorted()) {
      for (Sort.Order order : sort) {
        if (order.isAscending()) {
          sortOrder.add(order.getProperty());
        } else {
          sortOrder.add(SortOrder.Direction.DESC, order.getProperty());
        }
      }
    }
    return sortOrder;
  }
}
origin: spring-projects/spring-data-keyvalue

@SuppressWarnings({ "rawtypes", "unchecked" })
private static OrderSpecifier<?> toOrderSpecifier(Order order, PathBuilder<?> builder) {
  return new OrderSpecifier(
      order.isAscending() ? com.querydsl.core.types.Order.ASC : com.querydsl.core.types.Order.DESC,
      buildOrderPropertyPathFrom(order, builder), toQueryDslNullHandling(order.getNullHandling()));
}
origin: org.springframework.data/spring-data-keyvalue

@SuppressWarnings({ "rawtypes", "unchecked" })
private static OrderSpecifier<?> toOrderSpecifier(Order order, PathBuilder<?> builder) {
  return new OrderSpecifier(
      order.isAscending() ? com.querydsl.core.types.Order.ASC : com.querydsl.core.types.Order.DESC,
      buildOrderPropertyPathFrom(order, builder), toQueryDslNullHandling(order.getNullHandling()));
}
origin: apache/servicemix-bundles

@SuppressWarnings({ "rawtypes", "unchecked" })
private static OrderSpecifier<?> toOrderSpecifier(Order order, PathBuilder<?> builder) {
  return new OrderSpecifier(
      order.isAscending() ? com.querydsl.core.types.Order.ASC : com.querydsl.core.types.Order.DESC,
      buildOrderPropertyPathFrom(order, builder), toQueryDslNullHandling(order.getNullHandling()));
}
origin: org.springframework.data/spring-data-jpa

/**
 * Transforms a plain {@link Order} into a QueryDsl specific {@link OrderSpecifier}.
 *
 * @param order must not be {@literal null}.
 * @return
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
private OrderSpecifier<?> toOrderSpecifier(Order order) {
  return new OrderSpecifier(
      order.isAscending() ? com.querydsl.core.types.Order.ASC : com.querydsl.core.types.Order.DESC,
      buildOrderPropertyPathFrom(order), toQueryDslNullHandling(order.getNullHandling()));
}
origin: com.epam.reportportal/commons-dao

@Override
public DBObject toDBObject(AggregationOperationContext context) {
  BasicDBObject object = new BasicDBObject();
  sort.forEach(it -> object.put(it.getProperty(), it.isAscending() ? 1 : -1));
  return new BasicDBObject("$sort", object);
}
origin: spring-projects/spring-data-neo4j

  @Override
  public SortOrder getOgmSort() {
    SortOrder sortOrder = new SortOrder();

    if (getSort() != null) {
      for (Sort.Order order : getSort()) {
        if (order.isAscending()) {
          sortOrder.add(order.getProperty());
        } else {
          sortOrder.add(SortOrder.Direction.DESC, order.getProperty());
        }
      }
    }
    return sortOrder;
  }
}
origin: spring-projects/spring-data-neo4j

  public static SortOrder convert(Sort sort) {

    SortOrder sortOrder = new SortOrder();

    if (sort != Sort.unsorted()) {
      for (Sort.Order order : sort) {
        if (order.isAscending()) {
          sortOrder.add(order.getProperty());
        } else {
          sortOrder.add(SortOrder.Direction.DESC, order.getProperty());
        }
      }
    }
    return sortOrder;
  }
}
origin: org.springframework.data/spring-data-mongodb

private static Document getSortObject(Sort sort) {
  Document document = new Document();
  for (Order order : sort) {
    document.put(order.getProperty(), order.isAscending() ? 1 : -1);
  }
  return document;
}
origin: org.springframework.data/spring-data-mongodb

  private static Direction toDirection(Sort sort, String property) {

    if (sort.isUnsorted()) {
      return Direction.DESC;
    }

    Order order = sort.getOrderFor(property);
    return order == null ? Direction.DESC : order.isAscending() ? Direction.ASC : Direction.DESC;
  }
}
origin: org.springframework.data/spring-data-mongodb

  /**
   * Transforms a plain {@link Order} into a Querydsl specific {@link OrderSpecifier}.
   *
   * @param order
   * @return
   */
  @SuppressWarnings({ "rawtypes", "unchecked" })
  private OrderSpecifier<?> toOrder(Order order) {

    Expression<Object> property = builder.get(order.getProperty());

    return new OrderSpecifier(
        order.isAscending() ? com.querydsl.core.types.Order.ASC : com.querydsl.core.types.Order.DESC, property);
  }
}
origin: org.springframework.data/spring-data-mongodb

/**
 * @return the sort {@link Document}.
 */
public Document getSortObject() {
  if (this.sort.isUnsorted()) {
    return new Document();
  }
  Document document = new Document();
  this.sort.stream()//
      .forEach(order -> document.put(order.getProperty(), order.isAscending() ? 1 : -1));
  return document;
}
origin: org.springframework.data/spring-data-mongodb

  @Override
  public Document toDocument(AggregationOperationContext context) {

    Document object = new Document();

    for (Order order : sort) {

      // Check reference
      FieldReference reference = context.getReference(order.getProperty());
      object.put(reference.getRaw(), order.isAscending() ? 1 : -1);
    }

    return new Document("$sort", object);
  }
}
origin: spring-projects/spring-data-jpa

/**
 * Creates a criteria API {@link javax.persistence.criteria.Order} from the given {@link Order}.
 *
 * @param order the order to transform into a JPA {@link javax.persistence.criteria.Order}
 * @param from the {@link From} the {@link Order} expression is based on
 * @param cb the {@link CriteriaBuilder} to build the {@link javax.persistence.criteria.Order} with
 * @return
 */
@SuppressWarnings("unchecked")
private static javax.persistence.criteria.Order toJpaOrder(Order order, From<?, ?> from, CriteriaBuilder cb) {
  PropertyPath property = PropertyPath.from(order.getProperty(), from.getJavaType());
  Expression<?> expression = toExpressionRecursively(from, property);
  if (order.isIgnoreCase() && String.class.equals(expression.getJavaType())) {
    Expression<String> lower = cb.lower((Expression<String>) expression);
    return order.isAscending() ? cb.asc(lower) : cb.desc(lower);
  } else {
    return order.isAscending() ? cb.asc(expression) : cb.desc(expression);
  }
}
origin: spring-projects/spring-data-mongodb

/**
 * Transforms a plain {@link Order} into a Querydsl specific {@link OrderSpecifier}.
 *
 * @param order
 * @return
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
protected OrderSpecifier<?> toOrder(Order order) {
  Expression<Object> property = builder.get(order.getProperty());
  return new OrderSpecifier(
      order.isAscending() ? com.querydsl.core.types.Order.ASC : com.querydsl.core.types.Order.DESC, property);
}
origin: spring-projects/spring-data-mongodb

  private static Direction toDirection(Sort sort, String property) {

    if (sort.isUnsorted()) {
      return Direction.DESC;
    }

    Order order = sort.getOrderFor(property);
    return order == null ? Direction.DESC : order.isAscending() ? Direction.ASC : Direction.DESC;
  }
}
origin: spring-projects/spring-data-jpa

/**
 * Transforms a plain {@link Order} into a QueryDsl specific {@link OrderSpecifier}.
 *
 * @param order must not be {@literal null}.
 * @return
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
private OrderSpecifier<?> toOrderSpecifier(Order order) {
  return new OrderSpecifier(
      order.isAscending() ? com.querydsl.core.types.Order.ASC : com.querydsl.core.types.Order.DESC,
      buildOrderPropertyPathFrom(order), toQueryDslNullHandling(order.getNullHandling()));
}
org.springframework.data.domainSort$OrderisAscending

Javadoc

Returns whether sorting for this property shall be ascending.

Popular methods of Sort$Order

  • getProperty
    Returns the property to order for.
  • getDirection
    Returns the order the property shall be sorted for.
  • <init>
  • 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.
  • withProperty
  • isDescending,
  • withProperty

Popular in Java

  • Creating JSON documents from java classes using gson
  • onCreateOptionsMenu (Activity)
  • runOnUiThread (Activity)
  • compareTo (BigDecimal)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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