com.google.api.ads.dfp.axis.utils.v201208
Class Pql

java.lang.Object
  extended by com.google.api.ads.dfp.axis.utils.v201208.Pql

public final class Pql
extends Object

A utility class for handling PQL objects.

Author:
Adam Rogal.

Method Summary
static Value createValue(Object value)
          Creates a Value from the value i.e.
static String[] getColumnLabels(ResultSet resultSet)
          Gets the column labels for the result set.
static String[] getRowStringValues(Row row)
          Gets the values in a row of the result set in the form of a string array.
static Object[] getRowValues(Row row)
          Gets the values in a row of the result set in the form of an object array.
static String resultSetToString(ResultSet resultSet)
          Gets the result set as a table representation in the form of:
static List<String[]> resultSetToStringArrayList(ResultSet resultSet)
          Gets the result set as list of string arrays, which can be transformed to a CSV using CSVWriter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createValue

public static Value createValue(Object value)
Creates a Value from the value i.e. a TextValue for a value of type String, BooleanValue for type Boolean, NumberValue for type Double, Long, or Integer, and DateTimeValue for type DateTime. If the value is a Value, the value is returned. If the value is null, an empty TextValue is returned.

Parameters:
value - the value to convert
Returns:
the constructed value of the appropriate type
Throws:
IllegalArgumentException - if value cannot be converted

resultSetToStringArrayList

public static List<String[]> resultSetToStringArrayList(ResultSet resultSet)
Gets the result set as list of string arrays, which can be transformed to a CSV using CSVWriter.

Parameters:
resultSet - the result set to convert to a CSV compatible format
Returns:
a list of string arrays representing the result set

resultSetToString

public static String resultSetToString(ResultSet resultSet)
                                throws IllegalAccessException
Gets the result set as a table representation in the form of:
 +-------+-------+-------+
 |column1|column2|column3|
 +-------+-------+-------+
 |value1 |value2 |value3 |
 +-------+-------+-------+
 |value1 |value2 |value3 |
 +-------+-------+-------+
 

Parameters:
resultSet - the result set to display as a string
Returns:
the string representation of result set as a table
Throws:
IllegalAccessException - if the values of the result set cannot be accessed

getColumnLabels

public static String[] getColumnLabels(ResultSet resultSet)
Gets the column labels for the result set.

Parameters:
resultSet - the result set to get the column labels for
Returns:
the string array of column labels

getRowValues

public static Object[] getRowValues(Row row)
                             throws IllegalArgumentException,
                                    IllegalAccessException,
                                    InvocationTargetException,
                                    NoSuchMethodException
Gets the values in a row of the result set in the form of an object array.

Parameters:
row - the row to get the values for
Returns:
the object array of the row values
Throws:
IllegalArgumentException - if the value could not be extracted from the row value
IllegalAccessException - if the row value could not be accessed
NoSuchMethodException - if the row value could not be accessed
InvocationTargetException - if the row value could not be accessed

getRowStringValues

public static String[] getRowStringValues(Row row)
                                   throws IllegalArgumentException,
                                          IllegalAccessException,
                                          InvocationTargetException,
                                          NoSuchMethodException
Gets the values in a row of the result set in the form of a string array. null values are interpreted as empty strings.

Parameters:
row - the row to get the values for
Returns:
the string array of the row values
Throws:
IllegalArgumentException - if the value could not be extracted from the row value
IllegalAccessException - if the row value could not be accessed
NoSuchMethodException - if the row value could not be accessed
InvocationTargetException - if the row value could not be accessed


Copyright © 2012. All Rights Reserved.