public class SubjectApiUtils extends Object
Constructor and Description |
---|
SubjectApiUtils() |
Modifier and Type | Method and Description |
---|---|
static <T> List<T> |
batchList(List<T> collection,
int batchSize,
int batchIndex)
retrieve a batch by 0 index.
|
static int |
batchNumberOfBatches(Collection<?> collection,
int batchSize)
If batching this is the number of batches
|
static int |
batchNumberOfBatches(int count,
int batchSize)
If batching this is the number of batches
|
static String |
convertToInClauseForSqlStatic(Collection<String> collection)
convert a collection of strings (no parens) to an in clause
|
static String |
convertUrlToDriverClassIfNeeded(String connectionUrl,
String driverClassName)
if there is no driver class specified, then try to derive it from the URL
|
static boolean |
isHsql(String connectionUrl)
see if the config file seems to be hsql
|
static boolean |
isMysql(String connectionUrl)
see if the config file seems to be mysql
|
static boolean |
isOracle(String connectionUrl)
see if the config file seems to be oracle
|
static boolean |
isPostgres(String connectionUrl)
see if the config file seems to be postgres
|
static boolean |
isSQLServer(String connectionUrl)
see if the config file seems to be sql server
|
static int |
length(Object arrayOrCollection)
Null safe array length or map
|
static <T> Collection<T> |
nonNull(Collection<T> list)
make sure a collection is non null.
|
static <T> List<T> |
nonNull(List<T> list)
make sure a list is non null.
|
static <K,V> Map<K,V> |
nonNull(Map<K,V> map)
make sure it is non null, if null, then give new map
|
static <T> Set<T> |
nonNull(Set<T> set)
make sure a list is non null.
|
static <T> T[] |
nonNull(T[] array,
Class<?> theClass)
make sure a array is non null.
|
static String |
subjectToString(Subject subject)
convert a subject to string safely
|
static <T> Set<T> |
toSet(T... objects)
return a set of objects from varargs.
|
public static String subjectToString(Subject subject)
subject
- public static int length(Object arrayOrCollection)
arrayOrCollection
- public static <T> Set<T> toSet(T... objects)
T
- template type of the objectsobjects
- public static String convertUrlToDriverClassIfNeeded(String connectionUrl, String driverClassName)
connectionUrl
- driverClassName
- public static boolean isHsql(String connectionUrl)
connectionUrl
- url to check againstpublic static boolean isMysql(String connectionUrl)
connectionUrl
- public static boolean isOracle(String connectionUrl)
connectionUrl
- public static boolean isPostgres(String connectionUrl)
connectionUrl
- public static boolean isSQLServer(String connectionUrl)
connectionUrl
- public static <T> List<T> batchList(List<T> collection, int batchSize, int batchIndex)
T
- template typecollection
- batchSize
- batchIndex
- public static int batchNumberOfBatches(Collection<?> collection, int batchSize)
collection
- batchSize
- public static int batchNumberOfBatches(int count, int batchSize)
count
- is size of setbatchSize
- public static String convertToInClauseForSqlStatic(Collection<String> collection)
collection
- public static <T> Collection<T> nonNull(Collection<T> list)
T
- list
- public static <T> List<T> nonNull(List<T> list)
T
- list
- public static <K,V> Map<K,V> nonNull(Map<K,V> map)
K
- key of mapV
- value of mapmap
- is mappublic static <T> Set<T> nonNull(Set<T> set)
T
- set
- public static <T> T[] nonNull(T[] array, Class<?> theClass)
T
- array
- theClass
- to make array fromCopyright © 2016 Internet2. All rights reserved.