User API

Data

Other API in Package

Web

Internal Tunnel

Internal Web

Tunnel

This class also used in (click to expand):
Method Summary
  addData(Data data)

Adds all of the entries in data to this Data object, over-writing duplicates.

  addJSONData(String json)

Decodes the JSON string and adds the payload to this Data object.

  addNewData(Data data, boolean emptyAsNull)

Adds all of the entries in data to this Data object. If the entry already exists, it is NOT over-written unless its value is empty and emtpyAsNull is true.

Boolean addPrefix(String prefix, Boolean camelBack)

Adds the prefix to all keys. Returns true if an update was made.

String calcMD5()

Returns an MD5 checksum of the contents of this Data.

String combineValues(String JEXL)

Substitutes in JEXL values. Treats null values as "" (empty string). (ex: data.combineValues("${first} ${last}") could be converted to John Doe). Nesting is permitted up to 50 iterations after which an exception occurs.

  deleteData()

Removes all entries.

String evaluate(String jexlExpression)

Evaluates the JEXL expression using information from this Data object.

Data filter(Data filter, Boolean remove)

Returns a new Data object with values from this Data set to keys from the filter. Non matching items are removed if remove is true.

String get(String key)

Returns the value associated with key if it exists, null otherwise.

Boolean getBoolean(String field)

Returns the given field as a boolean. The value must be true or false. Throws exception if the value does not exist or cannot be cast to the correct type.

Boolean getCommonBoolean(String field)

Returns the given field as a boolean. The value must be any of the following combinations: [true/false], [1/0], [yes,no], [on,off]. Throws exception if the value does not exist or cannot be cast to the correct type.

Date getDate(String field)

Returns the given field as a Date. Throws exception if the value does not exist or cannot be cast to the correct type.

Boolean getDefaultBoolean(String field, Boolean defaultBoolean)

Returns the given field as a boolean. If the field does not exist or refers to a non-boolean field, it returns the default value

Date getDefaultDate(String field, Date defaultDate)

Returns the given field as a date. If the field does not exist or refers to a non-date field, it returns the default value

Double getDefaultDouble(String field, Number defaultDouble)

Returns the given field as a double. If the field does not exist or refers to a non-double field, it returns the default value

Integer getDefaultInt(String field, Number defaultInt)

Returns the given field as an int. If the field does not exist or refers to a non-int field, it returns the default value

String getDefaultValue(String field, String defaultValue, boolean emptyIsNull)

Returns the given field. If the field does not exist, it returns the default value. If the field exists but is value is empty, this method returns defaultValue only if emptyIsNull=true.

Double getDouble(String key)

Returns the given value of the given key as a double. Throws exception if the value does not exist or cannot be cast to the correct type.

Integer getInt(String key)

Returns the given value of the given key as an Java Int which is smaller than a Javascript Int. Throws exception if the value does not exist or cannot be cast to the correct type.

String getJSON(String key)

Returns the value of the specified key as unescaped JSON.

Long getLong(String key)

Returns the given value of the given key as Java Long which is larger. Throws exception if the value does not exist or cannot be cast to the correct type.

String[] getNameSet(String prefix)

Returns the names of this Data object as an array of strings that start with the given prefix. If no values exist, this will return an empty array.

String[] getNames()

Returns the names of this Data object as an array of strings. If no values exist, this will return an empty array.

Integer getSize()

Returns the length of all keys and entries in this Data object. This is roughly the length of this object in bytes.

String getValue(String key)

Returns the value associated with key if it exists, null otherwise.

String getValue(String name, int maxLength, boolean allowEmpty)

Returns the given value. Throws exception if the max length is exceeded or value is null/empty and allowEmpty=false.

String[] getValues()

Returns the values of this Data object as an array of strings. If no values exist, this will return an empty array.

String[] getValues(String prefix)

Returns the names of this Data object as an array of strings that start with the given prefix. If no values exist, this will return an empty array.

boolean hasName(String name)

Returns true if the name exists in the data map.

Boolean hasValue(String name)

Returns true if the value exists in the data map.

Boolean isEmpty()

Returns true if there are no entries.

  loadQueryString(String queryString)

Decodes the query string and adds name/value pairs to this data.

Integer parse(String rawText, String[] fields)

Parses information from rawText matching fields and storing them in this Data object and returns the number found.

Data removeControlChars(Boolean all)

Returns a new Data object with all control characters in the range x0000 to x001F inclusive removed if all is true. If all is false, this will remove all control characters except tab, line feed, and carriage return.

Data removeNonAsciiChars()

