Skip to content
Snippets Groups Projects
Table.kt 1006 B
Newer Older
package unibz.cs.semint.kprime.domain.ddl
npedot's avatar
npedot committed

import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement

@JacksonXmlRootElement(localName = "table")
class Table () {
npedot's avatar
npedot committed
    @JacksonXmlProperty(isAttribute = true)
    var name: String =""
npedot's avatar
npedot committed
    @JacksonXmlProperty(isAttribute = true)
    var id: String=""

    @JacksonXmlProperty(isAttribute = true)
npedot's avatar
npedot committed
    var view: String =""

    @JacksonXmlProperty(isAttribute = true)
    var condition: String =""
npedot's avatar
npedot committed
    var columns= ArrayList<Column>()

    fun hasNullable(): Boolean {
        for (col in columns) {
            if (col.nullable) return true
        }
        return false
    }

    infix fun id(id: String ) = apply {
        this.id = id
    }

    infix fun name(name: String ) = apply {
        this.name = name
    }

    infix fun withColumn(name: String ) = apply {
        val col = Column()
        col.name = name
        this.columns.add(col)
    }


npedot's avatar
npedot committed
}