Package com.hp.lft.sdk.java.util
Class ListWrapper<K,E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
com.hp.lft.sdk.java.util.ListWrapper<K,E>
- All Implemented Interfaces:
Iterable<E>,Collection<E>,List<E>
Java doesn't yet provide a native way to represent generic types in the format:
List<E>.class, due to type erasure mechanism triggered at compile time.
This class is dedicated for use with NativeObject and invokeMethod function, which expects the parameter Class<T> returnType
It allows to capture the type/class of the elements at runtime for a generic list List<E>
The type of elements E must be one of the following types: Float, Integer, Short, Byte, Boolean (also known as wrappers of primitive types).
For List<Double> is not required to use ListWrapper.of(Double.class), you can directly use List.class.
NOTE: Currently List<Long> is not supported, nor can ListWrapper.of(Long.class) be used.
Code Example:
Window win = Desktop.describe(Window.class, new WindowDescription.Builder().title("JavaFrameApp").build());
List<Integer> list = win.getNativeObject().invokeMethod("getListOfIntegers", ListWrapper.of(Integer.class), null);
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount -
Method Summary
Modifier and TypeMethodDescriptionget(int index) Not usedstatic Class<?>Get the type of the items in the list NOTE: The type of items must be one of the following types: Float, Integer, Short, Byte, Boolean (also known as wrappers of primitive types).static <E> Class<ListWrapper<List<E>,E>> Gets the Class object specifically for List interfaceintsize()Not usedMethods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subListMethods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
Method Details
-
of
Gets the Class object specifically for List interface- Parameters:
classOfElements- the type of the list items- Returns:
- Class reference of
ListWrapper.class
-
getTypeOfItems
Get the type of the items in the list NOTE: The type of items must be one of the following types: Float, Integer, Short, Byte, Boolean (also known as wrappers of primitive types). -
size
public int size()Not used- Specified by:
sizein interfaceCollection<K>- Specified by:
sizein interfaceList<K>- Specified by:
sizein classAbstractCollection<E>
-
get
Not used
-