|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openpermis.policy.bean.basic.BasicUtilities
public final class BasicUtilities
Helper functions for part implementations.
Nested Class Summary | |
---|---|
static class |
BasicUtilities.DetailsProvider<T>
Provides string details about an item. |
Field Summary | |
---|---|
static int |
NOT_FOUND
Constant used by list functions to indicate that no entry could be found. |
Method Summary | ||
---|---|---|
static boolean |
equalLists(List<?> list1,
List<?> list2)
Compares two lists without respecting the list order. |
|
static boolean |
equalObjects(Object obj1,
Object obj2)
Convenience function to test if two objects are both null or equivalent. |
|
static
|
findDuplicateSerialNumberInList(List<T> list)
Finds the position of the first entry with a duplicate serial number. |
|
static
|
getDetails(Iterable<T> collection,
BasicUtilities.DetailsProvider<T> provider)
Returns the details for the specified collection using the provider passed. |
|
static String |
getIdentityDetails(Identifiable item)
Returns the identity of the specified part item. |
|
static
|
getIdentityDetails(Iterable<T> collection)
Returns the string details representation for the specified collection. |
|
static
|
getNameDetails(Iterable<T> collection)
Returns the string details representation for the specified collection. |
|
static String |
getNameDetails(Nameable item)
Returns the name of the specified part item. |
|
static
|
getShortStringDetails(Iterable<T> collection)
Returns the string details representation for the specified collection. |
|
static
|
getStringDetails(Iterable<T> collection)
Returns the string details representation for the specified collection. |
|
static int |
listHashCode(Iterator<?> iterator)
Computes the hash code of a list without respecting the list order. |
|
static int |
listHashCode(List<?> list)
Computes the hash code of a list without respecting the list order. |
|
static int |
multiHashCode(int... values)
Convenience function to create a hash code by combining several other hash code values. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int NOT_FOUND
-1
Method Detail |
---|
public static final int multiHashCode(int... values)
Use this method instead of combining multiple hash codes yourself. This method provides a suitable distribution of hash codes.
values
- the values to combine.
public static final int listHashCode(List<?> list)
Use if a list is used as if it were a set
that allows multiple
objects that are equal
.
equalLists(List, List)
!list
- the list for which to compute the hash code.equalLists(List, List)
public static final int listHashCode(Iterator<?> iterator)
Use if a list is used as if it were a set
that allows multiple
objects that are equal
.
equalLists(List, List)
!iterator
- the iterator for which to compute the hash code.equalLists(List, List)
public static final boolean equalLists(List<?> list1, List<?> list2)
Use if a list is used as if it were a set
that allows multiple
objects that are equal
.
listHashCode(List)
!list1
- the first list.list2
- the second list.
true
if the two lists have an equivalent content, disregarding the order
of their entries.public static final boolean equalObjects(Object obj1, Object obj2)
null
or equivalent.
obj1
- the first object.obj2
- the second object.
true
if both objects are null
or equivalent.public static <T extends PartBean> int findDuplicateSerialNumberInList(List<T> list)
T
- the type of the list to search.list
- the list to search.
NOT_FOUND
if there is no such entry.public static <T> String getDetails(Iterable<T> collection, BasicUtilities.DetailsProvider<T> provider)
The collection is surrounded by curly brackets to indicate that it's a collection.
T
- the type of collection to process.collection
- the collection to process.provider
- the provider to use for string details.
public static <T> String getStringDetails(Iterable<T> collection)
The details are created using Object.toString()
of the items.
T
- the type of collection to process.collection
- the collection to process.
public static <T extends PartBean> String getShortStringDetails(Iterable<T> collection)
The details are created using Object.toString()
of the items.
T
- the type of collection to process.collection
- the collection to process.
public static <T extends Identifiable> String getIdentityDetails(Iterable<T> collection)
The details are created using the Identifiable.getIdentity()
of the items.
T
- the type of collection to process.collection
- the collection to process.
public static <T extends Nameable> String getNameDetails(Iterable<T> collection)
The details are created using the Nameable.getName()
of the items.
T
- the type of collection to process.collection
- the collection to process.
public static String getIdentityDetails(Identifiable item)
The value is returned in square brackets to indicate that it's an object.
item
- the item to inspect, may be null
.
null
if the item specified is null.public static String getNameDetails(Nameable item)
The value is returned in curly brackets to indicate that it's an object.
item
- the item to inspect, may be null
.
null
if the item specified is null.
|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
OpenPermis Role Based Access Control 0.9.0 (Build 16)
2009/08/13 07:16:59
Copyright (c) 2002-2007 Ergon Informatik AG