org.sfm.reflect.meta.FieldPropertyMeta Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of simpleFlatMapper Show documentation
Show all versions of simpleFlatMapper Show documentation
Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.
package org.sfm.reflect.meta;
import org.sfm.reflect.Getter;
import org.sfm.reflect.ReflectionService;
import org.sfm.reflect.Setter;
import org.sfm.reflect.impl.FieldGetter;
import org.sfm.reflect.impl.FieldSetter;
import java.lang.reflect.Field;
import java.lang.reflect.Type;
public class FieldPropertyMeta extends PropertyMeta {
private final Field field;
private final Type type;
public FieldPropertyMeta(String name, String columnName, ReflectionService reflectService, Field field, Type type) {
super(name, columnName, reflectService);
this.field = field;
this.type = type;
}
@Override
protected Setter newSetter() {
field.setAccessible(true);
return new FieldSetter(field);
}
@Override
protected Getter newGetter() {
field.setAccessible(true);
return new FieldGetter(field);
}
@Override
public Type getType() {
return type;
}
@Override
public String getPath() {
return getName();
}
@Override
public String toString() {
return "FieldPropertyMeta{" +
"field=" + field +
", type=" + type +
'}';
}
}