public class ModelObjectUtils extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
ModelObjectUtils.Transformer<A,B> |
Modifier and Type | Method and Description |
---|---|
static <T> T |
buildImmutable(ModelBuilder builder) |
static <T> List<T> |
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 <B> Set<B> |
buildImmutableCopy(Set<? extends ModelBuilder> toConvert) |
static <T> List<T> |
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 <K,V> Map<K,V> |
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 <T> Set<T> |
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 <A,B> List<B> |
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 <A,B> Set<B> |
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>.
|
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 nullpublic static <B> Set<B> buildImmutableCopy(Set<? extends ModelBuilder> toConvert)
public static <T> T buildImmutable(ModelBuilder builder)
public static <T> List<T> createImmutableCopy(List<T> listToCopy)
T
- the type of the elements in the given listlistToCopy
- the list to copypublic static <T> Set<T> createImmutableCopy(Set<T> setToCopy)
T
- the type of the elements in the given setsetToCopy
- the set to copypublic 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
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
- Copyright © 2005–2014 The Kuali Foundation. All rights reserved.