code: public Object[] asArray(Object value) {
  
          if(value == null) {
              return null;
          }
  
          if (value.getClass().isArray()) {
              return (Object[]) value;
          }
  
          if (value instanceof List) {
              return ((List) value).toArray();
          }
  
          return new Object[]{value};
      }
docs: Returns this value as an array. If a value is already an array,
  it is casted to a `Object[]`, if it's a `java.util.List`, it is
  converted to an array and in all other cases, `value` is simply
  returned as an `Object[]` with a single value in it.
  
  @param value
  the value to convert/cast to an array.
  
  @return this value as an array.