/** * For types that need to be copied (e.g. Vector3f) for safe usage, this method will create a new copy of a field from an object. * Otherwise it behaves the same as getValue * This method is checked to conform to the generic parameters of the FieldMetadata * * @param from The object to copy the field from * @return A safe to use copy of the value of this field in the given object */ public U getCopyOfValueChecked(T from) { return getCopyOfValue(from); }
/** * @param object The instance of this class to copy * @return A copy of the given object */ public T copy(T object) { T result = constructor.construct(); if (result != null) { for (FIELD field : fields.values()) { field.setValue(result, field.getCopyOfValue(object)); } } return result; }