DATACMNS-1551 - Polishing.
Formatting.
This commit is contained in:
@@ -35,7 +35,7 @@ import org.springframework.web.method.support.ModelAndViewContainer;
|
||||
/**
|
||||
* {@link HandlerMethodArgumentResolver} to automatically create {@link Sort} instances from request parameters or
|
||||
* {@link SortDefault} annotations.
|
||||
*
|
||||
*
|
||||
* @since 1.6
|
||||
* @author Oliver Gierke
|
||||
* @author Thomas Darimont
|
||||
@@ -59,7 +59,7 @@ public class SortHandlerMethodArgumentResolver implements SortArgumentResolver {
|
||||
|
||||
/**
|
||||
* Configure the request parameter to lookup sort information from. Defaults to {@code sort}.
|
||||
*
|
||||
*
|
||||
* @param sortParameter must not be {@literal null} or empty.
|
||||
*/
|
||||
public void setSortParameter(String sortParameter) {
|
||||
@@ -71,7 +71,7 @@ public class SortHandlerMethodArgumentResolver implements SortArgumentResolver {
|
||||
/**
|
||||
* Configures the delimiter used to separate property references and the direction to be sorted by. Defaults to
|
||||
* {@code}, which means sort values look like this: {@code firstname,lastname,asc}.
|
||||
*
|
||||
*
|
||||
* @param propertyDelimiter must not be {@literal null} or empty.
|
||||
*/
|
||||
public void setPropertyDelimiter(String propertyDelimiter) {
|
||||
@@ -83,14 +83,14 @@ public class SortHandlerMethodArgumentResolver implements SortArgumentResolver {
|
||||
/**
|
||||
* Configures the delimiter used to separate the qualifier from the sort parameter. Defaults to {@code _}, so a
|
||||
* qualified sort property would look like {@code qualifier_sort}.
|
||||
*
|
||||
*
|
||||
* @param qualifierDelimiter the qualifier delimiter to be used or {@literal null} to reset to the default.
|
||||
*/
|
||||
public void setQualifierDelimiter(String qualifierDelimiter) {
|
||||
this.qualifierDelimiter = qualifierDelimiter == null ? DEFAULT_QUALIFIER_DELIMITER : qualifierDelimiter;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.web.method.support.HandlerMethodArgumentResolver#supportsParameter(org.springframework.core.MethodParameter)
|
||||
*/
|
||||
@@ -126,7 +126,7 @@ public class SortHandlerMethodArgumentResolver implements SortArgumentResolver {
|
||||
* Reads the default {@link Sort} to be used from the given {@link MethodParameter}. Rejects the parameter if both an
|
||||
* {@link SortDefaults} and {@link SortDefault} annotation is found as we cannot build a reliable {@link Sort}
|
||||
* instance then (property ordering).
|
||||
*
|
||||
*
|
||||
* @param parameter will never be {@literal null}.
|
||||
* @return the default {@link Sort} instance derived from the parameter annotations or the configured fallback-sort
|
||||
* {@link #setFallbackSort(Sort)}.
|
||||
@@ -160,7 +160,7 @@ public class SortHandlerMethodArgumentResolver implements SortArgumentResolver {
|
||||
/**
|
||||
* Creates a new {@link Sort} instance from the given {@link SortDefault} or appends it to the given {@link Sort}
|
||||
* instance if it's not {@literal null}.
|
||||
*
|
||||
*
|
||||
* @param sortDefault
|
||||
* @param sortOrNull
|
||||
* @return
|
||||
@@ -179,7 +179,7 @@ public class SortHandlerMethodArgumentResolver implements SortArgumentResolver {
|
||||
|
||||
/**
|
||||
* Returns the sort parameter to be looked up from the request. Potentially applies qualifiers to it.
|
||||
*
|
||||
*
|
||||
* @param parameter will never be {@literal null}.
|
||||
* @return
|
||||
*/
|
||||
@@ -198,7 +198,7 @@ public class SortHandlerMethodArgumentResolver implements SortArgumentResolver {
|
||||
* Parses the given sort expressions into a {@link Sort} instance. The implementation expects the sources to be a
|
||||
* concatenation of Strings using the given delimiter. If the last element can be parsed into a {@link Direction} it's
|
||||
* considered a {@link Direction} and a simple property otherwise.
|
||||
*
|
||||
*
|
||||
* @param source will never be {@literal null}.
|
||||
* @param delimiter the delimiter to be used to split up the source elements, will never be {@literal null}.
|
||||
* @return
|
||||
@@ -247,7 +247,7 @@ public class SortHandlerMethodArgumentResolver implements SortArgumentResolver {
|
||||
/**
|
||||
* Folds the given {@link Sort} instance into a {@link List} of sort expressions, accumulating {@link Order} instances
|
||||
* of the same direction into a single expression if they are in order.
|
||||
*
|
||||
*
|
||||
* @param sort must not be {@literal null}.
|
||||
* @return
|
||||
*/
|
||||
@@ -270,13 +270,13 @@ public class SortHandlerMethodArgumentResolver implements SortArgumentResolver {
|
||||
builder.add(order.getProperty());
|
||||
}
|
||||
|
||||
return builder == null ? Collections.<String>emptyList() : builder.dumpExpressionIfPresentInto(expressions);
|
||||
return builder == null ? Collections.<String> emptyList() : builder.dumpExpressionIfPresentInto(expressions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Folds the given {@link Sort} instance into two expressions. The first being the property list, the second being the
|
||||
* direction.
|
||||
*
|
||||
*
|
||||
* @throws IllegalArgumentException if a {@link Sort} with multiple {@link Direction}s has been handed in.
|
||||
* @param sort must not be {@literal null}.
|
||||
* @return
|
||||
@@ -300,12 +300,12 @@ public class SortHandlerMethodArgumentResolver implements SortArgumentResolver {
|
||||
builder.add(order.getProperty());
|
||||
}
|
||||
|
||||
return builder == null ? Collections.<String>emptyList() : builder.dumpExpressionIfPresentInto(expressions);
|
||||
return builder == null ? Collections.<String> emptyList() : builder.dumpExpressionIfPresentInto(expressions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to easily build request parameter expressions for {@link Sort} instances.
|
||||
*
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
class ExpressionBuilder {
|
||||
@@ -315,7 +315,7 @@ public class SortHandlerMethodArgumentResolver implements SortArgumentResolver {
|
||||
|
||||
/**
|
||||
* Sets up a new {@link ExpressionBuilder} for properties to be sorted in the given {@link Direction}.
|
||||
*
|
||||
*
|
||||
* @param direction must not be {@literal null}.
|
||||
*/
|
||||
public ExpressionBuilder(Direction direction) {
|
||||
@@ -326,7 +326,7 @@ public class SortHandlerMethodArgumentResolver implements SortArgumentResolver {
|
||||
|
||||
/**
|
||||
* Returns whether the given {@link Order} has the same direction as the current {@link ExpressionBuilder}.
|
||||
*
|
||||
*
|
||||
* @param order must not be {@literal null}.
|
||||
* @return
|
||||
*/
|
||||
@@ -336,7 +336,7 @@ public class SortHandlerMethodArgumentResolver implements SortArgumentResolver {
|
||||
|
||||
/**
|
||||
* Adds the given property to the expression to be built.
|
||||
*
|
||||
*
|
||||
* @param property
|
||||
*/
|
||||
public void add(String property) {
|
||||
@@ -346,7 +346,7 @@ public class SortHandlerMethodArgumentResolver implements SortArgumentResolver {
|
||||
/**
|
||||
* Dumps the expression currently in build into the given {@link List} of {@link String}s. Will only dump it in case
|
||||
* there are properties piled up currently.
|
||||
*
|
||||
*
|
||||
* @param expressions
|
||||
* @return
|
||||
*/
|
||||
@@ -369,7 +369,7 @@ public class SortHandlerMethodArgumentResolver implements SortArgumentResolver {
|
||||
* <p>
|
||||
* If you set this to {@literal null}, be aware that you controller methods will get {@literal null} handed into them
|
||||
* in case no {@link Sort} data can be found in the request.
|
||||
*
|
||||
*
|
||||
* @param fallbackSort the {@link Sort} to be used as general fallback.
|
||||
*/
|
||||
public void setFallbackSort(Sort fallbackSort) {
|
||||
|
||||
@@ -38,7 +38,7 @@ import org.springframework.web.context.request.ServletWebRequest;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link SortHandlerMethodArgumentResolver}.
|
||||
*
|
||||
*
|
||||
* @since 1.6
|
||||
* @author Oliver Gierke
|
||||
* @author Thomas Darimont
|
||||
|
||||
Reference in New Issue
Block a user