/** * Reads a collection of field values for the emulated fields * {@code emulatedFields} * * @param emulatedFields an {@code EmulatedFieldsForLoading}, concrete subclass * of {@code GetField} * @throws IOException If an IO exception happened when reading the field values. * @throws InvalidClassException If an incompatible type is being assigned to an emulated * field. * @throws OptionalDataException If optional data could not be found when reading the * exception graph * @see #readFields * @see #readObject() */ private void readFieldValues(EmulatedFieldsForLoading emulatedFields) throws OptionalDataException, InvalidClassException, IOException { EmulatedFields.ObjectSlot[] slots = emulatedFields.emulatedFields().slots(); for (ObjectSlot element : slots) { element.defaulted = false; Class<?> type = element.field.getType(); if (type == int.class) { element.fieldValue = input.readInt(); } else if (type == byte.class) { element.fieldValue = input.readByte(); } else if (type == char.class) { element.fieldValue = input.readChar(); } else if (type == short.class) { element.fieldValue = input.readShort(); } else if (type == boolean.class) { element.fieldValue = input.readBoolean(); } else if (type == long.class) { element.fieldValue = input.readLong(); } else if (type == float.class) { element.fieldValue = input.readFloat(); } else if (type == double.class) { element.fieldValue = input.readDouble(); } else { // Either array or Object try { element.fieldValue = readObject(); } catch (ClassNotFoundException cnf) { // WARNING- Not sure this is the right thing to do. Write // test case. throw new InvalidClassException(cnf.toString()); } } } }
/** * Reads a collection of field values for the emulated fields * {@code emulatedFields} * * @param emulatedFields * an {@code EmulatedFieldsForLoading}, concrete subclass * of {@code GetField} * * @throws IOException * If an IO exception happened when reading the field values. * @throws InvalidClassException * If an incompatible type is being assigned to an emulated * field. * @throws OptionalDataException * If optional data could not be found when reading the * exception graph * * @see #readFields * @see #readObject() */ private void readFieldValues(EmulatedFieldsForLoading emulatedFields) throws OptionalDataException, InvalidClassException, IOException { EmulatedFields.ObjectSlot[] slots = emulatedFields.emulatedFields().slots(); for (ObjectSlot element : slots) { element.defaulted = false; Class<?> type = element.field.getType(); if (type == int.class) { element.fieldValue = input.readInt(); } else if (type == byte.class) { element.fieldValue = input.readByte(); } else if (type == char.class) { element.fieldValue = input.readChar(); } else if (type == short.class) { element.fieldValue = input.readShort(); } else if (type == boolean.class) { element.fieldValue = input.readBoolean(); } else if (type == long.class) { element.fieldValue = input.readLong(); } else if (type == float.class) { element.fieldValue = input.readFloat(); } else if (type == double.class) { element.fieldValue = input.readDouble(); } else { // Either array or Object try { element.fieldValue = readObject(); } catch (ClassNotFoundException cnf) { // WARNING- Not sure this is the right thing to do. Write // test case. throw new InvalidClassException(cnf.toString()); } } } }
/** * Reads a collection of field values for the emulated fields * {@code emulatedFields} * * @param emulatedFields * an {@code EmulatedFieldsForLoading}, concrete subclass * of {@code GetField} * * @throws IOException * If an IO exception happened when reading the field values. * @throws InvalidClassException * If an incompatible type is being assigned to an emulated * field. * @throws OptionalDataException * If optional data could not be found when reading the * exception graph * * @see #readFields * @see #readObject() */ private void readFieldValues(EmulatedFieldsForLoading emulatedFields) throws OptionalDataException, InvalidClassException, IOException { EmulatedFields.ObjectSlot[] slots = emulatedFields.emulatedFields() .slots(); for (ObjectSlot element : slots) { element.defaulted = false; Class<?> type = element.field.getType(); if (type == Integer.TYPE) { element.fieldValue = Integer.valueOf(input.readInt()); } else if (type == Byte.TYPE) { element.fieldValue = Byte.valueOf(input.readByte()); } else if (type == Character.TYPE) { element.fieldValue = Character.valueOf(input.readChar()); } else if (type == Short.TYPE) { element.fieldValue = Short.valueOf(input.readShort()); } else if (type == Boolean.TYPE) { element.fieldValue = Boolean.valueOf(input.readBoolean()); } else if (type == Long.TYPE) { element.fieldValue = Long.valueOf(input.readLong()); } else if (type == Float.TYPE) { element.fieldValue = Float.valueOf(input.readFloat()); } else if (type == Double.TYPE) { element.fieldValue = Double.valueOf(input.readDouble()); } else { // Either array or Object try { element.fieldValue = readObject(); } catch (ClassNotFoundException cnf) { // WARNING- Not sure this is the right thing to do. Write // test case. throw new InvalidClassException(cnf.toString()); } } } }
/** * Reads a collection of field values for the emulated fields * <code>emulatedFields</code> * * @param emulatedFields * an <code>EmulatedFieldsForLoading</code>, concrete subclass * of <code>GetField</code> * * @throws IOException * If an IO exception happened when reading the field values. * @throws InvalidClassException * If an incompatible type is being assigned to an emulated * field. * @throws OptionalDataException * If optional data could not be found when reading the * exception graph * * @see #readFields * @see #readObject() */ private void readFieldValues(EmulatedFieldsForLoading emulatedFields) throws OptionalDataException, InvalidClassException, IOException { EmulatedFields.ObjectSlot[] slots = emulatedFields.emulatedFields() .slots(); for (ObjectSlot element : slots) { element.defaulted = false; Class<?> type = element.field.getType(); if (type == Integer.TYPE) { element.fieldValue = Integer.valueOf(input.readInt()); } else if (type == Byte.TYPE) { element.fieldValue = Byte.valueOf(input.readByte()); } else if (type == Character.TYPE) { element.fieldValue = Character.valueOf(input.readChar()); } else if (type == Short.TYPE) { element.fieldValue = Short.valueOf(input.readShort()); } else if (type == Boolean.TYPE) { element.fieldValue = Boolean.valueOf(input.readBoolean()); } else if (type == Long.TYPE) { element.fieldValue = Long.valueOf(input.readLong()); } else if (type == Float.TYPE) { element.fieldValue = Float.valueOf(input.readFloat()); } else if (type == Double.TYPE) { element.fieldValue = Double.valueOf(input.readDouble()); } else { // Either array or Object try { element.fieldValue = readObject(); } catch (ClassNotFoundException cnf) { // WARNING- Not sure this is the right thing to do. Write // test case. throw new InvalidClassException(cnf.toString()); } } } }