private static Set<Field> findAllFieldsUsingStrategy(FieldMatcherStrategy strategy, Object object,
                                                         boolean checkHierarchy, Class<?> startClass) {
        assertObjectInGetInternalStateIsNotNull(object);
        final Set<Field> foundFields = new LinkedHashSet<Field>();
        while (startClass != null) {
            final Field[] declaredFields = startClass.getDeclaredFields();
            for (Field field : declaredFields) {
                if (strategy.matches(field) && hasFieldProperModifier(object, field)) {
                    // TODO replace by the class 
                    try {
                        field.setAccessible(true);
                        foundFields.add(field);
                    } catch (Exception ignored) {
                        // the InaccessibleObjectException is thrown in Java 9 in case
                        // if a field is private and a module is not open
                    }
                }
            }
            if (!checkHierarchy) {
                break;
            }
            startClass = startClass.getSuperclass();
        }

        return Collections.unmodifiableSet(foundFields);
    }
private static Set < Field > findAllFieldsUsingStrategy ( FieldMatcherStrategy strategy , Object object , boolean checkHierarchy , Class < ? > startClass ) { assertObjectInGetInternalStateIsNotNull ( object ) ; final Set < Field > foundFields = new LinkedHashSet < Field > ( ) ; while ( startClass != null ) { final Field [ ] declaredFields = startClass . getDeclaredFields ( ) ; for ( Field field : declaredFields ) { if ( strategy . matches ( field ) && hasFieldProperModifier ( object , field ) ) { try { field . setAccessible ( true ) ; foundFields . add ( field ) ; } catch ( Exception ignored ) { } } } if ( ! checkHierarchy ) { break ; } startClass = startClass . getSuperclass ( ) ; } return Collections . unmodifiableSet ( foundFields ) ; }
Find all fields using strategy.

@param strategy       the strategy
@param object         the object
@param checkHierarchy the check hierarchy
@param startClass     the start class
@return the set