Class PluginUtil


  • public class PluginUtil
    extends Object
    Utilities for working with external (GWT-compiled) plugins.
    • Method Detail

      • ensureIterable

        public static <T> List<T> ensureIterable​(List<T> externalList)
        List is a JsType but Collection.iterator() is JsIgnored 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.

        Parameters:
        externalList - A list, possibly provided by an external script. Must not be null.
        Returns:
        an immutable list containing the original elements of the provided list
      • ensureIterable

        public static <T> Set<T> ensureIterable​(Set<T> externalSet)
        Set is a JsType but Collection.iterator() is JsIgnored 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.

        Parameters:
        externalSet - A set, possibly provided by an external script. Must not be null.
        Returns:
        an immutable set containing the original elements of the provided set
      • toInteger

        public static Integer toInteger​(int value)
        Integer is not a JsType and can't be shared across scripts.

        This method converts a regular int to an Integer using -1 as a placeholder for null.

        Parameters:
        value -
        Returns:
        boxed Integer, null if provided value is -1.