001package org.kohsuke.args4j.spi; 002 003import java.lang.reflect.Field; 004 005/** 006 * An abstract Getter is of the type of the underlying bean and is not multivalued 007 * 008 * @author Sina Samangooei (ss@ecs.soton.ac.uk) 009 * @author Jonathon Hare (jsh2@ecs.soton.ac.uk) 010 * 011 * @param <T> 012 */ 013public abstract class AbstractGetter<T> implements Getter<T>{ 014 protected Class<?> type; 015 protected Field f; 016 protected Object bean; 017 private String name; 018 019 /** 020 * @param name 021 * @param bean 022 * @param f 023 */ 024 public AbstractGetter(String name, Object bean, Field f) { 025 this.type = bean.getClass(); 026 this.f = f; 027 this.bean = bean; 028 this.name = name; 029 } 030 031 @Override 032 public String getOptionName() { 033 return name; 034 } 035 036 @Override 037 public Class<?> getType() { 038 return type; 039 } 040 041 @Override 042 public boolean isMultiValued() { 043 return false; 044 } 045}