Package com.comphenix.protocol.reflect
Class ObjectWriter
java.lang.Object
com.comphenix.protocol.reflect.ObjectWriter
Can copy an object field by field.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCopy every field in object A to object B.protected voidtransformField(StructureModifier<Object> modifierSource, StructureModifier<Object> modifierDest, int fieldIndex) Called for every non-static field that will be copied.
-
Constructor Details
-
ObjectWriter
public ObjectWriter()
-
-
Method Details
-
copyTo
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.
-