Returns a new Data object having removed characters outside of the UTF-8 C1 Controls and Latin1 Supplement (keeps those in the range of 0-255 decimal).

Boolean removePrefix(String prefix, Boolean camelBack)

Removes the prefix from any key that has it. Returns true if an update was made.

String removeValue(String key)

Removes the associated key from the data map.

boolean set(String name, Object value)

Sets the string value referenced by name. Returns false on fail (e.g. if the column does not exist, etc). The object must be capable of being serialized as a String.

boolean setBoolean(String name, Boolean value)

Sets the boolean value referenced by name. Returns false on fail (e.g. if the column does not exist, etc).

boolean setDate(String name, Date value)

Sets the date value referenced by name. Returns false on fail (e.g. if the column does not exist, etc).

boolean setDouble(String name, Number double)

Sets the decimal value referenced by name. Returns false on fail (e.g. if the column does not exist, etc).

boolean setInt(String name, Number value)

Sets the integer value referenced by name. Returns false on fail (e.g. if the column does not exist, etc).

boolean setString(String name, String value)

Sets the string value referenced by name. Returns false on fail (e.g. if the column does not exist, etc).

  setValue(String key, Object value)

Sets the string value referenced by name. The object must be capable of being serialized as a String.

Boolean setValues(String value)

Sets all key values to the specified value. If value is null, the keys are deleted. Returns true if changes were made.

PacketDataList toDataList(String name)

Returns the data as a DataList. This DataList can be modified but will not modify the original Data Object.

File toFile()

Converts this data object to file. Expected entries: filename - contains file name, contentType - contains file content type, base64 - contains base64 encoded file contents OR plain - contains plain text content of the file

String toJSON()

Returns contents as a JSON string.

String toJson()

Returns contents as a JSON string.

String toJson(boolean preserveType)

Returns contents as a JSON string with types preserved.

String toQueryString()

Returns all entries as a name/value querystring.

String toString()

Returns a description of this object.

  trim(Boolean includeNonBreaking)

Trims all of the values with leading and trailing whitespace, including non breaking spaces.

boolean updateData(Data data)

Updates matching entries in this Data from the values in the supplied Data. Returns true if any changes were made.

Method Detail


addData(Data data)

Adds all of the entries in data to this Data object, over-writing duplicates.

Parameters:

Since: 07-11-2008

top

addJSONData(String json)

Decodes the JSON string and adds the payload to this Data object.

Parameters:

  • String   json

Since: 01-19-2010

top

addNewData(Data data, boolean emptyAsNull)

Adds all of the entries in data to this Data object. If the entry already exists, it is NOT over-written unless its value is empty and emtpyAsNull is true.

Parameters:

  • Data   data
  • boolean   emptyAsNull

Since: 09-11-2008

top

Boolean addPrefix(String prefix, Boolean camelBack)

Adds the prefix to all keys. Returns true if an update was made.

Parameters:

  • String   prefix  - prefix to add. Required parameter.
  • Boolean   camelBack

Returns:  Boolean

Since: 04-06-2010

top

String calcMD5()

Returns an MD5 checksum of the contents of this Data.

Returns:  String

Since: 05-15-2014

top

String combineValues(String JEXL)

Substitutes in JEXL values. Treats null values as "" (empty string). (ex: data.combineValues("${first} ${last}") could be converted to John Doe). Nesting is permitted up to 50 iterations after which an exception occurs.

Parameters:

  • String   JEXL

Returns:  String

Since: 11-05-2009

top

deleteData()

Removes all entries.

Since: 07-11-2008

top

String evaluate(String jexlExpression)

Evaluates the JEXL expression using information from this Data object.

Parameters:

  • String   jexlExpression

Returns:  String

Since: 05-27-2010

top

Data filter(Data filter, Boolean remove)

Returns a new Data object with values from this Data set to keys from the filter. Non matching items are removed if remove is true.

Parameters:

  • Data   filter Required parameter.
  • Boolean   remove

Returns:  Data

Since: 07-25-2019

top

String get(String key)

Returns the value associated with key if it exists, null otherwise.

Parameters:

  • String   key

Returns:  String

Since: 08-28-2018

top

Boolean getBoolean(String field)

Returns the given field as a boolean. The value must be true or false. Throws exception if the value does not exist or cannot be cast to the correct type.

Parameters:

  • String   field

Returns:  Boolean

Since: 07-11-2008

top

Boolean getCommonBoolean(String field)

Returns the given field as a boolean. The value must be any of the following combinations: [true/false], [1/0], [yes,no], [on,off]. Throws exception if the value does not exist or cannot be cast to the correct type.

