public final class CollectionFactory
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private static boolean |
DEFAULT_PROTECT_READ_ONLY_COLLECTIONS |
private static java.lang.ThreadLocal<java.lang.Boolean> |
PROTECT_READ_ONLY_COLLECTIONS |
private static java.lang.String |
PROTECT_READ_ONLY_COLLECTIONS_PROP |
| Modifier | Constructor and Description |
|---|---|
private |
CollectionFactory() |
| Modifier and Type | Method and Description |
|---|---|
static void |
clearProtection() |
static <T> java.util.List<T> |
getList(java.lang.Class<T> type) |
static <T> java.util.List<T> |
getProtectedList(java.util.List<T> list)
Call this to obtain a list to return from a public API where the caller is not supposed to modify the
list.
|
static <K,V> java.util.Map<K,V> |
getProtectedMap(java.util.Map<K,V> map)
Call this to obtain a map to return from a public API where the caller is not supposed to modify the
map.
|
static <T> java.util.Set<T> |
getSet(java.lang.Class<T> type) |
private static boolean |
isProtected() |
static void |
setProtected(boolean b)
Turns on or off protection of collections for this thread.
|
static void |
withSchemaModifiable(java.lang.Runnable action) |
private static final java.lang.String PROTECT_READ_ONLY_COLLECTIONS_PROP
private static final boolean DEFAULT_PROTECT_READ_ONLY_COLLECTIONS
private static final java.lang.ThreadLocal<java.lang.Boolean> PROTECT_READ_ONLY_COLLECTIONS
public static <T> java.util.List<T> getList(java.lang.Class<T> type)
public static <T> java.util.Set<T> getSet(java.lang.Class<T> type)
private static boolean isProtected()
public static void setProtected(boolean b)
b - public static void clearProtection()
public static <T> java.util.List<T> getProtectedList(java.util.List<T> list)
T - Generic parameter type of the list.list - the list.public static <K,V> java.util.Map<K,V> getProtectedMap(java.util.Map<K,V> map)
K - key typeV - value typemap - the map.public static void withSchemaModifiable(java.lang.Runnable action)