Class EntityUtils


  • public final class EntityUtils
    extends Object
    Dynamically perform operations related to repository domain classes.
    Author:
    Jeff Fischer
    • Method Detail

      • findIdField

        @Nullable
        public static Field findIdField​(Class<?> entityClass)
        Find the field marked with the Spring or JPA @Id annotation in the entity class. This process will search superclasses, should an id field not be found on the provided class. Will return null if no id annotated field is found.
        Parameters:
        entityClass - The class to check for the id annotated field
        Returns:
        the id field or null if none found
        Throws:
        IllegalArgumentException - if unable to find an id field
      • findId

        @Nullable
        public static Object findId​(Object entity)