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
Solution for creating a JavaScript compatible arrays, from the specified data.
- Since:
- 4.0
- Author:
- JBStrap
- See Also:
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionsetDateFormat(String pattern) Sets the date format.setEmptyArrayAsNull(boolean emptyAsNull) Sets whether an empty array is represented asnullin JavaScript If set to true, instead of an empty array, it will generatenull, instead of an empty array.toString()Generates a JavaScript array, according to the listMethods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class java.util.AbstractCollection
containsAllMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, stream, toArrayMethods inherited from interface java.util.List
containsAll
-
Constructor Details
-
JSArray
public JSArray()
-
-
Method Details
-
setEmptyArrayAsNull
Sets whether an empty array is represented asnullin JavaScript If set to true, instead of an empty array, it will generatenull, instead of an empty array. Defaults tofalse- Parameters:
emptyAsNull- Iftrue, when an empty list is specified, it will be generated asnull, otherwise it would generate an empty array.- Returns:
- The list
-
setDateFormat
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
Generates a JavaScript array, according to the list- Overrides:
toStringin classAbstractCollection<T>- Returns:
- The generated string
-