Methods Summary |
---|
protected java.lang.Object | clone()Shallow copy, the value is not copied
Column copy = new Column();
copy.setLength( length );
copy.setScale( scale );
copy.setValue( value );
copy.setTypeIndex( typeIndex );
copy.setName( getQuotedName() );
copy.setNullable( nullable );
copy.setPrecision( precision );
copy.setUnique( unique );
copy.setSqlType( sqlType );
copy.setSqlTypeCode( sqlTypeCode );
copy.uniqueInteger = uniqueInteger; //usually useless
copy.setCheckConstraint( checkConstraint );
copy.setComment( comment );
copy.setDefaultValue( defaultValue );
return copy;
|
public boolean | equals(java.lang.Object object)
return object instanceof Column && equals( (Column) object );
|
public boolean | equals(org.hibernate.mapping.Column column)
if (null == column) return false;
if (this == column) return true;
return isQuoted() ?
name.equals(column.name) :
name.equalsIgnoreCase(column.name);
|
public java.lang.String | getAlias(org.hibernate.dialect.Dialect dialect)For any column name, generate an alias that is unique
to that column name, and also 10 characters or less
in length.
String alias = name;
String unique = Integer.toString(uniqueInteger) + '_";
int lastLetter = StringHelper.lastIndexOfLetter(name);
if ( lastLetter == -1 ) {
alias = "column";
}
else if ( lastLetter < name.length()-1 ) {
alias = name.substring(0, lastLetter+1);
}
if ( alias.length() > dialect.getMaxAliasLength() ) {
alias = alias.substring( 0, dialect.getMaxAliasLength() - unique.length() );
}
boolean useRawName = name.equals(alias) &&
!quoted &&
!name.toLowerCase().equals("rowid");
if ( useRawName ) {
return alias;
}
else {
return alias + unique;
}
|
public java.lang.String | getAlias(org.hibernate.dialect.Dialect dialect, Table table)Generate a column alias that is unique across multiple tables
return getAlias(dialect) + table.getUniqueInteger() + '_";
|
public java.lang.String | getCanonicalName()
return quoted ? name : name.toLowerCase();
|
public java.lang.String | getCheckConstraint()
return checkConstraint;
|
public java.lang.String | getComment()
return comment;
|
public java.lang.String | getDefaultValue()
return defaultValue;
|
public int | getLength()
return length;
|
public java.lang.String | getName()
return name;
|
public int | getPrecision()
return precision;
|
public java.lang.String | getQuotedName(org.hibernate.dialect.Dialect d)
return quoted ?
d.openQuote() + name + d.closeQuote() :
name;
|
public java.lang.String | getQuotedName()returns quoted name as it would be in the mapping file.
return quoted ?
"`" + name + "`" :
name;
|
public int | getScale()
return scale;
|
public java.lang.String | getSqlType(org.hibernate.dialect.Dialect dialect, org.hibernate.engine.Mapping mapping)
return sqlType==null ?
dialect.getTypeName( getSqlTypeCode(mapping), getLength(), getPrecision(), getScale() ) :
sqlType;
|
public java.lang.String | getSqlType()
return sqlType;
|
public int | getSqlTypeCode(org.hibernate.engine.Mapping mapping)
org.hibernate.type.Type type = getValue().getType();
try {
int sqlTypeCode = type.sqlTypes(mapping)[ getTypeIndex() ];
if(getSqlTypeCode()!=null && getSqlTypeCode().intValue()!=sqlTypeCode) {
throw new MappingException("SQLType code's does not match. mapped as " + sqlTypeCode + " but is " + getSqlTypeCode() );
}
return sqlTypeCode;
}
catch (Exception e) {
throw new MappingException(
"Could not determine type for column " +
name +
" of type " +
type.getClass().getName() +
": " +
e.getClass().getName(),
e
);
}
|
public java.lang.Integer | getSqlTypeCode()Returns the underlying columns sqltypecode.
If null, it is because the sqltype code is unknown.
Use #getSqlTypeCode(Mapping) to retreive the sqltypecode used
for the columns associated Value/Type.
return sqlTypeCode;
|
public java.lang.String | getTemplate(org.hibernate.dialect.Dialect dialect, org.hibernate.dialect.function.SQLFunctionRegistry functionRegistry)
return getQuotedName(dialect);
|
public java.lang.String | getText(org.hibernate.dialect.Dialect d)
return getQuotedName(d);
|
public java.lang.String | getText()
return getName();
|
public int | getTypeIndex()
return typeIndex;
|
public Value | getValue()
return value;
|
public boolean | hasCheckConstraint()
return checkConstraint!=null;
|
public int | hashCode()
return isQuoted() ?
name.hashCode() :
name.toLowerCase().hashCode();
|
public boolean | isFormula()
return false;
|
public boolean | isNullable()
return nullable;
|
public boolean | isQuoted()
return quoted;
|
public boolean | isUnique()
return unique;
|
public void | setCheckConstraint(java.lang.String checkConstraint)
this.checkConstraint = checkConstraint;
|
public void | setComment(java.lang.String comment)
this.comment = comment;
|
public void | setDefaultValue(java.lang.String defaultValue)
this.defaultValue = defaultValue;
|
public void | setLength(int length)
this.length = length;
|
public void | setName(java.lang.String name)
if (
name.charAt(0)=='`" ||
Dialect.QUOTE.indexOf( name.charAt(0) ) > -1 //TODO: deprecated, remove eventually
) {
quoted=true;
this.name=name.substring( 1, name.length()-1 );
}
else {
this.name = name;
}
|
public void | setNullable(boolean nullable)
this.nullable=nullable;
|
public void | setPrecision(int scale)
this.precision = scale;
|
public void | setScale(int scale)
this.scale = scale;
|
public void | setSqlType(java.lang.String sqlType)
this.sqlType = sqlType;
|
public void | setSqlTypeCode(java.lang.Integer typecode)
sqlTypeCode=typecode;
|
public void | setTypeIndex(int typeIndex)
this.typeIndex = typeIndex;
|
public void | setUnique(boolean unique)
this.unique = unique;
|
public void | setValue(Value value)
this.value= value;
|
public java.lang.String | toString()
return getClass().getName() + '(" + getName() + ')";
|