Package ontopoly.model
Class QueryMapper<T>
- java.lang.Object
-
- ontopoly.model.QueryMapper<T>
-
public class QueryMapper<T> extends Object
-
-
Constructor Summary
Constructors Constructor Description QueryMapper(QueryProcessorIF processor)
QueryMapper(QueryProcessorIF processor, DeclarationContextIF context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected QueryResultIF
execute(String query, Map<String,?> params)
boolean
isTrue(String query)
EXPERIMENTAL: Returns true if the query produces a row and false if the query produces no rows.boolean
isTrue(String query, Map<String,?> params)
EXPERIMENTAL: Returns true if the query produces a row and false if the query produces no rows.List<T>
queryForList(String query)
EXPERIMENTAL: Runs the query, and returns a the single value in each row.List<T>
queryForList(String query, Map<String,?> params)
EXPERIMENTAL: Runs the query, and returns a the single value in each row.List<T>
queryForList(String query, RowMapperIF<T> mapper)
EXPERIMENTAL: Runs the query, and calls the mapper for each row in the query result.List<T>
queryForList(String query, RowMapperIF<T> mapper, Map<String,?> params)
EXPERIMENTAL: Runs the query with the given parameters, and calls the mapper for each row in the query result.Map<String,T>
queryForMap(String query)
EXPERIMENTAL: Returns a map of the first row of the query results, with each variable name (without $) as a key and each variable value as the value of the key.Map<String,T>
queryForMap(String query, Map<String,?> params)
EXPERIMENTAL: Returns a map of the first row of the query results, with each variable name (without $) as a key and each variable value as the value of the key.T
queryForObject(String query)
EXPERIMENTAL: Returns the value in the first column in the first row of the query result.T
queryForObject(String query, Map<String,?> params)
EXPERIMENTAL: Returns the value in the first column in the first row of the query result.T
queryForObject(String query, RowMapperIF<T> mapper)
EXPERIMENTAL: Returns the value in the first column in the first row of the query result.T
queryForObject(String query, RowMapperIF<T> mapper, Map<String,?> params)
EXPERIMENTAL: Returns the mapping of the value in the first column in the first row of the query result.protected T
wrapValue(Object value)
-
-
-
Constructor Detail
-
QueryMapper
public QueryMapper(QueryProcessorIF processor)
-
QueryMapper
public QueryMapper(QueryProcessorIF processor, DeclarationContextIF context)
-
-
Method Detail
-
isTrue
public boolean isTrue(String query)
EXPERIMENTAL: Returns true if the query produces a row and false if the query produces no rows.
-
isTrue
public boolean isTrue(String query, Map<String,?> params)
EXPERIMENTAL: Returns true if the query produces a row and false if the query produces no rows.
-
queryForObject
public T queryForObject(String query)
EXPERIMENTAL: Returns the value in the first column in the first row of the query result. If the query produces no results null is returned.
-
queryForObject
public T queryForObject(String query, Map<String,?> params)
EXPERIMENTAL: Returns the value in the first column in the first row of the query result. If the query produces no results null is returned.
-
queryForObject
public T queryForObject(String query, RowMapperIF<T> mapper)
EXPERIMENTAL: Returns the value in the first column in the first row of the query result. If the query produces no results null is returned.
-
queryForObject
public T queryForObject(String query, RowMapperIF<T> mapper, Map<String,?> params)
EXPERIMENTAL: Returns the mapping of the value in the first column in the first row of the query result. If the query produces no results null is returned.
-
queryForList
public List<T> queryForList(String query)
EXPERIMENTAL: Runs the query, and returns a the single value in each row.
-
queryForList
public List<T> queryForList(String query, RowMapperIF<T> mapper)
EXPERIMENTAL: Runs the query, and calls the mapper for each row in the query result. Returns a list of all the objects produced by the mapper in query result order.
-
queryForList
public List<T> queryForList(String query, Map<String,?> params)
EXPERIMENTAL: Runs the query, and returns a the single value in each row.
-
queryForList
public List<T> queryForList(String query, RowMapperIF<T> mapper, Map<String,?> params)
EXPERIMENTAL: Runs the query with the given parameters, and calls the mapper for each row in the query result. Returns a list of all the objects produced by the mapper in query result order.
-
queryForMap
public Map<String,T> queryForMap(String query)
EXPERIMENTAL: Returns a map of the first row of the query results, with each variable name (without $) as a key and each variable value as the value of the key. If the query produces no rows the method returns null; if it produces more than one an exception is thrown.
-
queryForMap
public Map<String,T> queryForMap(String query, Map<String,?> params)
EXPERIMENTAL: Returns a map of the first row of the query results, with each variable name (without $) as a key and each variable value as the value of the key. If the query produces no rows the method returns null.
-
execute
protected QueryResultIF execute(String query, Map<String,?> params) throws InvalidQueryException
- Throws:
InvalidQueryException
-
-