forked from apolloconfig/apollo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup for 1.3.0 (apolloconfig#1969)
* replace some guava API with new Java 1.7 native API * replace Collections.sort with List.sort(Java 1.7) * replace annonymous inner types with lambdas * use try-with-resources where possible * replace explicit types with diamond operators
- Loading branch information
1 parent
72d32a5
commit 118dd0e
Showing
19 changed files
with
72 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,6 @@ | |
import com.ctrip.framework.apollo.core.dto.ApolloConfigNotification; | ||
import com.ctrip.framework.apollo.core.utils.ApolloThreadFactory; | ||
import com.ctrip.framework.apollo.tracer.Tracer; | ||
import com.google.common.base.Function; | ||
import com.google.common.base.Splitter; | ||
import com.google.common.base.Strings; | ||
import com.google.common.collect.HashMultimap; | ||
|
@@ -45,6 +44,7 @@ | |
import java.util.concurrent.ExecutorService; | ||
import java.util.concurrent.Executors; | ||
import java.util.concurrent.TimeUnit; | ||
import java.util.function.Function; | ||
|
||
/** | ||
* @author Jason Song([email protected]) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ | |
import com.ctrip.framework.apollo.core.ConfigConsts; | ||
import com.google.common.base.Joiner; | ||
import com.google.common.base.Strings; | ||
import com.google.common.collect.FluentIterable; | ||
import com.google.common.collect.HashMultimap; | ||
import com.google.common.collect.Multimap; | ||
import com.google.common.collect.Sets; | ||
|
@@ -15,6 +14,7 @@ | |
import java.util.List; | ||
import java.util.Objects; | ||
import java.util.Set; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* @author Jason Song([email protected]) | ||
|
@@ -137,6 +137,6 @@ private Set<String> namespacesBelongToAppId(String appId, Set<String> namespaces | |
return Collections.emptySet(); | ||
} | ||
|
||
return FluentIterable.from(appNamespaces).transform(AppNamespace::getName).toSet(); | ||
return appNamespaces.stream().map(AppNamespace::getName).collect(Collectors.toSet()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,12 +6,12 @@ | |
import com.ctrip.framework.apollo.portal.entity.po.RolePermission; | ||
import com.ctrip.framework.apollo.portal.repository.PermissionRepository; | ||
import com.ctrip.framework.apollo.portal.repository.RolePermissionRepository; | ||
import com.google.common.collect.FluentIterable; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.util.CollectionUtils; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* @author Jason Song([email protected]) | ||
|
@@ -47,7 +47,7 @@ public boolean consumerHasPermission(long consumerId, String permissionType, Str | |
} | ||
|
||
Set<Long> roleIds = | ||
FluentIterable.from(consumerRoles).transform(ConsumerRole::getRoleId).toSet(); | ||
consumerRoles.stream().map(ConsumerRole::getRoleId).collect(Collectors.toSet()); | ||
List<RolePermission> rolePermissions = rolePermissionRepository.findByRoleIdIn(roleIds); | ||
if (CollectionUtils.isEmpty(rolePermissions)) { | ||
return false; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.