org.apertereports.common.utils
Class TextUtils

java.lang.Object
  extended by org.apertereports.common.utils.TextUtils
All Implemented Interfaces:
ReportConstants

public class TextUtils
extends Object
implements ReportConstants

Utility methods for converting Vaadin value to a simple string.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apertereports.common.ReportConstants
ReportConstants.BooleanValues, ReportConstants.ErrorCodes, ReportConstants.InputTypes, ReportConstants.Keys, ReportConstants.Parameter, ReportConstants.ReportMimeType, ReportConstants.ReportType
 
Field Summary
 
Fields inherited from interface org.apertereports.common.ReportConstants
CACHE_MANAGER_CHECK_INTERVAL, CYCLIC_REPORT_ORDER_RESPONSE_Q, DATETIME_FORMAT, DATETIME_PATTERN, FIELD_DELIMITER, FILE_DATE_FORMAT, FILE_PREFIX, GENERATE_REPORT_Q, RECORD_DELIMITER, REPORT_ORDER_ID, SUBREPORT_MAP_PARAMETER_NAME, WS_NAMESPACE, WS_REQUEST_LOCAL_PART
 
Constructor Summary
TextUtils()
           
 
Method Summary
static String encodeObjectToSQL(Object rawValue)
          Encodes a value to a string so that an SQL query can use it.
static Object encodeSQLToObject(Class<?> type, String value)
          Decodes a previously encoded value to its base form.
static String readTestFileToString(InputStream s)
          Reads a text file from an InputStream to string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextUtils

public TextUtils()
Method Detail

encodeObjectToSQL

public static String encodeObjectToSQL(Object rawValue)
Encodes a value to a string so that an SQL query can use it. Converts collections to a single coma separated string.

Parameters:
rawValue - given value
Returns:
encoded value

readTestFileToString

public static String readTestFileToString(InputStream s)
                                   throws IOException
Reads a text file from an InputStream to string.

Parameters:
s - an InputStream
Returns:
a string containing file contents
Throws:
IOException - on read error

encodeSQLToObject

public static Object encodeSQLToObject(Class<?> type,
                                       String value)
                                throws ParseException
Decodes a previously encoded value to its base form.

Parameters:
type - The type of the value.
value - The input string
Returns:
Decoded value object
Throws:
ParseException - On date format error


Copyright © 2011-2012. All Rights Reserved.