All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.tools4j.groovytables.StaticFactoryMethodConstructionCall.groovy Maven / Gradle / Ivy

Go to download

A groovy API which allows you to create lists of objects using a table like grammar.

There is a newer version: 1.6
Show newest version
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
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy