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

org.jtransfo.internal.SimpleSyntheticField Maven / Gradle / Ivy

There is a newer version: 2.10
Show newest version
/*
 * This file is part of jTransfo, a library for converting to and from transfer objects.
 * Copyright (c) PROGS bvba, Belgium
 *
 * The program is available in open source according to the Apache License, Version 2.0.
 * For full licensing details, see LICENSE.txt in the project root.
 */

package org.jtransfo.internal;

import java.lang.reflect.Field;

/**
 * Simple synthetic field which just exposes the field itself.
 */
public class SimpleSyntheticField implements SyntheticField {

    private Field field;

    /**
     * Constructor.
     *
     * @param field field (may be in a parent class of clazz)
     */
    public SimpleSyntheticField(Field field) {
        this.field = field;
    }

    @Override
    public Object get(Object object) throws IllegalAccessException, IllegalArgumentException {
        return field.get(object);
    }

    @Override
    public void set(Object object, Object value) throws IllegalAccessException, IllegalArgumentException {
        field.set(object, value);
    }

    @Override
    public String getName() {
        return field.getName();
    }

    @Override
    public Class getType() {
        return field.getType();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy