use of org.obeonetwork.dsl.typeslibrary.Type in project InformationSystem by ObeoNetwork.
the class ColumnServices method typeName.
/**
* Returns the name of the column's type.
*
* @param column
* @return the name of the column's type.
*/
public String typeName(Column column) {
final String res;
Type type = column.getType();
if (type instanceof UserDefinedTypeRef) {
res = ((UserDefinedTypeRef) type).getType().getName();
} else if (type instanceof TypeInstance) {
res = ((TypeInstance) type).getNativeType().getName();
} else {
res = "no name found";
}
return res;
}
use of org.obeonetwork.dsl.typeslibrary.Type in project InformationSystem by ObeoNetwork.
the class ColumnServices method typeLength.
/**
* Returns the length and the precision of the type associated to the column.
* Result is like follows :
* <ul>
* <li><length> if the type has the NativeKind.LENGTH attribute</li>
* <li><length,precision> if the type has the NativeKind.LENGTH_AND_PRECISION attribute</li>
*
* @param col
* the column
* @return a description of the length of the column's type.
*/
public String typeLength(Column col) {
final String res;
Type type = col.getType();
if (type instanceof TypeInstance) {
TypeInstance instance = (TypeInstance) type;
switch(instance.getNativeType().getSpec()) {
case LENGTH:
res = instance.getLength().toString();
break;
case LENGTH_AND_PRECISION:
res = instance.getLength() + "," + instance.getPrecision();
break;
default:
res = "";
}
} else {
res = "";
}
return res;
}
Aggregations