private Collection<Field> getDeclaredFields() {
      final LinkedList<Field> declaredFields = new LinkedList<>(Arrays.asList(clazz.getDeclaredFields()));
      for (Class<?> c = clazz.getSuperclass(); c != null; c = c.getSuperclass()) {
         // support fields from MappedSuperclass(es).
         // Do not support ambiguous annotation. Spec says:
         // "A mapped superclass has no separate table defined for it".
         if (c.getAnnotation(MappedSuperclass.class) != null) {
            if (c.getAnnotation(Table.class) == null) {
               declaredFields.addAll(Arrays.asList(c.getDeclaredFields()));
            }
            else {
               throw new RuntimeException("Class " + c.getName() + " annotated with @MappedSuperclass cannot also have @Table annotation");
            }
         }
      }
      return declaredFields;
   }
private Collection < Field > getDeclaredFields ( ) { final LinkedList < Field > declaredFields = new LinkedList < > ( Arrays . asList ( clazz . getDeclaredFields ( ) ) ) ; for ( Class < ? > c = clazz . getSuperclass ( ) ; c != null ; c = c . getSuperclass ( ) ) { if ( c . getAnnotation ( MappedSuperclass . class ) != null ) { if ( c . getAnnotation ( Table . class ) == null ) { declaredFields . addAll ( Arrays . asList ( c . getDeclaredFields ( ) ) ) ; } else { throw new RuntimeException ( "Class " + c . getName ( ) + " annotated with @MappedSuperclass cannot also have @Table annotation" ) ; } } } return declaredFields ; }
Get the declared {@link Field}s for the class, including declared fields from mapped
superclasses.