/* Copyright 2011 Jose Maria Arranz Santamaria Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package jepl; /** * This class is used to describe the characteristics of a concrete column. * * <p>It can be user defined or automatically generated by JEPLayer asking the database schema.</p> * * @see JEPLUpdateDAOListener#getColumnDescAndValues(JEPLConnection jcon,T obj,JEPLPersistAction action) * @author jmarranz */ public class JEPLColumnDesc { protected String name; protected boolean autoIncrement; protected boolean generated; protected boolean primaryKey; protected boolean importedKey; /** * No parameter constructor. */ public JEPLColumnDesc() { } /** * Constructor providing the name of the column. * * @param name the name of the column. * @see #setName(String) */ public JEPLColumnDesc(String name) { this.name = name; this.autoIncrement = false; this.generated = false; this.primaryKey = false; this.importedKey = false; } /** * Returns the name of the column provided. * * @return the column name. */ public String getName() { return name; } /** * Sets the name of the column provided. * * @param name the name of the column. * @return this object. */ public JEPLColumnDesc setName(String name) { this.name = name; return this; } /** * Returns whether the column is auto incremented. * * @return the auto increment property. */ public boolean isAutoIncrement() { return autoIncrement; } /** * Sets whether this column is auto incremented. * * @param autoIncrement the auto increment property. * @return this object. */ public JEPLColumnDesc setAutoIncrement(boolean autoIncrement) { this.autoIncrement = autoIncrement; return this; } /** * Returns whether the column value is automatically generated. * * @return the automatically generated property. */ public boolean isGenerated() { return generated; } /** * Sets whether this column is automatically generated. * * @param generated the automatically generated property. * @return this object. */ public JEPLColumnDesc setGenerated(boolean generated) { this.generated = generated; return this; } /** * Returns whether the column is a primary key. * * @return true when a primary key. */ public boolean isPrimaryKey() { return primaryKey; } /** * Sets whether this column is a primary key. * * @param primaryKey the primary key property. * @return this object. */ public JEPLColumnDesc setPrimaryKey(boolean primaryKey) { this.primaryKey = primaryKey; return this; } /** * Returns whether the column is a foreign key. * * @return true when a foreign key. */ public boolean isImportedKey() { return importedKey; } /** * Sets whether this column is a foreign key. * * @param importedKey the foreign key property. * @return this object. */ public JEPLColumnDesc setImportedKey(boolean importedKey) { this.importedKey = importedKey; return this; } }