cdm/src/main/java/ucar/nc2/Attribute.java
public void setValues(List values)
  {
    if(values == null || values.size() == 0)
	throw new IllegalArgumentException("Cannot determine attribute's type");
    int n = values.size();
    Class c = values.get(0).getClass();
    Object pa;

    if (c == String.class) {
      String[] va = new String[n];
      pa = va;
      for (int i = 0; i < n; i++) va[i] = (String) values.get(i);
    } else if (c == Integer.class) {
      int[] va = new int[n];
      pa = va;
      for (int i = 0; i < n; i++) va[i] = (Integer) values.get(i);
    } else if (c == Double.class) {
      double[] va = new double[n];
      pa = va;
      for (int i = 0; i < n; i++) va[i] = (Double) values.get(i);
    } else if (c == Float.class) {
      float[] va = new float[n];
      pa = va;
      for (int i = 0; i < n; i++) va[i] = (Float) values.get(i);
    } else if (c == Short.class) {
      short[] va = new short[n];
      pa = va;
      for (int i = 0; i < n; i++) va[i] = (Short) values.get(i);
    } else if (c == Byte.class) {
      byte[] va = new byte[n];
      pa = va;
      for (int i = 0; i < n; i++) va[i] = (Byte) values.get(i);
    } else if (c == Long.class) {
      long[] va = new long[n];
      pa = va;
      for (int i = 0; i < n; i++) va[i] = (Long) values.get(i);
    } else {
      throw new IllegalArgumentException("Unknown type for Attribute = " + c.getName());
    }
    setValues(Array.factory(this.dataType, new int[]{n}, pa));
  }
public void setValues(List values)
  {
    if(values == null || values.size() == 0)
	throw new IllegalArgumentException("Cannot determine attribute's type");
    int n = values.size();
    Class c = values.get(0).getClass();
    Object pa;

    if (c == String.class) {
      String[] va = new String[n];
      pa = va;
      for (int i = 0; i < n; i++) va[i] = (String) values.get(i);
    } else if (c == Integer.class) {
      int[] va = new int[n];
      pa = va;
      for (int i = 0; i < n; i++) va[i] = (Integer) values.get(i);
    } else if (c == Double.class) {
      double[] va = new double[n];
      pa = va;
      for (int i = 0; i < n; i++) va[i] = (Double) values.get(i);
    } else if (c == Float.class) {
      float[] va = new float[n];
      pa = va;
      for (int i = 0; i < n; i++) va[i] = (Float) values.get(i);
    } else if (c == Short.class) {
      short[] va = new short[n];
      pa = va;
      for (int i = 0; i < n; i++) va[i] = (Short) values.get(i);
    } else if (c == Byte.class) {
      byte[] va = new byte[n];
      pa = va;
      for (int i = 0; i < n; i++) va[i] = (Byte) values.get(i);
    } else if (c == Long.class) {
      long[] va = new long[n];
      pa = va;
      for (int i = 0; i < n; i++) va[i] = (Long) values.get(i);
    } else {
      throw new IllegalArgumentException("Unknown type for Attribute = " + c.getName());
    }
    setValues(Array.factory(this.dataType, new int[]{n}, pa));
  }
public void setValues ( List values ) { if ( values == null || values . size ( ) == 0 ) throw new IllegalArgumentException ( "Cannot determine attribute's type" ) ; int n = values . size ( ) ; Class c = values . get ( 0 ) . getClass ( ) ; Object pa ; if ( c == String . class ) { String [ ] va = new String [ n ] ; pa = va ; for ( int i = 0 ; i < n ; i ++ ) va [ i ] = ( String ) values . get ( i ) ; } else if ( c == Integer . class ) { int [ ] va = new int [ n ] ; pa = va ; for ( int i = 0 ; i < n ; i ++ ) va [ i ] = ( Integer ) values . get ( i ) ; } else if ( c == Double . class ) { double [ ] va = new double [ n ] ; pa = va ; for ( int i = 0 ; i < n ; i ++ ) va [ i ] = ( Double ) values . get ( i ) ; } else if ( c == Float . class ) { float [ ] va = new float [ n ] ; pa = va ; for ( int i = 0 ; i < n ; i ++ ) va [ i ] = ( Float ) values . get ( i ) ; } else if ( c == Short . class ) { short [ ] va = new short [ n ] ; pa = va ; for ( int i = 0 ; i < n ; i ++ ) va [ i ] = ( Short ) values . get ( i ) ; } else if ( c == Byte . class ) { byte [ ] va = new byte [ n ] ; pa = va ; for ( int i = 0 ; i < n ; i ++ ) va [ i ] = ( Byte ) values . get ( i ) ; } else if ( c == Long . class ) { long [ ] va = new long [ n ] ; pa = va ; for ( int i = 0 ; i < n ; i ++ ) va [ i ] = ( Long ) values . get ( i ) ; } else { throw new IllegalArgumentException ( "Unknown type for Attribute = " + c . getName ( ) ) ; } setValues ( Array . factory ( this . dataType , new int [ ] { n } , pa ) ) ; }
set the values from a list

@param values
set the values from a list