Package org.springframework.data.web.SortDefault

Examples of org.springframework.data.web.SortDefault.SortDefaults


   * @return the default {@link Sort} instance derived from the parameter annotations or the configured fallback-sort
   *         {@link #setFallbackSort(Sort)}.
   */
  private Sort getDefaultFromAnnotationOrFallback(MethodParameter parameter) {

    SortDefaults annotatedDefaults = parameter.getParameterAnnotation(SortDefaults.class);
    SortDefault annotatedDefault = parameter.getParameterAnnotation(SortDefault.class);

    if (annotatedDefault != null && annotatedDefaults != null) {
      throw new IllegalArgumentException(String.format(
          "Cannot use both @%s and @%s on parameter %s! Move %s into %s to define sorting order!", SORT_DEFAULTS_NAME,
          SORT_DEFAULT_NAME, parameter.toString(), SORT_DEFAULT_NAME, SORT_DEFAULTS_NAME));
    }

    if (annotatedDefault != null) {
      return appendOrCreateSortTo(annotatedDefault, null);
    }

    if (annotatedDefaults != null) {
      Sort sort = null;
      for (SortDefault currentAnnotatedDefault : annotatedDefaults.value()) {
        sort = appendOrCreateSortTo(currentAnnotatedDefault, sort);
      }
      return sort;
    }

View Full Code Here

TOP

Related Classes of org.springframework.data.web.SortDefault.SortDefaults

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.