Package com.easydesk.security.util
Class RoleComparator
java.lang.Object
com.easydesk.security.util.RoleComparator
- All Implemented Interfaces:
Comparator<Role>
RoleHierarchy 에 따라 Role 을 정렬하는 Comparator. 상위 role 이 앞에 온다.
- Author:
- Youngho Cho
-
Constructor Summary
ConstructorsConstructorDescriptionRoleComparator(RoleHierarchy<Role> hierachy) RoleHierarchy 로 RoleComparator 를 생성한다. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
RoleComparator
RoleHierarchy 로 RoleComparator 를 생성한다.- Parameters:
hierachy- role 의 상하 관계를 판단하는 RoleHierarchy
-
-
Method Details
-
compare
두 role 을 계층 순서로 비교한다.- Specified by:
comparein interfaceComparator<Role>- Parameters:
r1- 비교할 첫 번째 roler2- 비교할 두 번째 role- Returns:
- r1 이 상위이면 음수, r2 가 상위이면 양수, 같은 수준이면 0
-