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

top.lingkang.finalvalidated.handle.TakeValue Maven / Gradle / Ivy

Go to download

final-validator 是一个JavaBean元数据校验模型和方法验证,能够自定义注解来扩展校验范围,符合国内开发习惯的参数校验java库

The newest version!
package top.lingkang.finalvalidated.handle;

import java.lang.reflect.Field;

/**
 * 反射取值
 *
 * @author lingkang
 * @create by 2024/3/5 10:09
 */
class TakeValue {
    private volatile Field field;

    public TakeValue(Field field) {
        this.field = field;
        field.setAccessible(true);
    }

    public Object take(Object value) {
        try {
            return field.get(value);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy