check if field is from Sub Class - Android java.lang.reflect

Android examples for java.lang.reflect:Field

Description

check if field is from Sub Class

Demo Code


//package com.java2s;

import java.lang.reflect.Field;

public class Main {
    public static boolean isSubClass(Field field, Class<?> clazz) {
        return clazz.isAssignableFrom(field.getType());
    }// ww  w. j av  a 2  s  . c  om
}

Related Tutorials