@SuppressWarnings({ "unchecked", "rawtypes" }) private static FieldValue asArray(ArrayDataType arrType, List<FieldValue> values) { Array out = arrType.createFieldValue(); for (FieldValue val : values) { if (val == null) { continue; } out.addAll((Array)val); } return out; }
@Override public void assign(Object o) { if (!checkAssign(o)) { return; } if (o instanceof Array) { if (o == this) return; Array a = (Array) o; values.clear(); addAll(a.values); } else if (o instanceof List) { values = new ListWrapper<T>((List) o); } else { throw new IllegalArgumentException("Class " + o.getClass() + " not applicable to an " + this.getClass() + " instance."); } }
public <T extends FieldValue> void read(FieldBase field, Array<T> array) { int numElements = getNumCollectionElems(); ArrayList<T> list = new ArrayList<T>(numElements); ArrayDataType type = array.getDataType(); for (int i = 0; i < numElements; i++) { if (version < 7) { getInt(null); // We don't need size for anything } FieldValue fv = type.getNestedType().createFieldValue(); fv.deserialize(null, this); list.add((T) fv); } array.clear(); array.addAll(list); }
public <T extends FieldValue> void read(FieldBase field, Array<T> array) { int numElements = getNumCollectionElems(); ArrayList<T> list = new ArrayList<T>(numElements); ArrayDataType type = array.getDataType(); for (int i = 0; i < numElements; i++) { if (version < 7) { getInt(null); // We don't need size for anything } FieldValue fv = type.getNestedType().createFieldValue(); fv.deserialize(null, this); list.add((T) fv); } array.clear(); array.addAll(list); }