GetSetPair.java
package org.microspace.table.column;
import org.microspace.annotation.IndexType;
/**
* Get-set pair for a POJO.
* @author Gaspar Sinai - {@literal gaspar.sinai@microspace.org}
* @version 2016-06-26
* @param <T> is the Type of the Object.
*/
public class GetSetPair<T> implements Getter<T>, Setter<T> {
private Getter<T> getter;
private Setter<T> setter;
private int index;
@Override
public String getName () {
return getter.getName();
}
public GetSetPair (Getter<T> getter, Setter<T> setter, int index) {
this.getter = getter;
this.setter = setter;
this.index = index;
}
public GetSetPair () {
this.getter = null;
this.setter = null;
this.index = 0;
}
public int getIndex() {
return index;
}
@Override
public void set(T target, Object o) {
setter.set(target, o);
}
@Override
public Object get(T target) {
return getter.get(target);
}
@Override
public boolean isNull(Object field) {
return getter.isNull(field);
}
@Override
public IndexType getIndexType() {
return getter.getIndexType();
}
@Override
public Class<?> getReturnType() {
return getter.getReturnType();
}
}