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

org.tools4j.groovytables.Row.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.ToString

/**
 * User: ben
 * Date: 4/02/2016
 * Time: 5:43 PM
 */
@ToString
class Row {
    List values = []

    public Row or(Object arg) {
        return doOr(arg)
    }

    public Row or(Object[] arg) {
        return doOr(arg)
    }

    public Row or(Double arg) {
        return doOr(arg)
    }

    public Row or(Long arg) {
        return doOr(arg)
    }

    public Row or(Integer arg) {
        return doOr(arg)
    }


    public Row or(Boolean arg) {
        return doOr(arg)
    }

    public Row or(Float arg) {
        return doOr(arg)
    }

    public Row or(Short arg) {
        return doOr(arg)
    }

    public Row or(Byte arg) {
        return doOr(arg)
    }

    public Row or(BigDecimal arg) {
        return doOr(arg)
    }

    public Row doOr(arg) {
        values.add(arg)
        return this
    }

    public Object[] asArray() {
        return values as Object[]
    }

    public List asList() {
        return values
    }
}