public class DefaultSqlRow extends Object implements SqlRow
Refer to SqlQuery for examples.
There are convenience methods such as getInteger(), getBigDecimal() etc. The reason for these methods is that the values put into this map often come straight from the JDBC resultSet. Depending on the JDBC driver it may put a different type into a given property. For example an Integer, BigDecimal, Double could all be put into a property depending on the JDBC driver used. These convenience methods automatically convert the value as required returning the type you expect.
| Constructor and Description |
|---|
DefaultSqlRow(int initialCapacity,
float loadFactor,
String dbTrueValue)
Create with an initialCapacity and loadFactor.
|
DefaultSqlRow(Map<String,Object> map,
String dbTrueValue)
Create with a specific Map implementation.
|
DefaultSqlRow(String dbTrueValue)
Create a new MapBean based on a LinkedHashMap with default
initialCapacity (of 16).
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear the map.
|
boolean |
containsKey(Object key)
Returns true if the map contains the property.
|
boolean |
containsValue(Object value)
Returns true if the map contains the value.
|
Set<Map.Entry<String,Object>> |
entrySet()
Returns the entrySet of the map.
|
Object |
get(Object name)
Return a property value by its name.
|
BigDecimal |
getBigDecimal(String name)
Return a property value as a BigDecimal.
|
Boolean |
getBoolean(String name)
Return a property as a Boolean.
|
Date |
getDate(String name)
Return the property as a sql date.
|
Double |
getDouble(String name)
Return the property value as a Double.
|
Float |
getFloat(String name)
Return the property value as a Float.
|
Integer |
getInteger(String name)
Return a property as an Integer.
|
Long |
getLong(String name)
Return a property value as a Long.
|
String |
getString(String name)
Return a property as a String.
|
Timestamp |
getTimestamp(String name)
Return the property as a sql timestamp.
|
Date |
getUtilDate(String name)
Return the property as a java.util.Date.
|
UUID |
getUUID(String name)
Return a property as a UUID.
|
boolean |
isEmpty()
Returns true if the map is empty.
|
Iterator<String> |
keys()
Return the property names (String).
|
Set<String> |
keySet()
Returns the key set of the map.
|
Object |
put(String name,
Object value)
Set a value to a property.
|
void |
putAll(Map<? extends String,? extends Object> t)
Put all the values from t into this map.
|
Object |
remove(Object name)
Remove a property from the map.
|
Object |
set(String name,
Object value)
Exactly the same as the put method.
|
int |
size()
Return the size of the map.
|
String |
toString()
String description of the underlying map.
|
Collection<Object> |
values()
Return the values from this map.
|
public DefaultSqlRow(Map<String,Object> map, String dbTrueValue)
The default Map implementation is LinkedHashMap.
public DefaultSqlRow(String dbTrueValue)
public DefaultSqlRow(int initialCapacity,
float loadFactor,
String dbTrueValue)
The defaults of these are 16 and 0.75.
Note that the Map will rehash the contents when the number of keys in this map reaches its threshold (initialCapacity * loadFactor).
public Iterator<String> keys()
SqlRowInternally this uses LinkedHashMap and so the order of the property names should be predictable and ordered by the use of LinkedHashMap.
public Object remove(Object name)
SqlRowpublic Object get(Object name)
SqlRowpublic Object put(String name, Object value)
SqlRowpublic Object set(String name, Object value)
SqlRowI added this method because it seems more bean like to have get and set methods.
public UUID getUUID(String name)
SqlRowpublic Boolean getBoolean(String name)
SqlRowgetBoolean in interface SqlRowpublic Integer getInteger(String name)
SqlRowgetInteger in interface SqlRowpublic BigDecimal getBigDecimal(String name)
SqlRowgetBigDecimal in interface SqlRowpublic Long getLong(String name)
SqlRowpublic Double getDouble(String name)
SqlRowpublic Float getFloat(String name)
SqlRowpublic String getString(String name)
SqlRowpublic Date getUtilDate(String name)
SqlRowgetUtilDate in interface SqlRowpublic Date getDate(String name)
SqlRowpublic Timestamp getTimestamp(String name)
SqlRowgetTimestamp in interface SqlRowpublic String toString()
SqlRowpublic void clear()
SqlRowpublic boolean containsKey(Object key)
SqlRowcontainsKey in interface SqlRowcontainsKey in interface Map<String,Object>public boolean containsValue(Object value)
SqlRowcontainsValue in interface SqlRowcontainsValue in interface Map<String,Object>public Set<Map.Entry<String,Object>> entrySet()
SqlRowpublic boolean isEmpty()
SqlRowpublic Set<String> keySet()
SqlRowpublic void putAll(Map<? extends String,? extends Object> t)
SqlRowpublic int size()
SqlRowCopyright © 2014. All Rights Reserved.