Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.lang.reflect.Field;

import java.util.ArrayList;
import java.util.Arrays;

import java.util.List;

public class Main {
    private static List<Field> getClassFields(Class clazz) {
        ArrayList<Field> fields = new ArrayList<>(Arrays.asList(clazz.getDeclaredFields()));
        if (clazz.getSuperclass() != null) {
            fields.addAll(getClassFields(clazz.getSuperclass()));
        }
        return fields;
    }
}