Class DefaultSqlRow
- java.lang.Object
-
- io.ebeaninternal.server.query.DefaultSqlRow
-
- All Implemented Interfaces:
SqlRow
,Serializable
,Map<String,Object>
public class DefaultSqlRow extends Object implements SqlRow
Used to return raw SQL query results.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.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DefaultSqlRow(int initialCapacity, float loadFactor, String dbTrueValue, boolean optimizedBinaryUUID)
Create with an initialCapacity and loadFactor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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,?> 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.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
-
-
Constructor Detail
-
DefaultSqlRow
public DefaultSqlRow(int initialCapacity, float loadFactor, String dbTrueValue, boolean optimizedBinaryUUID)
Create with an initialCapacity and loadFactor.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).
-
-
Method Detail
-
keys
public Iterator<String> keys()
Description copied from interface:SqlRow
Return the property names (String).Internally this uses LinkedHashMap and so the order of the property names should be predictable and ordered by the use of LinkedHashMap.
-
remove
public Object remove(Object name)
Description copied from interface:SqlRow
Remove a property from the map. Returns the value of the removed property.
-
get
public Object get(Object name)
Description copied from interface:SqlRow
Return a property value by its name.
-
put
public Object put(String name, Object value)
Description copied from interface:SqlRow
Set a value to a property.
-
set
public Object set(String name, Object value)
Description copied from interface:SqlRow
Exactly the same as the put method.I added this method because it seems more bean like to have get and set methods.
-
getUUID
public UUID getUUID(String name)
Description copied from interface:SqlRow
Return a property as a UUID.
-
getBoolean
public Boolean getBoolean(String name)
Description copied from interface:SqlRow
Return a property as a Boolean.- Specified by:
getBoolean
in interfaceSqlRow
-
getInteger
public Integer getInteger(String name)
Description copied from interface:SqlRow
Return a property as an Integer.- Specified by:
getInteger
in interfaceSqlRow
-
getBigDecimal
public BigDecimal getBigDecimal(String name)
Description copied from interface:SqlRow
Return a property value as a BigDecimal.- Specified by:
getBigDecimal
in interfaceSqlRow
-
getLong
public Long getLong(String name)
Description copied from interface:SqlRow
Return a property value as a Long.
-
getDouble
public Double getDouble(String name)
Description copied from interface:SqlRow
Return the property value as a Double.
-
getFloat
public Float getFloat(String name)
Description copied from interface:SqlRow
Return the property value as a Float.
-
getString
public String getString(String name)
Description copied from interface:SqlRow
Return a property as a String.
-
getUtilDate
public Date getUtilDate(String name)
Description copied from interface:SqlRow
Return the property as a java.util.Date.- Specified by:
getUtilDate
in interfaceSqlRow
-
getDate
public Date getDate(String name)
Description copied from interface:SqlRow
Return the property as a sql date.
-
getTimestamp
public Timestamp getTimestamp(String name)
Description copied from interface:SqlRow
Return the property as a sql timestamp.- Specified by:
getTimestamp
in interfaceSqlRow
-
toString
public String toString()
Description copied from interface:SqlRow
String description of the underlying map.
-
containsKey
public boolean containsKey(Object key)
Description copied from interface:SqlRow
Returns true if the map contains the property.- Specified by:
containsKey
in interfaceMap<String,Object>
- Specified by:
containsKey
in interfaceSqlRow
-
containsValue
public boolean containsValue(Object value)
Description copied from interface:SqlRow
Returns true if the map contains the value.- Specified by:
containsValue
in interfaceMap<String,Object>
- Specified by:
containsValue
in interfaceSqlRow
-
entrySet
public Set<Map.Entry<String,Object>> entrySet()
Description copied from interface:SqlRow
Returns the entrySet of the map.
-
isEmpty
public boolean isEmpty()
Description copied from interface:SqlRow
Returns true if the map is empty.
-
keySet
public Set<String> keySet()
Description copied from interface:SqlRow
Returns the key set of the map.
-
putAll
public void putAll(Map<? extends String,?> t)
Description copied from interface:SqlRow
Put all the values from t into this map.
-
-