public static Object parseToObject()

in src/org/doublecloud/ws/util/ReflectUtil.java [260:335]


  public static Object parseToObject(String type, List<String> values) 
  {
    if("String".equals(type) || "string".equals(type))
    {
      return values.get(0);
    }
    else if("String[]".equals(type))
    {
      return values;
    }
    else if("int".equals(type))
    {
      return new Integer(values.get(0));
    }
    else if("int[]".equals(type))
    {
      return toIntArray(values);
    }
    else if("short".equals(type))
    {
      return new Short(values.get(0));
    }
    else if("short[]".equals(type))
    {
      return toShortArray(values);
    }
    else if("byte".equals(type))
    {
      return new Byte(values.get(0));
    }
    else if("byte[]".equals(type))
    {
      return toByteArray(values);
    }
    else if("long".equals(type))
    {
      return new Long(values.get(0));
    }
    else if("long[]".equals(type))
    {
      return toLongArray(values);
    }
    else if("float".equals(type))
    {
      return new Float(values.get(0));
    }
    else if("float[]".equals(type))
    {
      return toFloatArray(values);
    }
    else if("boolean".equals(type))
    {
      return new Boolean(values.get(0));
    }
    else if("boolean[]".equals(type))
    {
      return toBooleanArray(values);
    }
    else if("Calendar".equals(type)  || "dateTime".equals(type))
    {
      Calendar cal = DatatypeConverter.parseTime(values.get(0));
      return cal;
    }
    else if("double".equals(type))
    {
      return new Double(values.get(0));
    }
    else if("double[]".equals(type))
    {
      return toDoubleArray(values);
    }
    else
    {
      throw new RuntimeException("Unexpected Type at parseToObject: " + type + values.get(0));
    }
  }