SMILA (incubation) API documentation

org.eclipse.smila.datamodel
Interface AnyMap

All Superinterfaces:
Any, java.lang.Iterable<Any>, java.util.Map<java.lang.String,Any>
All Known Implementing Classes:
AnyMapImpl, ImmutableAnyMapImpl

public interface AnyMap
extends Any, java.util.Map<java.lang.String,Any>

Interface for a map with Any objects.

AnyMap does not allow null values!

Author:
cind01

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eclipse.smila.datamodel.Any
Any.ValueType
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Method Summary
 void add(java.lang.String key, Any value)
          Adds the given value to the mapped entry of the given key.
 java.lang.Boolean getBooleanValue(java.lang.String key)
           
 java.util.Date getDateTimeValue(java.lang.String key)
           
 java.util.Date getDateValue(java.lang.String key)
           
 java.lang.Double getDoubleValue(java.lang.String key)
           
 java.lang.Long getLongValue(java.lang.String key)
           
 AnyMap getMap(java.lang.String key)
           
 AnyMap getMap(java.lang.String key, boolean create)
          Gets the map and optionally creates one under the given key if not present.
 AnySeq getSeq(java.lang.String key)
           
 AnySeq getSeq(java.lang.String key, boolean create)
          Gets the seq and optionally creates one under the given key if not present.
 java.lang.String getStringValue(java.lang.String key)
           
 Value getValue(java.lang.String key)
           
 Any put(java.lang.String key, Any value)
           
 Any put(java.lang.String key, java.lang.Boolean value)
           
 Any put(java.lang.String key, java.lang.Number value)
          Long, Integer, Short and Byte values will be converted to Value object of type LONG, all others to Value object of type DOUBLE.
 Any put(java.lang.String key, java.lang.String value)
           
 
Methods inherited from interface org.eclipse.smila.datamodel.Any
asMap, asSeq, asValue, getFactory, getValueType, isBoolean, isDate, isDateTime, isDouble, isEmpty, isLong, isMap, isNumber, isSeq, isString, isValue, iterator, size
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, values
 

Method Detail

add

void add(java.lang.String key,
         Any value)
Adds the given value to the mapped entry of the given key. If there's no mapping yet, the new value is added as Seq with one value. If the key is currently mapped to a Value/Map, the Value/Map is converted to a Seq containing the Value/Map and the Seq is added. If the key is currently mapped to a Seq, new value is added to that Seq.

Parameters:
key - The key
value - the Any to add

put

Any put(java.lang.String key,
        java.lang.String value)
Parameters:
key - The key
value - String value, must not be null.
Returns:
the previous value or null

put

Any put(java.lang.String key,
        java.lang.Number value)
Long, Integer, Short and Byte values will be converted to Value object of type LONG, all others to Value object of type DOUBLE.

Parameters:
key - The key
value - Number value, will be converted, must not be null.
Returns:
the previous value or null

put

Any put(java.lang.String key,
        java.lang.Boolean value)
Parameters:
key - The key
value - Boolean value, must not be null.
Returns:
the previous value or null

put

Any put(java.lang.String key,
        Any value)
Specified by:
put in interface java.util.Map<java.lang.String,Any>
Parameters:
key - The key
value - Any value, must not be null.
Returns:
the previous value or null

getMap

AnyMap getMap(java.lang.String key)
Parameters:
key - The key
Returns:
The AnyMap matching the key, an InvalidValueTypeException is thrown if the value is not of type AnyMap, or null

getMap

AnyMap getMap(java.lang.String key,
              boolean create)
Gets the map and optionally creates one under the given key if not present.

Parameters:
key - The key
create - if true and the key is not yet used, create a new map. else just return null.
Returns:
The AnyMap matching the key, an InvalidValueTypeException is thrown if the value is not of type AnyMap

getSeq

AnySeq getSeq(java.lang.String key)
Parameters:
key - The key
Returns:
The AnySeq matching to this key, an InvalidValueTypeException is thrown if the value is not of type, or null

getSeq

AnySeq getSeq(java.lang.String key,
              boolean create)
Gets the seq and optionally creates one under the given key if not present.

Parameters:
key - The key
create - the create
Returns:
The AnySeq matching the key, an InvalidValueTypeException is thrown if the value is not of type AnyMap

getStringValue

java.lang.String getStringValue(java.lang.String key)
Parameters:
key - the key
Returns:
The string representation of the attribute value

getValue

Value getValue(java.lang.String key)
Parameters:
key - the key
Returns:
The value matching to this key, an InvalidValueTypeException is thrown if the value is no value type

getDoubleValue

java.lang.Double getDoubleValue(java.lang.String key)
Parameters:
key - The key
Returns:
The double value matching to this key, an InvalidValueTypeException is thrown if the value is not of type double

getLongValue

java.lang.Long getLongValue(java.lang.String key)
Parameters:
key - The key
Returns:
The long value matching to this key, an InvalidValueTypeException is thrown if the value is not of type long

getBooleanValue

java.lang.Boolean getBooleanValue(java.lang.String key)
Parameters:
key - The key
Returns:
The boolean value matching to this key, an InvalidValueTypeException is thrown if the value is not of type boolean

getDateValue

java.util.Date getDateValue(java.lang.String key)
Parameters:
key - The key
Returns:
The date value matching to this key, an InvalidValueTypeException is thrown if the value is not of type date

getDateTimeValue

java.util.Date getDateTimeValue(java.lang.String key)
Parameters:
key - The key
Returns:
The date time value matching to this key, an InvalidValueTypeException is thrown if the value is not of type date time

SMILA (incubation) API documentation