## org.csstudio.opibuilder.scriptUtil
Class DataUtil

    public class DataUtil

extends java.lang.Object

Utility class to facilitate Javascript programming for data operation. The basic data type such as int, double, boolean and string are exchangeable between JavaScript and Java, which means these types of JavaScript variables can be directly used as parameters of Java methods, but array is not exchangeable between JavaScript and Java. This utility class provides methods to create Java array or convert JavaScript array to Java array.

Method Summary
`static double[]` | `getDoubleArray(int size)` Returns a new double array with given size.
`static int[]` | `getIntArray(int size)` Returns a new int array with given size.
`static org.csstudio.opibuilder.util.MacrosInput` | `createMacrosInput(boolean include_parent_macros)` Create a MacrosInput, which can be used as the macros input for a container widget or display.
`static double[]` | `toJavaDoubleArray(org.mozilla.javascript.NativeArray jsArray)` Convert JavaScript array to Java double array.
`static int[]` | `toJavaIntArray(org.mozilla.javascript.NativeArray jsArray)` Convert JavaScript array to Java int array.

Method Detail

### getDoubleArray

    public static final double[] getDoubleArray(int size)

  Returns a new double array with given size.

  Parameters:
    `size` - the size of the array
  Returns:
    a double array with given size.

### getIntArray

    public static final int[] getIntArray(int size)

  Returns a new int array with given size.

  Parameters:
    `size` - the size of the array
  Returns:
    an int array with given size.

### toJavaDoubleArray

    public static final double[] toJavaDoubleArray(org.mozilla.javascript.NativeArray jsArray)

  Convert JavaScript array to Java double array.

  Parameters:
    `jsArray` - JavaScript array
  Returns:
    java array.

### toJavaIntArray

    public static final int[] toJavaIntArray(org.mozilla.javascript.NativeArray jsArray)

  Convert JavaScript array to Java int array.

  Parameters:
    `jsArray` - JavaScript array
  Returns:
    java int array.

### createMacrosInput

    public static final org.csstudio.opibuilder.util.MacrosInput createMacrosInput(boolean include_parent_macros)

  Create a MacrosInput, which can be used as the macros input for a container widget or display. New macro can be added or replaced by `MacrosInput.put(String macroName, String macroValue);`

  Parameters:
    `include_parent_macros` - If parent macros should be included.
  Returns:
    a new created MacrosInput.