org.tools4j.groovytables.FieldSetMethodViaDirectFieldAccess.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of groovy-tables Show documentation
Show all versions of groovy-tables Show documentation
A groovy API which allows you to create lists of objects using a table like grammar.
package org.tools4j.groovytables
import java.lang.reflect.Field
/**
* User: ben
* Date: 14/03/2016
* Time: 6:36 AM
*/
class FieldSetMethodViaDirectFieldAccess implements FieldSetMethod {
final Field field
FieldSetMethodViaDirectFieldAccess(final Field field) {
this.field = field
}
@Override
void execute(final T object, final Object coercedArg) {
field.set(object, coercedArg)
}
@Override
public String toString() {
return "DirectFieldAccess{$field.name}";
}
}