gu.sql2java.ColumnGetter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sql2java-base Show documentation
Show all versions of sql2java-base Show documentation
sql2java common class package
package gu.sql2java;
import com.google.common.base.Function;
public class ColumnGetter implements Function{
private final int columnId;
private final String columnName;
public ColumnGetter(int columnId) {
this.columnId = columnId;
this.columnName = null;
}
public ColumnGetter(String columnName) {
this.columnId = -1;
this.columnName = columnName;
}
@Override
public T apply(BaseBean input) {
if(null != input){
if(columnId >= 0){
return input.getValue(columnId);
}else if(columnName != null){
return input.getValue(columnName);
}
}
return null;
}
}