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

org.tools4j.groovytables.GroovyTables.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 groovy.transform.TypeChecked

import java.util.function.Predicate

/**
 * User: ben
 * Date: 5/04/2016
 * Time: 5:33 PM
 *
 * This class provides the public interface into the API
 */
@TypeChecked
class GroovyTables {
    static  CoercionTableParser.Builder createListOf(final Class clazz) {
        return CoercionTableParser.createListOf(clazz);
    }

    static List createListOfArrays(final Closure tableContent) {
        return SimpleTableParser.createListOfArrays(tableContent)
    }

    static List createListOfRowsObjects(Closure tableContent) {
        return SimpleTableParser.createListOfRows(tableContent)
    }

    static Rows createRows(Closure tableContent) {
        return SimpleTableParser.createRows(tableContent)
    }

    static  List createFromTable(final Class clazz, final Closure tableContent) {
        return CoercionTableParser.createFromTable(clazz, ConstructionMethodFilter.INCLUDE_ALL, tableContent)
    }

    static  List createFromTable(final Class clazz, final Predicate constructionMethodFilter, final Closure tableContent) {
        return CoercionTableParser.createFromTable(clazz, constructionMethodFilter, tableContent)
    }

    static Rows withTable(final Closure tableContent) {
        return SimpleTableParser.createRows(tableContent)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy