private static Stream<Element> asFields(Element element) {
        switch (element.getKind()) {
            case FIELD:
                return Stream.of(element);
            case CLASS:
                return element.getEnclosedElements().stream().flatMap(MatcherFactoryGenerator::asFields);
        }
        return Stream.empty();
    }
private static Stream < Element > asFields ( Element element ) { switch ( element . getKind ( ) ) { case FIELD : return Stream . of ( element ) ; case CLASS : return element . getEnclosedElements ( ) . stream ( ) . flatMap ( MatcherFactoryGenerator :: asFields ) ; } return Stream . empty ( ) ; }
Recursively adds to stream all fields of class of fields of nested class

@param element class/field element
@return stream with fields we want to process