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

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

Best Java code snippets using org.springframework.data.domain.Sort$Order.by (Showing top 6 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: apache/servicemix-bundles

private static Optional<Order> toOrder(String property, Optional<Direction> direction) {
  if (!StringUtils.hasText(property)) {
    return Optional.empty();
  }
  return Optional.of(direction.map(it -> new Order(it, property)).orElseGet(() -> Order.by(property)));
}
origin: apache/servicemix-bundles

/**
 * Converts the given {@link OrderSpecifier} into an {@link Order}.
 *
 * @param orderSpecifier must not be {@literal null}.
 * @return
 */
private static Order toOrder(OrderSpecifier<?> orderSpecifier) {
  Assert.notNull(orderSpecifier, "Order specifier must not be null!");
  Expression<?> target = orderSpecifier.getTarget();
  Object targetElement = target instanceof Path ? preparePropertyPath((Path<?>) target) : target;
  Assert.notNull(targetElement, "Target element must not be null!");
  return Order.by(targetElement.toString()).with(orderSpecifier.isAscending() ? Direction.ASC : Direction.DESC);
}
origin: apache/servicemix-bundles

/**
 * Creates an {@link Order} instance from the given property source, direction and domain class. If the domain class
 * is given, we will use it for nested property traversal checks.
 *
 * @param propertySource
 * @param direction must not be {@literal null}.
 * @param domainClass must not be {@literal null}.
 * @return
 * @see PropertyPath#from(String, Class)
 */
private Order createOrder(String propertySource, Optional<Direction> direction, Optional<Class<?>> domainClass) {
  return domainClass.map(type -> {
    PropertyPath propertyPath = PropertyPath.from(propertySource, type);
    return direction.map(it -> new Order(it, propertyPath.toDotPath()))
        .orElseGet(() -> Order.by(propertyPath.toDotPath()));
  }).orElseGet(() -> direction//
      .map(it -> new Order(it, StringUtils.uncapitalize(propertySource)))
      .orElseGet(() -> Order.by(StringUtils.uncapitalize(propertySource))));
}
origin: spring-projects/spring-data-r2dbc

@Override
public Sort getMappedSort(Class<?> typeToRead, Sort sort) {
  RelationalPersistentEntity<?> entity = getPersistentEntity(typeToRead);
  if (entity == null) {
    return sort;
  }
  List<Order> mappedOrder = new ArrayList<>();
  for (Order order : sort) {
    RelationalPersistentProperty persistentProperty = entity.getPersistentProperty(order.getProperty());
    if (persistentProperty == null) {
      mappedOrder.add(order);
    } else {
      mappedOrder
          .add(Order.by(persistentProperty.getColumnName()).with(order.getNullHandling()).with(order.getDirection()));
    }
  }
  return Sort.by(mappedOrder);
}
origin: BBVA/mirrorgate

@Test
public void getActiveUserStoriesByProjectNameTest() {
  DashboardDTO dashboard = TestObjectFactory.createDashboard();
  Feature story1 = TestObjectFactory.createActiveStory();
  Feature story2 = TestObjectFactory.createActiveStory();
  List<Feature> stories = new ArrayList<>();
  stories.add(story1);
  stories.add(story2);
  when(featureRepository.findActiveUserStoriesByBoards(Collections.singletonList(dashboard.getName()),
      Sort.by(Order.by("sStatus")))).thenReturn(stories);
  List<Feature> activeStoriesByDashboardName
      = featureService.getActiveUserStoriesByBoards(Collections.singletonList(dashboard.getName()));
  verify(featureRepository, times(1))
      .findActiveUserStoriesByBoards(Collections.singletonList(dashboard.getName()), Sort.by(Order.by("sStatus")));
  assertThat(activeStoriesByDashboardName.get(0)).isEqualTo(story1);
  assertThat(activeStoriesByDashboardName.get(1)).isEqualTo(story2);
}
origin: org.springframework.data/spring-data-r2dbc

@Override
public Sort getMappedSort(Class<?> typeToRead, Sort sort) {
  RelationalPersistentEntity<?> entity = getPersistentEntity(typeToRead);
  if (entity == null) {
    return sort;
  }
  List<Order> mappedOrder = new ArrayList<>();
  for (Order order : sort) {
    RelationalPersistentProperty persistentProperty = entity.getPersistentProperty(order.getProperty());
    if (persistentProperty == null) {
      mappedOrder.add(order);
    } else {
      mappedOrder
          .add(Order.by(persistentProperty.getColumnName()).with(order.getNullHandling()).with(order.getDirection()));
    }
  }
  return Sort.by(mappedOrder);
}
org.springframework.data.domainSort$Orderby

Javadoc

Creates a new Order instance. Takes a single property. Direction defaults to Sort#DEFAULT_DIRECTION.

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
  • 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

  • Reactive rest calls using spring rest template
  • getSystemService (Context)
  • addToBackStack (FragmentTransaction)
  • getContentResolver (Context)
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • BitSet (java.util)
    This class implements a vector of bits that grows as needed. Each component of the bit set has a boo
  • Hashtable (java.util)
    Hashtable is a synchronized implementation of Map. All optional operations are supported.Neither key
  • ResourceBundle (java.util)
    Resource bundles contain locale-specific objects. When your program needs a locale-specific resource
  • TreeMap (java.util)
    A Red-Black tree based NavigableMap implementation. The map is sorted according to the Comparable of
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