com.opengamma.elsql
Class MapSqlParams

java.lang.Object
  extended by com.opengamma.elsql.MapSqlParams
All Implemented Interfaces:
SqlParams

public final class MapSqlParams
extends Object
implements SqlParams

Provides access to SQL parameters from a map.


Constructor Summary
MapSqlParams(Map<String,Object> map)
          Creates an instance based on a map.
MapSqlParams(String key, Object value)
          Creates an instance based on one key-value pair.
 
Method Summary
 boolean contains(String variable)
          Checks whether the variable exists.
 Object get(String variable)
          Gets the variable, returning null if not found.
 MapSqlParams with(String key, Object value)
          Returns a new instance with the specified key-value pair added.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapSqlParams

public MapSqlParams(Map<String,Object> map)
Creates an instance based on a map.

Parameters:
map - the map, which is assigned, not copied

MapSqlParams

public MapSqlParams(String key,
                    Object value)
Creates an instance based on one key-value pair.

Parameters:
key - the key
value - the value
Method Detail

with

public MapSqlParams with(String key,
                         Object value)
Returns a new instance with the specified key-value pair added.

This copies the internal map and calls Map.put(Object, Object).

Parameters:
key - the key to add
value - the value to add
Returns:
the new instance with pair added

contains

public boolean contains(String variable)
Description copied from interface: SqlParams
Checks whether the variable exists.

Specified by:
contains in interface SqlParams
Parameters:
variable - the variable
Returns:
true if it exists

get

public Object get(String variable)
Description copied from interface: SqlParams
Gets the variable, returning null if not found.

Specified by:
get in interface SqlParams
Parameters:
variable - the variable
Returns:
the value associated with the variable


Copyright 2009-Present by OpenGamma Inc. and individual contributors, released under the Apache License Version 2.0