Class FieldUtils

java.lang.Object
com.creativityfactory.swiftserver.utils.FieldUtils

public class FieldUtils extends Object
This class provides utility methods for working with fields using reflection.
  • Constructor Details

    • FieldUtils

      public FieldUtils()
  • Method Details

    • getAllFields

      public static List<Field> getAllFields(Class<?> clazz)
      Returns all the fields of a class including the inherited ones using reflection.
      Parameters:
      clazz - The class to retrieve fields from.
      Returns:
      A List of Field objects representing all the fields of the given class.
    • updateFields

      public static Object updateFields(Object oldObj, Object newObj)
      Updates the fields of an old object with the fields of a new object of the same class.
      Parameters:
      oldObj - the old object to update
      newObj - the new object containing the updated field values
      Returns:
      the updated old object or null if the classes of the old and new objects do not match