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
-
Method Summary
Modifier and TypeMethodDescriptionsetDateFormat
(String pattern) Sets the date format.setEmptyArrayAsNull
(boolean emptyAsNull) Sets whether an empty array is represented asnull
in 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, trimToSize
Methods inherited from class java.util.AbstractCollection
containsAll
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
Methods inherited from interface java.util.List
containsAll
-
Constructor Details
-
JSArray
public JSArray()
-
-
Method Details
-
setEmptyArrayAsNull
Sets whether an empty array is represented asnull
in 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:
toString
in classAbstractCollection<T>
- Returns:
- The generated string
-