Class ObjectWriter

java.lang.Object
com.comphenix.protocol.reflect.ObjectWriter

public class ObjectWriter extends Object
Can copy an object field by field.
  • Constructor Details

    • ObjectWriter

      public ObjectWriter()
  • Method Details

    • copyTo

      public void copyTo(Object source, Object destination, Class<?> commonType)
      Copy every field in object A to object B. Each value is copied directly, and is not cloned.

      The two objects must have the same number of fields of the same type.

      Parameters:
      source - - fields to copy.
      destination - - fields to copy to.
      commonType - - type containing each field to copy.
    • transformField

      protected void transformField(StructureModifier<Object> modifierSource, StructureModifier<Object> modifierDest, int fieldIndex)
      Called for every non-static field that will be copied.
      Parameters:
      modifierSource - - modifier for the original object.
      modifierDest - - modifier for the new cloned object.
      fieldIndex - - the current field index.