org.apertereports.common.utils
Class TextUtils

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

public final class TextUtils
extends Object
implements ARConstants

Utility methods for converting Vaadin value to a simple string.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apertereports.common.ARConstants
ARConstants.BooleanValues, ARConstants.ErrorCode, ARConstants.InputTypes, ARConstants.Keys, ARConstants.Parameter, ARConstants.ReportMimeType, ARConstants.ReportType
 
Field Summary
 
Fields inherited from interface org.apertereports.common.ARConstants
CACHE_MANAGER_CHECK_INTERVAL, DATETIME_PATTERN, FIELD_DELIMITER, FILE_DATE_FORMAT, FILE_PREFIX, JMS_PROPERTY_REPORT_ORDER_ID, JNDI_DEFAULT_CONTEXT, JNDI_JMS_CONNECTION_FACTORY_ID, JNDI_JMS_GENERATE_REPORT_QUEUE_ID, JNDI_JMS_PROCESS_REPORT_QUEUE_ID, RECORD_DELIMITER, SUBREPORT_MAP_PARAMETER_NAME, WS_NAMESPACE, WS_REQUEST_LOCAL_PART
 
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 getCommaSeparatedString(List<Object> list)
          Returns comma-separated string representation of objects in the list
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
 

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

getCommaSeparatedString

public static String getCommaSeparatedString(List<Object> list)
Returns comma-separated string representation of objects in the list

Parameters:
list - List of objects
Returns:
Comma-separated string representation of objects


Copyright © 2011-2013. All Rights Reserved.