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 boolean
f_fShowKeys
A flag to determine whether to print keys in theprint(java.io.PrintWriter, String)
method if the value inf_oResult
is aMap
.protected Object
f_oResult
The 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 Object
getResult()
Return the actual result Object that this StatementResult wraps.void
print(PrintWriter writer, String sTitle)
Print the result object to the specifiedPrintWriter
.protected void
printCommaSeparatedCollection(PrintWriter writer, Collection col)
Print the contents of the givenCollection
to the specifiedPrintWriter
as a comma separated list.protected void
printObject(PrintWriter writer, Object oResult, boolean fPrintNewLine, boolean fTopObject)
Print out the given Object on the givenPrintWriter
.protected void
printResults(PrintWriter writer, String sTitle, Object oResult, boolean fShowKeys)
Print the specified result value to the specifiedPrintWriter
.protected void
printResultsCollection(PrintWriter writer, Collection col, boolean fShowKeys)
Print the givenCollection
of Objects on the givenPrintWriter
.protected void
printResultsMap(PrintWriter writer, Map map, boolean fShowKey)
Print the contents of the specifiedMap
to the specifiedPrintWriter
.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.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.
-
-
-
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_oResult
is 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 aMap
then 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:StatementResult
Return the actual result Object that this StatementResult wraps.- Specified by:
getResult
in interfaceStatementResult
- Returns:
- the actual result Object that this StatementResult wraps
-
print
public void print(PrintWriter writer, String sTitle)
Description copied from interface:StatementResult
Print the result object to the specifiedPrintWriter
.- Specified by:
print
in 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 givenCollection
to the specifiedPrintWriter
as 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 givenCollection
of 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 specifiedMap
to the specifiedPrintWriter
.- Parameters:
writer
- a PrintWriter to print onmap
- the Map to printfShowKey
- a flag controlling whether to print the Maps keys
-
-