org.apache.commons.jexl3.internal

## Class ArrayBuilder

- java.lang.Object
- - org.apache.commons.jexl3.internal.ArrayBuilder

- All Implemented Interfaces:
    JexlArithmetic.ArrayBuilder

      public class ArrayBuilder
      extends Object
      implements JexlArithmetic.ArrayBuilder

  Helper class to create typed arrays.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `added` Number of added items.
    `protected Class<?>` | `commonClass` The intended class array.
    `protected boolean` | `isNumber` Whether the array stores numbers.
    `protected boolean` | `unboxing` Whether we can try unboxing.
    `protected Object[]` | `untyped` The untyped list of items being added.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ArrayBuilder(int size)` Creates a new builder.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(Object value)` Adds a literal to the array.
    `Object` | `create(boolean extended)` Creates the actual "array" instance.
    `protected static Class<?>` | `unboxingClass(Class<?> parm)` Gets the primitive type of a given class (when it exists).

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### commonClass

          protected Class<?> commonClass

      The intended class array.

    - #### isNumber

          protected boolean isNumber

      Whether the array stores numbers.

    - #### unboxing

          protected boolean unboxing

      Whether we can try unboxing.

    - #### untyped

          protected final Object[] untyped

      The untyped list of items being added.

    - #### added

          protected int added

      Number of added items.

  - ### Constructor Detail

    - #### ArrayBuilder

          public ArrayBuilder(int size)

      Creates a new builder.
      Parameters:
        `size` - the exact array size

  - ### Method Detail

    - #### unboxingClass

          protected static Class<?> unboxingClass(Class<?> parm)

      Gets the primitive type of a given class (when it exists).
      Parameters:
        `parm` - a class
      Returns:
        the primitive type or null it the argument is not unboxable

    - #### add

          public void add(Object value)

      Description copied from interface: `JexlArithmetic.ArrayBuilder`
      Adds a literal to the array.
      Specified by:
        `add` in interface `JexlArithmetic.ArrayBuilder`
      Parameters:
        `value` - the item to add

    - #### create

          public Object create(boolean extended)

      Description copied from interface: `JexlArithmetic.ArrayBuilder`
      Creates the actual "array" instance.
      Specified by:
        `create` in interface `JexlArithmetic.ArrayBuilder`
      Parameters:
        `extended` - true when the last argument is ', ...'
      Returns:
        the array

Copyright © 2001–2015 The Apache Software Foundation. All rights reserved.