code: @SuppressWarnings("unchecked")
  	public <T extends Value> T getField(final int fieldNum, final Class<T> type) {
  		// range check
  		if (fieldNum < 0 || fieldNum >= this.numFields) {
  			throw new IndexOutOfBoundsException(fieldNum + " for range [0.." + (this.numFields - 1) + "]");
  		}
  		
  		// get offset and check for null
  		final int offset = this.offsets[fieldNum];
  		if (offset == NULL_INDICATOR_OFFSET) {
  			return null;
  		}		
  		else if (offset == MODIFIED_INDICATOR_OFFSET) {
  			// value that has been set is new or modified
  			return (T) this.writeFields[fieldNum];
  		}
  		
  		final int limit = offset + this.lengths[fieldNum];
  		
  		// get an instance, either from the instance cache or create a new one
  		final Value oldField = this.readFields[fieldNum]; 
  		final T field;
  		if (oldField != null && oldField.getClass() == type) {
  			field = (T) oldField;
  		}
  		else {
  			field = InstantiationUtil.instantiate(type, Value.class);
  			this.readFields[fieldNum] = field;
  		}
  		
  		// deserialize
  		deserialize(field, offset, limit, fieldNum);
  		return field;
  	}
docs: Gets the field at the given position from the record. This method checks internally, if this instance of
  the record has previously returned a value for this field. If so, it reuses the object, if not, it
  creates one from the supplied class.
  
  @param <T> The type of the field.
  
  @param fieldNum The logical position of the field.
  @param type The type of the field as a class. This class is used to instantiate a value object, if none had
  previously been instantiated.
  @return The field at the given position, or null, if the field was null.
  @throws IndexOutOfBoundsException Thrown, if the field number is negative or larger or equal to the number of
  fields in this record.