001package org.kohsuke.stapler.lang.util;
002
003import org.kohsuke.stapler.lang.FieldRef;
004
005import java.lang.annotation.Annotation;
006import java.lang.reflect.Field;
007
008/**
009 * {@link FieldRef} filter as a convenience class.
010 *
011 * @author Kohsuke Kawaguchi
012 */
013public abstract class FieldRefFilter extends FieldRef {
014    protected abstract FieldRef getBase();
015
016    @Override
017    public String getName() {
018        return getBase().getName();
019    }
020
021    @Override
022    public Object get(Object instance) throws IllegalAccessException {
023        return getBase().get(instance);
024    }
025
026    @Override
027    public boolean isStatic() {
028        return getBase().isStatic();
029    }
030
031    @Override
032    public String getQualifiedName() {
033        return getBase().getQualifiedName();
034    }
035
036    @Override
037    public boolean isRoutable() {
038        return getBase().isRoutable();
039    }
040
041    public static FieldRef wrap(Field f) {
042        return FieldRef.wrap(f);
043    }
044
045    @Override
046    public <T extends Annotation> T getAnnotation(Class<T> type) {
047        return getBase().getAnnotation(type);
048    }
049
050    @Override
051    public boolean hasAnnotation(Class<? extends Annotation> type) {
052        return getBase().hasAnnotation(type);
053    }
054}