Key - - The type of key to use. Be sure to implement hashCode() and equals().Value - - The type of values provided.public abstract class AbstractInitMap<Key,Value> extends Object implements InitMap<Key,Value>
InitMap.initialize(Object),
which accepts the key as parameter, and return the singleton which will be set in the map.
This map IS entirely threadsafe.
The initialization process is guarded by a double-checked lock,
which is ONLY checked in jre runtime environments,
and only if the multithreading system property ("xapi.multithreaded") is set.
If you set a value manually, InitMap.initialize(Object) will not be called for that key.| Modifier and Type | Field and Description |
|---|---|
protected static ConvertsValue |
ALWAYS_NULL |
static ConvertsValue<Class<?>,String> |
CLASS_NAME |
static ConvertsValue<String,String> |
PASS_THRU |
protected static ConvertsValue |
TO_STRING
A default toString converter that just calls String.valueOf.
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractInitMap() |
protected |
AbstractInitMap(ConvertsValue<Key,String> keyProvider) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsKey(Key key) |
Value |
convert(Key from) |
Value |
get(Key k) |
protected Object |
getLock(Object forKey) |
protected boolean |
isMultiThreaded() |
Value |
put(Key key,
Value value) |
String |
toKey(Key key)
We force subclasses to deal with serializing keys to unique names,
so javascript can implement this directly on an object,
and you can achieve a degree of portability,
by making map structure deterministic.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitinitializeclearValues, forKeys, getValue, hasKey, removeValue, setValueforEach, iterator, spliteratorprotected static final ConvertsValue TO_STRING
public static final ConvertsValue<String,String> PASS_THRU
public static final ConvertsValue<Class<?>,String> CLASS_NAME
protected static final ConvertsValue ALWAYS_NULL
protected AbstractInitMap()
protected AbstractInitMap(ConvertsValue<Key,String> keyProvider)
public boolean containsKey(Key key)
containsKey in interface InitMap<Key,Value>protected boolean isMultiThreaded()
public String toKey(Key key)
InitMaptoKey in interface InitMap<Key,Value>key - - A key of whatever type you want. Use Pair or Triple to overload.Copyright © December 07, 2012–2015 The Internet Party. All rights reserved.