Java Array Convert to convertArrayValue(Object value, Class type)

Here you can find the source of convertArrayValue(Object value, Class type)

Description

convert Array Value

License

BSD License

Declaration

private static Object convertArrayValue(Object value, Class<?> type) 

Method Source Code

//package com.java2s;
/*L// w ww .ja v  a 2 s .c o  m
 * Copyright Northwestern University.
 *
 * Distributed under the OSI-approved BSD 3-Clause License.
 * See http://ncip.github.io/psc/LICENSE.txt for details.
 */

public class Main {
    private static Object convertArrayValue(Object value, Class<?> type) {
        if (type.equals(String.class)) {
            return value.toString();
        } else if (type.equals(Long.class)) {
            return ((Number) value).longValue();
        } else if (type.equals(Double.class)) {
            return ((Number) value).doubleValue();
        } else {
            return value;
        }
    }
}

Related

  1. convertArrayToCSVString(String[] s)
  2. convertArrayToInteger(String[] input)
  3. convertArrayToLine(String[] cols)
  4. convertArrayType(String type)
  5. convertArrayTypeName(final String typeName)
  6. toDoubleArray(byte[] data)
  7. toDoubleArray(Double[] list)
  8. toDoubleArray(final int[] intArray)
  9. toFloatArray(final double[] doubles)