Class JSArray<T>

java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList<T>
com.jbstrap.core.javascriptsupport.JSArray<T>
Type Parameters:
T - The list data type
All Implemented Interfaces:
Serializable, Cloneable, Iterable<T>, Collection<T>, List<T>, RandomAccess

public class JSArray<T> extends ArrayList<T>
Solution for creating a JavaScript compatible arrays, from the specified data.
Since:
4.0
Author:
JBStrap
See Also:
  • Constructor Details

    • JSArray

      public JSArray()
  • Method Details

    • setEmptyArrayAsNull

      public JSArray<T> setEmptyArrayAsNull(boolean emptyAsNull)
      Sets whether an empty array is represented as null in JavaScript If set to true, instead of an empty array, it will generate null, instead of an empty array. Defaults to false
      Parameters:
      emptyAsNull - If true, when an empty list is specified, it will be generated as null, otherwise it would generate an empty array.
      Returns:
      The list
    • setDateFormat

      public JSArray<T> setDateFormat(String pattern)
      Sets the date format. This is needed, if the list is made up of date items. The dates will be Strings, in the specified format. If not set, the dates will use the default yyyy-MM-dd'T'HH:mm:ss format
      Parameters:
      pattern - The date format to be used
      Returns:
      The list
    • toString

      public String toString()
      Generates a JavaScript array, according to the list
      Overrides:
      toString in class AbstractCollection<T>
      Returns:
      The generated string