public class MapArgs extends Object implements Map<String,Object>, Iterable<Object>, Serializable, Cloneable
| Modifier and Type | Class and Description |
|---|---|
static class |
MapArgs.LEntry
Map.Entry implementation.
|
| Modifier and Type | Method and Description |
|---|---|
static MapArgs.LEntry |
a(String key,
Object value)
declares a parameter that is not open for modification.
|
static MapArgs.LEntry |
aBool(String key)
declares a modifiable parameter of type boolean
and initializes it to false
|
static MapArgs.LEntry |
aBool(String key,
Boolean value) |
static MapArgs.LEntry |
aBool(String key,
Boolean value,
Map<?,?> map) |
static MapArgs.LEntry |
aBool(String key,
String strVal) |
static MapArgs.LEntry |
aBool(String key,
String strVal,
Map<?,?> map) |
static MapArgs.LEntry |
aDbl(String key)
declares a modifiable parameter of type Double or BigDecimal
and does not initialize it.
|
static MapArgs.LEntry |
aDbl(String key,
BigDecimal value)
declares a modifiable parameter of type BigDecimal
and sets the initial value.
|
static MapArgs.LEntry |
aDbl(String key,
BigDecimal value,
Map<?,?> map) |
static MapArgs.LEntry |
aDbl(String key,
Double value)
declares a modifiable parameter of type Double
and sets the initial value.
|
static MapArgs.LEntry |
aDbl(String key,
Double value,
Map<?,?> map) |
static MapArgs.LEntry |
aDbl(String key,
String strVal)
declares a modifiable parameter of type BigDecimal
and sets the initial value with a (numeric) String
|
static MapArgs.LEntry |
aDbl(String key,
String strVal,
Map<?,?> map) |
static MapArgs.LEntry |
aList(String key,
double[] arrayDouble) |
static MapArgs.LEntry |
aList(String key,
float[] arrayFloat) |
static MapArgs.LEntry |
aList(String key,
List list)
declares a modifiable parameter which is a list of simple values
(do not use for references)
|
static MapArgs.LEntry |
aList(String key,
List list,
Map<?,?> map) |
static MapArgs.LEntry |
aList(String key,
String strList) |
static MapArgs.LEntry |
aList(String key,
String strList,
Map<?,?> map) |
static MapArgs.LEntry |
aMap(String key,
Map map)
declares a modifiable parameter which is a Map where values
are of a simple type (do not use for references)
|
static MapArgs.LEntry |
aMap(String key,
Map map,
Map props) |
static MapArgs.LEntry |
aMap(String key,
String strMap) |
static MapArgs.LEntry |
aMap(String key,
String strMap,
Map props) |
static MapArgs.LEntry |
anArray(String key,
boolean[] array) |
static MapArgs.LEntry |
anArray(String key,
boolean[] array,
Map map) |
static MapArgs.LEntry |
anArray(String key,
byte[] array) |
static MapArgs.LEntry |
anArray(String key,
byte[] array,
Map map) |
static MapArgs.LEntry |
anArray(String key,
char[] array) |
static MapArgs.LEntry |
anArray(String key,
char[] array,
Map map) |
static MapArgs.LEntry |
anArray(String key,
double[] array) |
static MapArgs.LEntry |
anArray(String key,
double[] array,
Map map) |
static MapArgs.LEntry |
anArray(String key,
float[] array) |
static MapArgs.LEntry |
anArray(String key,
float[] array,
Map map) |
static MapArgs.LEntry |
anArray(String key,
int[] array)
declares a modifiable parameter of an array type.
|
static MapArgs.LEntry |
anArray(String key,
int[] array,
Map map) |
static MapArgs.LEntry |
anArray(String key,
Object[] array) |
static MapArgs.LEntry |
anArray(String key,
Object[] array,
Map map) |
static <T> Class |
anImpl(Class<T> anInterface,
Class<? extends T> aClass)
Deprecated.
|
static MapArgs.LEntry |
anInt(String key)
declares a modifiable parameter of type Integer
and does not initialize it.
|
static MapArgs.LEntry |
anInt(String key,
Integer value)
declares a modifiable parameter of type Integer
and sets the initial value.
|
static MapArgs.LEntry |
anInt(String key,
Integer value,
Map<?,?> map) |
static MapArgs.LEntry |
anInt(String key,
String strVal)
declares a modifiable parameter of type Integer
and sets the initial value with a (numeric) String
|
static MapArgs.LEntry |
anInt(String key,
String strVal,
Map<?,?> map) |
static MapArgs.LEntry |
aRef(String key)
declares a modifiable parameter of type Object
whose reference will be later found using a name.
|
static MapArgs.LEntry |
aRef(String key,
String value)
declares a modifiable parameter of type Object
whose reference will be later found using a name.
|
static MapArgs.LEntry |
aRef(String key,
String value,
Map<?,?> map) |
static MapArgs |
argList(Object... args)
factory method for specifying a list of parameter: the ensuing MapArg
has only list features.
|
static MapArgs |
argMap()
the argMap methods are convenience factories for creating pair of String key-Object value
|
static MapArgs |
argMap(MapArgs.LEntry... args)
used in combination with Entry factory methods such as a, anInt,
aDbl, aString, aRef
|
static MapArgs |
argMap(Object... args)
to use only when the corresponding object has a constructor with all needed arguments.
|
Object[] |
asFullArray(IndirectMap<String,Object> objectDictionary)
same remarks as asFullMap
|
List<Object> |
asFullList(IndirectMap<String,Object> objectDictionary)
same remarks as asFullMap
|
MapArgs |
asFullMap(IndirectMap<String,Object> objectDictionary)
better calls isSafe before calling this method otherwise
will throw an EmptyParmException.
|
List<Object> |
asList()
returns a List of values contained in this structure (without the corresponding keys).
|
static MapArgs.LEntry |
aString(String key)
declares a modifiable parameter of type String
but does not initialize it.
|
static MapArgs.LEntry |
aString(String key,
String value)
declares a modifiable parameter of type String
and sets the initials value.
|
static MapArgs.LEntry |
aString(String key,
String value,
Map<?,?> map)
declares a modifiable parameter of type String
sets the initials value and annotates some properties
|
static MapArgs.LEntry |
aStruct(String key,
Class clazz,
List list)
parameter is a list used to create a struct object.
|
static MapArgs.LEntry |
aStruct(String key,
Class clazz,
List list,
Map properties) |
static MapArgs.LEntry |
aStruct(String key,
Class clazz,
Map map) |
static MapArgs.LEntry |
aStruct(String key,
Class clazz,
Map map,
Map properties) |
static MapArgs.LEntry |
aVal(Serializable val)
same as aVal (key, value) but here the name of the key is generated from
the Class Name of the object.
|
static MapArgs.LEntry |
aVal(Serializable val,
Map properties) |
static MapArgs.LEntry |
aVal(String key,
Serializable val)
to be used for
any object that has :
Serializable implementation
a symmetric way of dealing with strings:
the toString() method returns a String that
can be used to create an Object through static method
valueOf(thatString)
A typical example are Enums
|
static MapArgs.LEntry |
aVal(String key,
Serializable val,
Map properties) |
void |
clear()
the structure being immutable this is unsupported.
|
MapArgs |
clone() |
boolean |
containsKey(Object o)
as all "get" methods from the Map interface contract
this method is implemented by testing all the values in the structure.
|
boolean |
containsValue(Object o) |
Set<Map.Entry<String,Object>> |
entrySet() |
Object |
get(int index)
the structure being immutable and having list features this
method is both efficient and guaranteed to return always the same value.
|
Object |
get(Object o) |
MapArgs.LEntry[] |
getEntries() |
boolean |
isEmpty() |
boolean |
isSafe()
tells if all "hollow" parameters have been initialized.
|
boolean |
isValuesOnly()
tells that the structure does not contain any HollowParm
object (so the contained values can be used "as is")
|
Iterator<Object> |
iterator() |
Set<String> |
keySet() |
static Property |
kv(String key,
String value) |
MapArgs |
overlap(boolean acceptNullValues,
List<Object> list) |
boolean |
overlap(boolean acceptNullValues,
MapArgs.LEntry entry)
modifies a local Entry with another entry with the same key
since modification could only operate on hollow parameters
this is used if the entry reference a HollowParm object.
|
MapArgs |
overlap(boolean acceptNullvalues,
MapArgs other)
operates a set of assignments of valued HollowParm objects
in the argument to the corresponding HollowParm object in the current structure.
|
MapArgs |
overlap(boolean acceptNullvalues,
Object[] array)
modifies the HollowObjects values with the values contained in the argument.
|
static String |
predicate(String argName,
String expr)
Deprecated.
|
boolean |
prefersList()
this Map/list has only some list features and not those of a Map.
|
static MapArgs |
proxy(Object obj)
Deprecated.
|
Object |
put(String s,
Object o)
the structure being immutable this is unsupported.
|
void |
putAll(Map<? extends String,? extends Object> map)
the structure being immutable this is unsupported.
|
static MapArgs |
rawList(Object... args)
hybrid list that may contains HollowParms
|
static MapArgs.LEntry |
ref(String key) |
Object |
remove(Object o)
the structure being immutable this is unsupported.
|
int |
size() |
Object[] |
toArray()
returns an array of values contained in this structure (without the corresponding keys).
|
String |
toString() |
Collection<Object> |
values() |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAllforEach, spliteratorpublic static MapArgs argMap()
public static MapArgs argMap(MapArgs.LEntry... args)
args - public static MapArgs argMap(Object... args)
args - public static MapArgs argList(Object... args)
args - @Deprecated public static MapArgs proxy(Object obj)
obj - public static MapArgs rawList(Object... args)
args - public static MapArgs.LEntry a(String key, Object value)
key - value - public static MapArgs.LEntry aString(String key, String value)
key - value - public static MapArgs.LEntry aString(String key, String value, Map<?,?> map)
key - value - map - keys and values will be transformed in Stringspublic static MapArgs.LEntry aString(String key)
key - public static MapArgs.LEntry aRef(String key, String value)
key - value - public static MapArgs.LEntry aRef(String key, String value, Map<?,?> map)
public static MapArgs.LEntry ref(String key)
public static MapArgs.LEntry aRef(String key)
key - public static MapArgs.LEntry anInt(String key, Integer value)
key - value - public static MapArgs.LEntry anInt(String key, Integer value, Map<?,?> map)
public static MapArgs.LEntry anInt(String key, String strVal)
key - strVal - public static MapArgs.LEntry anInt(String key, String strVal, Map<?,?> map)
public static MapArgs.LEntry anInt(String key)
key - public static MapArgs.LEntry aBool(String key, Boolean value)
public static MapArgs.LEntry aBool(String key, Boolean value, Map<?,?> map)
public static MapArgs.LEntry aBool(String key, String strVal)
public static MapArgs.LEntry aBool(String key, String strVal, Map<?,?> map)
public static MapArgs.LEntry aBool(String key)
key - public static MapArgs.LEntry aDbl(String key, Double value)
key - value - public static MapArgs.LEntry aDbl(String key, Double value, Map<?,?> map)
public static MapArgs.LEntry aDbl(String key, BigDecimal value)
key - value - public static MapArgs.LEntry aDbl(String key, BigDecimal value, Map<?,?> map)
public static MapArgs.LEntry aDbl(String key, String strVal)
key - strVal - public static MapArgs.LEntry aDbl(String key, String strVal, Map<?,?> map)
public static MapArgs.LEntry aDbl(String key)
key - public static MapArgs.LEntry aList(String key, List list)
key - list - public static MapArgs.LEntry aList(String key, double[] arrayDouble)
public static MapArgs.LEntry aList(String key, float[] arrayFloat)
public static MapArgs.LEntry aList(String key, List list, Map<?,?> map)
public static MapArgs.LEntry aList(String key, String strList)
public static MapArgs.LEntry aList(String key, String strList, Map<?,?> map)
public static MapArgs.LEntry aMap(String key, Map map)
key - map - public static MapArgs.LEntry aMap(String key, Map map, Map props)
public static MapArgs.LEntry aMap(String key, String strMap)
public static MapArgs.LEntry aMap(String key, String strMap, Map props)
public static MapArgs.LEntry anArray(String key, int[] array)
key - array - public static MapArgs.LEntry anArray(String key, int[] array, Map map)
public static MapArgs.LEntry anArray(String key, byte[] array)
public static MapArgs.LEntry anArray(String key, byte[] array, Map map)
public static MapArgs.LEntry anArray(String key, char[] array)
public static MapArgs.LEntry anArray(String key, char[] array, Map map)
public static MapArgs.LEntry anArray(String key, float[] array)
public static MapArgs.LEntry anArray(String key, float[] array, Map map)
public static MapArgs.LEntry anArray(String key, double[] array)
public static MapArgs.LEntry anArray(String key, double[] array, Map map)
public static MapArgs.LEntry anArray(String key, boolean[] array)
public static MapArgs.LEntry anArray(String key, boolean[] array, Map map)
public static MapArgs.LEntry anArray(String key, Object[] array)
public static MapArgs.LEntry anArray(String key, Object[] array, Map map)
public static MapArgs.LEntry aStruct(String key, Class clazz, List list)
key - clazz - list - public static MapArgs.LEntry aStruct(String key, Class clazz, Map map)
public static MapArgs.LEntry aStruct(String key, Class clazz, List list, Map properties)
public static MapArgs.LEntry aStruct(String key, Class clazz, Map map, Map properties)
public static MapArgs.LEntry aVal(String key, Serializable val)
key - val - public static MapArgs.LEntry aVal(String key, Serializable val, Map properties)
public static MapArgs.LEntry aVal(Serializable val)
val - public static MapArgs.LEntry aVal(Serializable val, Map properties)
@Deprecated public static String predicate(String argName, String expr)
argName - the name of the variable in the expressionexpr - the code of the expression@Deprecated public static <T> Class anImpl(Class<T> anInterface, Class<? extends T> aClass)
T - anInterface - aClass - public boolean prefersList()
public boolean containsKey(Object o)
containsKey in interface Map<String,Object>o - public boolean containsValue(Object o)
containsValue in interface Map<String,Object>public Object get(int index)
index - public Object put(String s, Object o)
public void putAll(Map<? extends String,? extends Object> map)
public void clear()
public Object[] toArray()
public List<Object> asList()
public MapArgs.LEntry[] getEntries()
public boolean isSafe()
public boolean isValuesOnly()
public MapArgs asFullMap(IndirectMap<String,Object> objectDictionary)
objectDictionary - a map that can resolve an object reference using its name
if null it will be considered that there are no "Hollow" Object in the structure
(see isValuesOnly) so use at your own risk!public Object[] asFullArray(IndirectMap<String,Object> objectDictionary)
objectDictionary - public List<Object> asFullList(IndirectMap<String,Object> objectDictionary)
objectDictionary - public boolean overlap(boolean acceptNullValues,
MapArgs.LEntry entry)
acceptNullValues - do we accept setting values to nullentry - org.lsst.gruth.types.IncompatibleTypeException - if the assignment can not be made
due to type incompatible org.lsst.gruth.types.public MapArgs overlap(boolean acceptNullvalues, MapArgs other)
see overlap with Object[] for more details.
beware ; implementation not synchronized!
acceptNullvalues - if null values in the other arguments should be assigned to objects in the resultother - another MapArgs objectorg.lsst.gruth.types.IncompatibleTypeException - if incompatible assignmentParmStructureException - if incompatible structurepublic MapArgs overlap(boolean acceptNullvalues, Object[] array)
for each element in the array argument
acceptNullvalues - array - Copyright © 2015 LSST. All rights reserved.