Parameters:

  • String   field

Returns:  Boolean

Since: 08-22-2008

top

Date getDate(String field)

Returns the given field as a Date. Throws exception if the value does not exist or cannot be cast to the correct type.

Parameters:

  • String   field

Returns:  Date

Since: 07-11-2008

top

Boolean getDefaultBoolean(String field, Boolean defaultBoolean)

Returns the given field as a boolean. If the field does not exist or refers to a non-boolean field, it returns the default value

Parameters:

  • String   field
  • Boolean   defaultBoolean

Returns:  Boolean

Since: 09-05-2008

top

Date getDefaultDate(String field, Date defaultDate)

Returns the given field as a date. If the field does not exist or refers to a non-date field, it returns the default value

Parameters:

  • String   field
  • Date   defaultDate

Returns:  Date

Since: 09-05-2008

top

Double getDefaultDouble(String field, Number defaultDouble)

Returns the given field as a double. If the field does not exist or refers to a non-double field, it returns the default value

Parameters:

  • String   field
  • Number   defaultDouble

Returns:  Double

Since: 09-05-2008

top

Integer getDefaultInt(String field, Number defaultInt)

Returns the given field as an int. If the field does not exist or refers to a non-int field, it returns the default value

Parameters:

  • String   field
  • Number   defaultInt

Returns:  Integer

Since: 09-05-2008

top

String getDefaultValue(String field, String defaultValue, boolean emptyIsNull)

Returns the given field. If the field does not exist, it returns the default value. If the field exists but is value is empty, this method returns defaultValue only if emptyIsNull=true.

Parameters:

  • String   field
  • String   defaultValue
  • boolean   emptyIsNull

Returns:  String

Since: 09-05-2008

top

Double getDouble(String key)

Returns the given value of the given key as a double. Throws exception if the value does not exist or cannot be cast to the correct type.

Parameters:

  • String   key Required parameter.

Returns:  Double

Since: 07-11-2008

top

Integer getInt(String key)

Returns the given value of the given key as an Java Int which is smaller than a Javascript Int. Throws exception if the value does not exist or cannot be cast to the correct type.

Parameters:

  • String   key Required parameter.

Returns:  Integer

Since: 07-11-2008

top

String getJSON(String key)

Returns the value of the specified key as unescaped JSON.

Parameters:

  • String   key

Returns:  String

Since: 08-30-2010

top

Long getLong(String key)

Returns the given value of the given key as Java Long which is larger. Throws exception if the value does not exist or cannot be cast to the correct type.

Parameters:

  • String   key Required parameter.

Returns:  Long

Since: 05-28-2022

top

String[] getNameSet(String prefix)

Returns the names of this Data object as an array of strings that start with the given prefix. If no values exist, this will return an empty array.

Parameters:

  • String   prefix

Returns:  String[]

Since: 07-11-2008

top

String[] getNames()

Returns the names of this Data object as an array of strings. If no values exist, this will return an empty array.

Returns:  String[]

Since: 07-11-2008

top

Integer getSize()

Returns the length of all keys and entries in this Data object. This is roughly the length of this object in bytes.

Returns:  Integer

Since: 04-18-2012

top

String getValue(String key)

Returns the value associated with key if it exists, null otherwise.

Parameters:

  • String   key

Returns:  String

Since: 07-11-2008

top

String getValue(String name, int maxLength, boolean allowEmpty)

Returns the given value. Throws exception if the max length is exceeded or value is null/empty and allowEmpty=false.

Parameters:

  • String   name
  • int   maxLength
  • boolean   allowEmpty

Returns:  String

Since: 06-07-2012

top

String[] getValues()

Returns the values of this Data object as an array of strings. If no values exist, this will return an empty array.

Returns:  String[]

Since: 05-31-2007

top

String[] getValues(String prefix)

Returns the names of this Data object as an array of strings that start with the given prefix. If no values exist, this will return an empty array.

Parameters:

  • String   prefix

Returns:  String[]

Since: 07-11-2008

top

boolean hasName(String name)

Returns true if the name exists in the data map.

Parameters:

  • String   name

Returns:  boolean

Since: 06-11-2010

top

Boolean hasValue(String name)

Returns true if the value exists in the data map.

Parameters:

  • String   name

Returns:  Boolean

Since: 07-11-2008

top

Boolean isEmpty()

Returns true if there are no entries.

Returns:  Boolean

Since: 05-29-2012

top

loadQueryString(String queryString)

Decodes the query string and adds name/value pairs to this data.

Parameters:

  • String   queryString

Since: 06-09-2010

top

Integer parse(String rawText, String[] fields)

Parses information from rawText matching fields and storing them in this Data object and returns the number found.

Parameters:

  • String   rawText
  • String[]   fields

Returns:  Integer

Since: 10-17-2018

top

Data removeControlChars(Boolean all)

Returns a new Data object with all control characters in the range x0000 to x001F inclusive removed if all is true. If all is false, this will remove all control characters except tab, line feed, and carriage return.

Parameters:

  • Boolean   all

Returns:  Data

Since: 11-24-2014

top

Data removeNonAsciiChars()

Returns a new Data object having removed characters outside of the UTF-8 C1 Controls and Latin1 Supplement (keeps those in the range of 0-255 decimal).

Returns:  Data

Since: 06-15-2022

top

Boolean removePrefix(String prefix, Boolean camelBack)

Removes the prefix from any key that has it. Returns true if an update was made.

Parameters:

  • String   prefix  - prefix to remove. Required parameter.
  • Boolean   camelBack

Returns:  Boolean

Since: 04-06-2010

top

String removeValue(String key)

Removes the associated key from the data map.

Parameters:

  • String   key

Returns:  String

Since: 07-11-2008

top

boolean set(String name, Object value)

Sets the string value referenced by name. Returns false on fail (e.g. if the column does not exist, etc). The object must be capable of being serialized as a String.

Parameters:

  • String   name
  • Object   value

Returns:  boolean

Since: 08-28-2018

top

boolean setBoolean(String name, Boolean value)

Sets the boolean value referenced by name. Returns false on fail (e.g. if the column does not exist, etc).

Parameters:

  • String   name
  • Boolean   value

Returns:  boolean

Since: 08-28-2018

top

boolean setDate(String name, Date value)

Sets the date value referenced by name. Returns false on fail (e.g. if the column does not exist, etc).

Parameters:

  • String   name
  • Date   value

Returns:  boolean

Since: 08-28-2018

top

boolean setDouble(String name, Number double)

Sets the decimal value referenced by name. Returns false on fail (e.g. if the column does not exist, etc).

Parameters:

  • String   name
  • Number   double

Returns:  boolean

Since: 08-28-2018

top

boolean setInt(String name, Number value)

Sets the integer value referenced by name. Returns false on fail (e.g. if the column does not exist, etc).

Parameters:

  • String   name
  • Number   value

Returns:  boolean

Since: 08-28-2018

top

boolean setString(String name, String value)

Sets the string value referenced by name. Returns false on fail (e.g. if the column does not exist, etc).

Parameters:

  • String   name
  • String   value

Returns:  boolean

Since: 08-28-2018

top

setValue(String key, Object value)

Sets the string value referenced by name. The object must be capable of being serialized as a String.

Parameters:

  • String   key
  • Object   value

Since: 07-11-2008

top

Boolean setValues(String value)

Sets all key values to the specified value. If value is null, the keys are deleted. Returns true if changes were made.

Parameters:

  • String   value

Returns:  Boolean

Since: 04-13-2010

top

PacketDataList toDataList(String name)

Returns the data as a DataList. This DataList can be modified but will not modify the original Data Object.

Parameters:

  • String   name

Returns:  PacketDataList


DataList Name: data
DataList Fields: name, value

Since: 01-21-2010

top

File toFile()

Converts this data object to file. Expected entries: filename - contains file name, contentType - contains file content type, base64 - contains base64 encoded file contents OR plain - contains plain text content of the file

Returns:  File

Since: 05-19-2011

top

String toJSON()

Returns contents as a JSON string.

Returns:  String

Since: 08-30-2010

top

String toJson()

Returns contents as a JSON string.

Returns:  String

Since: 03-17-2021

top

String toJson(boolean preserveType)

Returns contents as a JSON string with types preserved.

Parameters:

  • boolean   preserveType

Returns:  String

Since: 09-22-2023

top

String toQueryString()

Returns all entries as a name/value querystring.

Returns:  String

Since: 04-23-2010

top

String toString()

Returns a description of this object.

Returns:  String

Since: 07-11-2008

top

trim(Boolean includeNonBreaking)

Trims all of the values with leading and trailing whitespace, including non breaking spaces.

Parameters:

  • Boolean   includeNonBreaking

Since: 06-16-2011

top

boolean updateData(Data data)

Updates matching entries in this Data from the values in the supplied Data. Returns true if any changes were made.

Parameters:

  • Data   data Required parameter.

Returns:  boolean

Since: 04-06-2010

top
Copyright © 2006 - 2024, ContractPal, Inc. All rights reserved. API Date: Dec 03, 2024 10:24 AM