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

com.buger.patcher.resolver.impl.AlwaysSourceFieldValueResolver Maven / Gradle / Ivy

Go to download

Java Object Patcher is simple, dependency-free and fast library which makes patching/merging objects simple.

The newest version!
package com.buger.patcher.resolver.impl;

import com.buger.patcher.exception.FieldValueResolverException;
import com.buger.patcher.resolver.FieldValueResolver;

import java.lang.reflect.Field;

/**
 * @author Created by Buheria Oleksii {@literal [email protected]}
 * @version 1.0
 * @since 28-09-2020
 */
public class AlwaysSourceFieldValueResolver implements FieldValueResolver {

    private final Field field;

    public AlwaysSourceFieldValueResolver(Field field) {
        this.field = field;
    }

    public Object resolveFieldValue(Object source, Object target) throws FieldValueResolverException {
        try {
            return field.get(source);
        } catch (IllegalAccessException e) {
            throw new FieldValueResolverException();
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy