public class PluginUtil extends Object
Modifier and Type | Method and Description |
---|---|
static <T> List<T> |
ensureIterable(List<T> externalList)
|
static <T> Set<T> |
ensureIterable(Set<T> externalSet)
|
static Integer |
toInteger(int value)
Integer is not a JsType and can't be shared across
scripts. |
public static <T> List<T> ensureIterable(List<T> externalList)
List
is a JsType
but Collection.iterator()
is
JsIgnore
d and therefore not exported to JavaScript.
This method takes a list and converts it to a new list so it can be iterated over in the current script (e.g. using enhanced for loops), even if the instance was provided by an external (GWT-compiled) script.
externalList
- A list, possibly provided by an external script. Must not be null.public static <T> Set<T> ensureIterable(Set<T> externalSet)
Set
is a JsType
but Collection.iterator()
is
JsIgnore
d and therefore not exported to JavaScript.
This method takes a set and converts it to a new set so it can be iterated over in the current script (e.g. using enhanced for loops), even if the instance was provided by an external (GWT-compiled) script.
externalSet
- A set, possibly provided by an external script. Must not be null.Copyright © 2012–2018 JBoss by Red Hat. All rights reserved.