forked from plusone/plusone-commons
优化代码。
This commit is contained in:
parent
33b271ddbe
commit
245c31bdce
2
pom.xml
2
pom.xml
@ -45,6 +45,8 @@
|
|||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Test dependencies -->
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ch.qos.logback</groupId>
|
<groupId>ch.qos.logback</groupId>
|
||||||
<artifactId>logback-classic</artifactId>
|
<artifactId>logback-classic</artifactId>
|
||||||
|
@ -20,7 +20,6 @@ import java.util.Collections;
|
|||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
@ -60,10 +59,9 @@ public class PagingAndSortingQueryParams {
|
|||||||
public PagingAndSortingQueryParams(Map<String, String> sortableProperties) {
|
public PagingAndSortingQueryParams(Map<String, String> sortableProperties) {
|
||||||
Preconditions.checkArgument(sortableProperties != null && !sortableProperties.isEmpty(),
|
Preconditions.checkArgument(sortableProperties != null && !sortableProperties.isEmpty(),
|
||||||
"Sortable properties can not be empty.");
|
"Sortable properties can not be empty.");
|
||||||
for (Entry<String, String> p : sortableProperties.entrySet()) {
|
sortableProperties.forEach((k, v) ->
|
||||||
Preconditions.checkArgument(StringUtils.isNotBlank(p.getKey()) && StringUtils.isNotBlank(p.getValue()),
|
Preconditions.checkArgument(StringUtils.isNotBlank(k) && StringUtils.isNotBlank(v),
|
||||||
"Property name must not be blank.");
|
"Property name must not be blank."));
|
||||||
}
|
|
||||||
this.sortableProperties = ImmutableMap.copyOf(sortableProperties);
|
this.sortableProperties = ImmutableMap.copyOf(sortableProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,10 +124,8 @@ class MenuList extends Menu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static MenuList of(String parentMenuCode, String menuCode, String title, Iterable<Menu> children, int orderNum) {
|
static MenuList of(String parentMenuCode, String menuCode, String title, Iterable<Menu> children, int orderNum) {
|
||||||
MenuList instance = of(parentMenuCode, menuCode, title, orderNum);
|
final MenuList instance = of(parentMenuCode, menuCode, title, orderNum);
|
||||||
for (Menu child : children) {
|
children.forEach(instance::addChild);
|
||||||
instance.addChild(child);
|
|
||||||
}
|
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user