org.jooq.conf.MappedSchema Maven / Gradle / Ivy
package org.jooq.conf;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.regex.Pattern;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
/**
* A schema mapping configuration.
*
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "MappedSchema", propOrder = {
})
@SuppressWarnings({
"all"
})
public class MappedSchema
extends SettingsBase
implements Serializable, Cloneable
{
private final static long serialVersionUID = 31002L;
protected String input;
@XmlElement(type = String.class)
@XmlJavaTypeAdapter(RegexAdapter.class)
protected Pattern inputExpression;
protected String output;
@XmlElementWrapper(name = "tables")
@XmlElement(name = "table")
protected List tables;
/**
* The input schema name as defined in {@link org.jooq.Schema#getName()}
*
* Either <input/> or <inputExpression/> must be provided
*
* @return
* possible object is
* {@link String }
*
*/
public String getInput() {
return input;
}
/**
* Sets the value of the input property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setInput(String value) {
this.input = value;
}
/**
* A regular expression matching the input schema name as defined in {@link org.jooq.Schema#getName()}
* Either <input/> or <inputExpression/> must be provided
*
* @return
* possible object is
* {@link String }
*
*/
public Pattern getInputExpression() {
return inputExpression;
}
/**
* Sets the value of the inputExpression property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setInputExpression(Pattern value) {
this.inputExpression = value;
}
/**
* The output schema as it will be rendered in SQL.
*
* - When this is omitted, you can still apply table mapping.
* - When <input/> is provided, <output/> is a constant value.
* - When <inputExpression/> is provided, <output/> is a replacement expression
*
*
* @return
* possible object is
* {@link String }
*
*/
public String getOutput() {
return output;
}
/**
* Sets the value of the output property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setOutput(String value) {
this.output = value;
}
public List getTables() {
if (tables == null) {
tables = new ArrayList();
}
return tables;
}
public void setTables(List tables) {
this.tables = tables;
}
public MappedSchema withInput(String value) {
setInput(value);
return this;
}
public MappedSchema withInputExpression(Pattern value) {
setInputExpression(value);
return this;
}
public MappedSchema withOutput(String value) {
setOutput(value);
return this;
}
public MappedSchema withTables(MappedTable... values) {
if (values!= null) {
for (MappedTable value: values) {
getTables().add(value);
}
}
return this;
}
public MappedSchema withTables(Collection values) {
if (values!= null) {
getTables().addAll(values);
}
return this;
}
public MappedSchema withTables(List tables) {
setTables(tables);
return this;
}
}