info.informatica.data.util
Class JdbcMap

java.lang.Object
  extended by info.informatica.data.util.JdbcMap
All Implemented Interfaces:
Map

public class JdbcMap
extends Object
implements Map

JDBC-based implementation of the Map interface.

This implementation does not provide all of the optional map operations, and permits null values and the null key.

Uses a MapMetaData object.

This class is experimental and needs some more work.

Version:
1.01
Author:
Carlos Amengual
See Also:
Map, MapMetaData

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
JdbcMap()
          Constructs a new, empty map with a temporary table.
JdbcMap(MapMetaData md)
          Constructs a new, empty map
 
Method Summary
 void clear()
           
 void close()
           
 boolean containsKey(Object key)
           
 boolean containsValue(Object value)
           
 Set entrySet()
           
 Object get(Object key)
           
 void init(Connection con)
          Initializes the map
 boolean isEmpty()
           
 Set keySet()
           
static void main(String[] args)
          Testdrive with MySQL
 Object put(Object key, Object value)
           
 void putAll(Map t)
           
 Object remove(Object key)
           
 int size()
           
 Collection values()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

JdbcMap

public JdbcMap(MapMetaData md)
Constructs a new, empty map

Parameters:
md - MapMetaData object.
Throws:
IllegalArgumentException - if the table is null or empty string.

JdbcMap

public JdbcMap()
        throws SQLException
Constructs a new, empty map with a temporary table.

Throws:
SQLException - if there is any problem creating the temp table
Method Detail

main

public static void main(String[] args)
                 throws SQLException
Testdrive with MySQL

Throws:
SQLException

init

public void init(Connection con)
          throws SQLException
Initializes the map

Parameters:
con - Connection
Throws:
NullPointerException - if the connection is null
SQLException

close

public void close()
           throws SQLException
Throws:
SQLException

size

public int size()
Specified by:
size in interface Map

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map

containsValue

public boolean containsValue(Object value)
Specified by:
containsValue in interface Map

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map

get

public Object get(Object key)
Specified by:
get in interface Map

put

public Object put(Object key,
                  Object value)
Specified by:
put in interface Map

remove

public Object remove(Object key)
Specified by:
remove in interface Map

putAll

public void putAll(Map t)
Specified by:
putAll in interface Map

clear

public void clear()
Specified by:
clear in interface Map

keySet

public Set keySet()
Specified by:
keySet in interface Map

values

public Collection values()
Specified by:
values in interface Map

entrySet

public Set entrySet()
Specified by:
entrySet in interface Map