All Downloads are FREE. Search and download functionalities are using the official Maven repository.

uk.sponte.automation.seleniumpom.helpers.ClassHelper Maven / Gradle / Ivy

There is a newer version: 3.0.14
Show newest version
package uk.sponte.automation.seleniumpom.helpers;

import com.google.common.collect.Lists;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by n450777 on 30/04/15.
 */
public class ClassHelper {
    public static Iterable getFieldsFromClass(Class startClass) {
        List currentClassFields = new ArrayList();
        Class parentClass = startClass.getSuperclass();

        if (parentClass != null) {
            List parentClassFields =
                    (List) getFieldsFromClass(parentClass);
            currentClassFields.addAll(parentClassFields);
        }

        currentClassFields.addAll(Lists.newArrayList(startClass.getDeclaredFields()));
        return currentClassFields;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy