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 Objectget(Object key)booleangetBoolean(String key)Convenience method to change the value to a booleanbyte[]getBytes(String key)Convenience method to change the value to a byte array.DategetDate(String key)Convenience method to change the value to a date.IdentifiergetIdentifier(String key)Convenience method to change the value to an identifierintgetInteger(String key)Returns zero if the value is null;longgetLong(String key)Returns zero if the value is null;StringgetString(String key)Convenience method to change the value to a stringTimestampgetTimestamp(String key)URIgetURI(String key)Convenience method to change the value to a URI.Objectput(String key, Object value)ColumnMapremoveKeys(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:ConversionMapConvenience method to change the value to a string- Specified by:
getStringin interfaceConversionMap<String,Object>- Returns:
-
getLong
public long getLong(String key)
Returns zero if the value is null;- Specified by:
getLongin interfaceConversionMap<String,Object>- Parameters:
key-- Returns:
-
getInteger
public int getInteger(String key)
Returns zero if the value is null;- Specified by:
getIntegerin interfaceConversionMap<String,Object>- Parameters:
key-- Returns:
-
getBoolean
public boolean getBoolean(String key)
Description copied from interface:ConversionMapConvenience method to change the value to a boolean- Specified by:
getBooleanin interfaceConversionMap<String,Object>- Returns:
-
getDate
public Date getDate(String key)
Description copied from interface:ConversionMapConvenience method to change the value to a date.- Specified by:
getDatein interfaceConversionMap<String,Object>- Returns:
-
getIdentifier
public Identifier getIdentifier(String key)
Description copied from interface:ConversionMapConvenience method to change the value to an identifier- Specified by:
getIdentifierin interfaceConversionMap<String,Object>- Returns:
-
getURI
public URI getURI(String key)
Description copied from interface:ConversionMapConvenience method to change the value to a URI.- Specified by:
getURIin interfaceConversionMap<String,Object>- Returns:
-
getBytes
public byte[] getBytes(String key)
Description copied from interface:ConversionMapConvenience 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:
getBytesin interfaceConversionMap<String,Object>- Returns:
-
removeKeys
public ColumnMap removeKeys(List<String> attr)
Description copied from interface:ConversionMapReturns a copy of this with the given keyus removed.- Specified by:
removeKeysin interfaceConversionMap<String,Object>
-
-