com.github.jinahya.sql.database.metadata.bind.ProcedureColumn Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of database-metadata-bind Show documentation
Show all versions of database-metadata-bind Show documentation
Class for binding results of java.sql.DatabaseMetaData
/*
* Copyright 2013 Jin Kwon .
*
* 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 com.github.jinahya.sql.database.metadata.bind;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.apache.commons.lang3.builder.CompareToBuilder;
/**
* An entity class for binding the result of
* {@link java.sql.DatabaseMetaData#getProcedureColumns(java.lang.String, java.lang.String, java.lang.String, java.lang.String)}.
*
* @author Jin Kwon <jinahya_at_gmail.com>
*/
@XmlRootElement
@XmlType(
propOrder = {
"columnName", "columnType", "dataType", "typeName",
"precision", "length", "scale", "radix", "nullable", "remarks",
"columnDef", "sqlDataType", "sqlDatetimeSub", "charOctetLength",
"ordinalPosition", "isNullable", "specificName"
}
)
public class ProcedureColumn extends AbstractChild
implements Comparable {
// by PROCEDURE_CAT, PROCEDURE_SCHEM, PROCEDURE_NAME and SPECIFIC_NAME.
@Override
public int compareTo(ProcedureColumn o) {
return new CompareToBuilder()
.append(procedureCat, o.getProcedureCat())
.append(procedureSchem, o.getProcedureSchem())
.append(procedureName, o.getProcedureName())
.append(specificName, o.getSpecificName())
.build();
}
@Override
public String toString() {
return super.toString() + "{"
+ "procedureCat=" + procedureCat
+ ", procedureSchem=" + procedureSchem
+ ", procedureName=" + procedureName
+ ", columnName=" + columnName
+ ", columnType=" + columnType
+ ", dataType=" + dataType
+ ", typeName=" + typeName
+ ", precision=" + precision
+ ", length=" + length
+ ", scale=" + scale
+ ", radix=" + radix
+ ", nullable=" + nullable
+ ", remarks=" + remarks
+ ", columnDef=" + columnDef
+ ", sqlDataType=" + sqlDataType
+ ", sqlDatetimeSub=" + sqlDatetimeSub
+ ", charOctetLength=" + charOctetLength
+ ", ordinalPosition=" + ordinalPosition
+ ", isNullable=" + isNullable
+ ", specificName=" + specificName
+ "}";
}
// ------------------------------------------------------------ procedureCat
public String getProcedureCat() {
return procedureCat;
}
public void setProcedureCat(final String procedureCat) {
this.procedureCat = procedureCat;
}
// ---------------------------------------------------------- procedureSchem
public String getProcedureSchem() {
return procedureSchem;
}
public void setProcedureSchem(final String procedureSchem) {
this.procedureSchem = procedureSchem;
}
// ----------------------------------------------------------- procedureName
public String getProcedureName() {
return procedureName;
}
public void setProcedureName(final String procedureName) {
this.procedureName = procedureName;
}
// -------------------------------------------------------------- columnName
public String getColumnName() {
return columnName;
}
public void setColumnName(final String columnName) {
this.columnName = columnName;
}
// -------------------------------------------------------------- columnType
public short getColumnType() {
return columnType;
}
public void setColumnType(final short columnType) {
this.columnType = columnType;
}
// ---------------------------------------------------------------- dataType
public int getDataType() {
return dataType;
}
public void setDataType(final int dataType) {
this.dataType = dataType;
}
// ---------------------------------------------------------------- typeName
public String getTypeName() {
return typeName;
}
public void setTypeName(final String typeName) {
this.typeName = typeName;
}
// --------------------------------------------------------------- precision
public int getPrecision() {
return precision;
}
public void setPrecision(final int precision) {
this.precision = precision;
}
// ------------------------------------------------------------------ length
public int getLength() {
return length;
}
public void setLength(final int length) {
this.length = length;
}
// ------------------------------------------------------------------- scale
public Short getScale() {
return scale;
}
public void setScale(final Short scale) {
this.scale = scale;
}
// ------------------------------------------------------------------- radix
public short getRadix() {
return radix;
}
public void setRadix(final short radix) {
this.radix = radix;
}
// ---------------------------------------------------------------- nullable
public short getNullable() {
return nullable;
}
public void setNullable(final short nullable) {
this.nullable = nullable;
}
// ----------------------------------------------------------------- remarks
public String getRemarks() {
return remarks;
}
public void setRemarks(final String remarks) {
this.remarks = remarks;
}
// --------------------------------------------------------------- columnDef
public String getColumnDef() {
return columnDef;
}
public void setColumnDef(final String columnDef) {
this.columnDef = columnDef;
}
// ------------------------------------------------------------- sqlDataType
public Integer getSqlDataType() {
return sqlDataType;
}
public void setSqlDataType(final Integer sqlDataType) {
this.sqlDataType = sqlDataType;
}
// ---------------------------------------------------------- sqlDatetimeSub
public Integer getSqlDatetimeSub() {
return sqlDatetimeSub;
}
public void setSqlDatetimeSub(final Integer sqlDatetimeSub) {
this.sqlDatetimeSub = sqlDatetimeSub;
}
// --------------------------------------------------------- charOctetLength
public Integer getCharOctetLength() {
return charOctetLength;
}
public void setCharOctetLength(final Integer charOctetLength) {
this.charOctetLength = charOctetLength;
}
// --------------------------------------------------------- ordinalPosition
public int getOrdinalPosition() {
return ordinalPosition;
}
public void setOrdinalPosition(final int ordinalPosition) {
this.ordinalPosition = ordinalPosition;
}
// -------------------------------------------------------------- isNullable
public String isNullable() {
return isNullable;
}
public void setIsNullable(final String isNullable) {
this.isNullable = isNullable;
}
// ------------------------------------------------------------ specificName
public String getSpecificName() {
return specificName;
}
public void setSpecificName(final String specificName) {
this.specificName = specificName;
}
// --------------------------------------------------------------- procedure
// just for class diagrams
private Procedure getProcedure() {
return getParent();
}
// public void setProcedure(final Procedure procedure) {
//
// setParent(procedure);
// }
// -------------------------------------------------------------------------
@Label("PROCEDURE_CAT")
@NillableBySpecification
@XmlAttribute
private String procedureCat;
@Label("PROCEDURE_SCHEM")
@NillableBySpecification
@XmlAttribute
private String procedureSchem;
@Label("PROCEDURE_NAME")
@XmlAttribute
private String procedureName;
@Label("COLUMN_NAME")
@XmlElement(required = true)
private String columnName;
@Label("COLUMN_TYPE")
@XmlElement(required = true)
private short columnType;
@Label("DATA_TYPE")
@XmlElement(required = true)
private int dataType;
@Label("TYPE_NAME")
@XmlElement(required = true)
private String typeName;
@Label("PRECISION")
@XmlElement(required = true)
private int precision;
@Label("LENGTH")
@XmlElement(required = true)
private int length;
@Label("SCALE")
@NillableBySpecification
@XmlElement(required = true)
private Short scale;
@Label("RADIX")
@XmlElement(required = true)
private short radix;
@Label("NULLABLE")
@XmlElement(required = true)
private short nullable;
@Label("REMARKS")
@XmlElement(required = true)
private String remarks;
@Label("COLUMN_DEF")
@NillableBySpecification
@XmlElement(nillable = true, required = true)
private String columnDef;
@Label("SQL_DATA_TYPE")
@Reserved
@XmlElement(nillable = true, required = true)
private Integer sqlDataType;
@Label("SQL_DATETIME_SUB")
@Reserved
@XmlElement(nillable = true, required = true)
private Integer sqlDatetimeSub;
@Label("CHAR_OCTET_LENGTH")
@NillableBySpecification
@XmlElement(nillable = true, required = true)
private Integer charOctetLength;
@Label("ORDINAL_POSITION")
@XmlElement(required = true)
private int ordinalPosition;
@Label("IS_NULLABLE")
@XmlElement(required = true)
private String isNullable;
@Label("SPECIFIC_NAME")
@XmlElement(required = true)
private String specificName;
}