|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.kuali.rice.core.api.mo.ModelObjectUtils
public class ModelObjectUtils
A set of simple utilities to assist with common idioms in immutable model objects and their builders.
Nested Class Summary | |
---|---|
static interface |
ModelObjectUtils.Transformer<A,B>
|
Method Summary | ||
---|---|---|
static
|
buildImmutableCopy(List<? extends ModelBuilder> builderList)
Takes the given list of ModelBuilder objects and invokes the
ModelBuilder.build() method on each of them, adding them to a new list and
return an unmodifiable copy. |
|
static
|
buildImmutableCopy(Set<? extends ModelBuilder> toConvert)
|
|
static
|
createImmutableCopy(List<T> listToCopy)
Takes the given list and returns an unmodifiable copy of that list containing the same elements as the original list. |
|
static
|
createImmutableCopy(Map<K,V> mapToCopy)
Takes the given map and returns an unmodifiable copy of that map containing the same entries as the original map. |
|
static
|
createImmutableCopy(Set<T> setToCopy)
Takes the given set and returns an unmodifiable copy of that set containing the same elements as the original set. |
|
static
|
transform(Collection<? extends A> toConvert,
ModelObjectUtils.Transformer<A,B> xform)
This method is useful for converting a List<? extends BlahContract> to a List<Blah.Builder>. |
|
static
|
transformSet(Collection<? extends A> toConvert,
ModelObjectUtils.Transformer<A,B> xform)
This method is useful for converting a Set<? extends BlahContract> to a Set<Blah.Builder>. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <T> List<T> buildImmutableCopy(List<? extends ModelBuilder> builderList)
ModelBuilder
objects and invokes the
ModelBuilder.build()
method on each of them, adding them to a new list and
return an unmodifiable copy. If the given list is empty or null, will return an empty and unmodifiable list.
T
- the type of the object that is built by the builders in the list, it is up to the caller of this
method to ensure they define the proper parameterized list for the return type.builderList
- the list of builders to build and add to resulting list, may be empty or null
public static <B> Set<B> buildImmutableCopy(Set<? extends ModelBuilder> toConvert)
public static <T> List<T> createImmutableCopy(List<T> listToCopy)
T
- the type of the elements in the given listlistToCopy
- the list to copy
public static <T> Set<T> createImmutableCopy(Set<T> setToCopy)
T
- the type of the elements in the given setsetToCopy
- the set to copy
public static <K,V> Map<K,V> createImmutableCopy(Map<K,V> mapToCopy)
mapToCopy
- the map to copy - V> the type of the key and value elements in the given map
- Returns:
- an unmodifiable copy containing the same elements as the given set
public static <A,B> List<B> transform(Collection<? extends A> toConvert, ModelObjectUtils.Transformer<A,B> xform)
A
- B
- toConvert
- xform
-
public static <A,B> Set<B> transformSet(Collection<? extends A> toConvert, ModelObjectUtils.Transformer<A,B> xform)
A
- B
- toConvert
- xform
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |