Class DefaultStatementResult
- java.lang.Object
-
- com.tangosol.coherence.dslquery.statement.DefaultStatementResult
-
- All Implemented Interfaces:
StatementResult
- Direct Known Subclasses:
FormattedMapStatementResult
public class DefaultStatementResult extends Object implements StatementResult
A default implementation of aStatementResult.- Since:
- Coherence 12.2.1
- Author:
- jk 2014.07.15
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanf_fShowKeysA flag to determine whether to print keys in theprint(java.io.PrintWriter, String)method if the value inf_oResultis aMap.protected Objectf_oResultThe actual result of executing a CohQLStatement.-
Fields inherited from interface com.tangosol.coherence.dslquery.StatementResult
NULL_RESULT
-
-
Constructor Summary
Constructors Constructor Description DefaultStatementResult(Object oResult)Construct a DefaultStatementResult with the specified result value.DefaultStatementResult(Object oResult, boolean fShowKeys)Construct a DefaultStatementResult with the specified result value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectgetResult()Return the actual result Object that this StatementResult wraps.voidprint(PrintWriter writer, String sTitle)Print the result object to the specifiedPrintWriter.protected voidprintCommaSeparatedCollection(PrintWriter writer, Collection col)Print the contents of the givenCollectionto the specifiedPrintWriteras a comma separated list.protected voidprintObject(PrintWriter writer, Object oResult, boolean fPrintNewLine, boolean fTopObject)Print out the given Object on the givenPrintWriter.protected voidprintResults(PrintWriter writer, String sTitle, Object oResult, boolean fShowKeys)Print the specified result value to the specifiedPrintWriter.protected voidprintResultsCollection(PrintWriter writer, Collection col, boolean fShowKeys)Print the givenCollectionof Objects on the givenPrintWriter.protected voidprintResultsMap(PrintWriter writer, Map map, boolean fShowKey)Print the contents of the specifiedMapto the specifiedPrintWriter.protected voidprintStringOrObject(PrintWriter writer, Object o)If the given Object is a String print it within double quotes around otherwise pass the Object to theprintObject(PrintWriter, Object, boolean, boolean)method.protected voidprintStringOrObject(PrintWriter writer, Object o, boolean fNewLine)If the given Object is a String print it within double quotes around otherwise pass the Object to theprintObject(PrintWriter, Object, boolean, boolean)method.
-
-
-
Field Detail
-
f_fShowKeys
protected final boolean f_fShowKeys
A flag to determine whether to print keys in theprint(java.io.PrintWriter, String)method if the value inf_oResultis aMap.
-
-
Constructor Detail
-
DefaultStatementResult
public DefaultStatementResult(Object oResult)
Construct a DefaultStatementResult with the specified result value.- Parameters:
oResult- the result Object that this DefaultStatementResult contains
-
DefaultStatementResult
public DefaultStatementResult(Object oResult, boolean fShowKeys)
Construct a DefaultStatementResult with the specified result value.- Parameters:
oResult- the result Object that this DefaultStatementResult containsfShowKeys- if true and oResult is aMapthen the keys of the Map will be printed by theprint(java.io.PrintWriter, String)method, if false, no keys will be printed
-
-
Method Detail
-
getResult
public Object getResult()
Description copied from interface:StatementResultReturn the actual result Object that this StatementResult wraps.- Specified by:
getResultin interfaceStatementResult- Returns:
- the actual result Object that this StatementResult wraps
-
print
public void print(PrintWriter writer, String sTitle)
Description copied from interface:StatementResultPrint the result object to the specifiedPrintWriter.- Specified by:
printin interfaceStatementResult- Parameters:
writer- the PrintWriter to print the results tosTitle- the title to print before the results
-
printResults
protected void printResults(PrintWriter writer, String sTitle, Object oResult, boolean fShowKeys)
Print the specified result value to the specifiedPrintWriter.- Parameters:
writer- the PrintWriter to print the results tosTitle- the optional title to print before the resultsoResult- the result object to printfShowKeys- a flag to determine whether to print keys if the result object is a map
-
printObject
protected void printObject(PrintWriter writer, Object oResult, boolean fPrintNewLine, boolean fTopObject)
Print out the given Object on the givenPrintWriter.- Parameters:
writer- a PrintWriter to print onoResult- the object to printfPrintNewLine- a flag controlling whether to print a new linefTopObject- a flag to tell whether the object is outermost
-
printCommaSeparatedCollection
protected void printCommaSeparatedCollection(PrintWriter writer, Collection col)
Print the contents of the givenCollectionto the specifiedPrintWriteras a comma separated list.- Parameters:
writer- the PrintWriter to print the Collection tocol- the Collection to print
-
printStringOrObject
protected void printStringOrObject(PrintWriter writer, Object o)
If the given Object is a String print it within double quotes around otherwise pass the Object to theprintObject(PrintWriter, Object, boolean, boolean)method.- Parameters:
writer- a PrintWriter to print ono- the object to print
-
printStringOrObject
protected void printStringOrObject(PrintWriter writer, Object o, boolean fNewLine)
If the given Object is a String print it within double quotes around otherwise pass the Object to theprintObject(PrintWriter, Object, boolean, boolean)method.- Parameters:
writer- a PrintWriter to print ono- the object to printfNewLine- a flag controlling whether to print a new line
-
printResultsCollection
protected void printResultsCollection(PrintWriter writer, Collection col, boolean fShowKeys)
Print the givenCollectionof Objects on the givenPrintWriter.- Parameters:
writer- a PrintWriter to print oncol- the Collection to printfShowKeys- true to show keys
-
printResultsMap
protected void printResultsMap(PrintWriter writer, Map map, boolean fShowKey)
Print the contents of the specifiedMapto the specifiedPrintWriter.- Parameters:
writer- a PrintWriter to print onmap- the Map to printfShowKey- a flag controlling whether to print the Maps keys
-
-