com.trendmicro.grid.acl.ds
Class DSUtil

java.lang.Object
  extended by com.trendmicro.grid.acl.ds.DSUtil

public class DSUtil
extends Object

Utilities to work with the data source api.

Version:
1.0
Author:
juergen_kellerer, 2010-06-01

Method Summary
static
<E> Collection<E>
cast(Collection<? extends E> source, Class<E> cls)
          Shortens casting the given source collection to a collection of the specified class.
static
<E> List<E>
cast(List<? extends E> source, Class<E> cls)
          Shortens casting the given source collection to a collection of the specified class.
static
<E> Collection<E>
replaceNulls(Collection<E> source, E with)
          Replaces all 'null' entries in the given collection with the specified value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

cast

public static <E> Collection<E> cast(Collection<? extends E> source,
                                     Class<E> cls)
Shortens casting the given source collection to a collection of the specified class.

Type Parameters:
E - the class of the target collections elements.
Parameters:
source - the source to cast.
cls - the class of the target collections elements.
Returns:
the given collection instance without any modification.

cast

public static <E> List<E> cast(List<? extends E> source,
                               Class<E> cls)
Shortens casting the given source collection to a collection of the specified class.

Type Parameters:
E - the class of the target collections elements.
Parameters:
source - the source to cast.
cls - the class of the target collections elements.
Returns:
the given collection instance without any modification.

replaceNulls

public static <E> Collection<E> replaceNulls(Collection<E> source,
                                             E with)
Replaces all 'null' entries in the given collection with the specified value.

Type Parameters:
E - the type of the list elements.
Parameters:
source - the source list.
with - the replacement of 'null'.
Returns:
a collection that does not contain 'null' values.