org.tools4j.groovytables.StaticFactoryMethodConstructionCall.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.Executable
import java.lang.reflect.Method
/**
* User: ben
* Date: 19/02/2016
* Time: 5:26 PM
*/
class StaticFactoryMethodConstructionCall implements ExecutableConstructionCall{
private Method method;
StaticFactoryMethodConstructionCall(final Method method) {
this.method = method
}
@Override
T construct(final Object[] args) {
method.setAccessible(true)
return (T) method.invoke(null, args)
}
@Override
Executable getExecutable() {
return method
}
}