Class ColumnMap
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<String,Object>
-
- edu.uiuc.ncsa.security.storage.sql.internals.ColumnMap
-
- All Implemented Interfaces:
ConversionMap<String,Object>
,Serializable
,Cloneable
,Map<String,Object>
- Direct Known Subclasses:
XMLMap
public class ColumnMap extends HashMap<String,Object> implements ConversionMap<String,Object>
Helper class with a bunch of built in casts. It contains key value pairs, where the keys are SQL column names and the values are values. This practically contains the information for a single row in a database.Note that the keys are all column names AND that the keys are automatically converted to/from lower case. This is because this object may have its values given from a result set metadata object and most vendors allow only case-insensitive column names, so they may or may not elect to convert them to lower or upper case as they see fit.
Created by Jeff Gaynor
on 8/31/11 at 4:05 PM- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Constructor Summary
Constructors Constructor Description ColumnMap()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
get(Object key)
boolean
getBoolean(String key)
Convenience method to change the value to a booleanbyte[]
getBytes(String key)
Convenience method to change the value to a byte array.Date
getDate(String key)
Convenience method to change the value to a date.Identifier
getIdentifier(String key)
Convenience method to change the value to an identifierint
getInteger(String key)
Returns zero if the value is null;long
getLong(String key)
Returns zero if the value is null;String
getString(String key)
Convenience method to change the value to a stringTimestamp
getTimestamp(String key)
URI
getURI(String key)
Convenience method to change the value to a URI.Object
put(String key, Object value)
ColumnMap
removeKeys(List<String> attr)
Returns a copy of this with the given keyus removed.-
Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, getOrDefault, isEmpty, keySet, merge, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, getOrDefault, hashCode, isEmpty, keySet, merge, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
-
-
-
Method Detail
-
getString
public String getString(String key)
Description copied from interface:ConversionMap
Convenience method to change the value to a string- Specified by:
getString
in interfaceConversionMap<String,Object>
- Returns:
-
getLong
public long getLong(String key)
Returns zero if the value is null;- Specified by:
getLong
in interfaceConversionMap<String,Object>
- Parameters:
key
-- Returns:
-
getInteger
public int getInteger(String key)
Returns zero if the value is null;- Specified by:
getInteger
in interfaceConversionMap<String,Object>
- Parameters:
key
-- Returns:
-
getBoolean
public boolean getBoolean(String key)
Description copied from interface:ConversionMap
Convenience method to change the value to a boolean- Specified by:
getBoolean
in interfaceConversionMap<String,Object>
- Returns:
-
getDate
public Date getDate(String key)
Description copied from interface:ConversionMap
Convenience method to change the value to a date.- Specified by:
getDate
in interfaceConversionMap<String,Object>
- Returns:
-
getIdentifier
public Identifier getIdentifier(String key)
Description copied from interface:ConversionMap
Convenience method to change the value to an identifier- Specified by:
getIdentifier
in interfaceConversionMap<String,Object>
- Returns:
-
getURI
public URI getURI(String key)
Description copied from interface:ConversionMap
Convenience method to change the value to a URI.- Specified by:
getURI
in interfaceConversionMap<String,Object>
- Returns:
-
getBytes
public byte[] getBytes(String key)
Description copied from interface:ConversionMap
Convenience method to change the value to a byte array. Note that if the value is already a byte array (such as a BLOB in a database) it is simply returned unaltered.- Specified by:
getBytes
in interfaceConversionMap<String,Object>
- Returns:
-
removeKeys
public ColumnMap removeKeys(List<String> attr)
Description copied from interface:ConversionMap
Returns a copy of this with the given keyus removed.- Specified by:
removeKeys
in interfaceConversionMap<String,Object>
-
-