Class Fields


  • public class Fields
    extends Object
    Utility class for working with Field's
    • Constructor Detail

      • Fields

        public Fields()
    • Method Detail

      • findField

        public static Optional<Field> findField​(Set<Field> fields,
                                                String fieldName,
                                                Class<?> fieldType)
        Find a field by name and type
        Parameters:
        fields - the set of Fields (e.g. returned by fields(Class))
        fieldName - the name of the field
        fieldType - the type of the field
        Returns:
        Optional with the matching field or Optional.empty()
      • fields

        public static Set<Field> fields​(Class<?> type)
        Get all fields in the type
        Parameters:
        type - the type we want to find all fields within
        Returns:
        all fields (each marked as accessible) in the type