2012-06-17 20:34:50 +02:00
|
|
|
/*******************************************************************************
|
|
|
|
* Copyright (c) 2012 IT Just working.
|
|
|
|
* All rights reserved. This program and the accompanying materials
|
|
|
|
* are made available under the terms of the Eclipse Public License v1.0
|
|
|
|
* which accompanies this distribution, and is available at
|
|
|
|
* http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
*
|
|
|
|
* Contributors:
|
|
|
|
* IT Just working - initial API and implementation
|
|
|
|
*******************************************************************************/
|
2012-06-17 19:53:05 +02:00
|
|
|
package com.itjw.txviewer.database.text
|
|
|
|
|
2015-01-01 23:17:32 +01:00
|
|
|
import com.itjw.txviewer.database.ITrAttrType;
|
2012-06-17 19:53:05 +02:00
|
|
|
import com.itjw.txviewer.database.ITrAttribute
|
|
|
|
|
|
|
|
class TrAttribute implements ITrAttribute{
|
|
|
|
|
|
|
|
TrAttrType attributeType
|
2015-01-01 23:17:32 +01:00
|
|
|
|
2012-06-17 19:53:05 +02:00
|
|
|
def value
|
|
|
|
|
2015-01-01 23:17:32 +01:00
|
|
|
TrAttribute(String name, String dataType, ITrAttrType.AttributeType type, value){
|
|
|
|
attributeType = TrAttrTypeFactory.instance.getAttrType(name, dataType, type)
|
|
|
|
switch(dataType){
|
2012-06-17 19:53:05 +02:00
|
|
|
case "STRING":
|
|
|
|
case "ENUMERATION":
|
|
|
|
this.value=value[1..-2]
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
this.value=value
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
TrAttribute(TrAttrType other){
|
|
|
|
attributeType=other
|
|
|
|
}
|
|
|
|
|
|
|
|
TrAttribute(TrAttrType other, value){
|
2015-01-01 23:17:32 +01:00
|
|
|
this(other.name, other.dataType, other.type, value)
|
2012-06-17 19:53:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getName() {
|
|
|
|
return attributeType.getName();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-01-01 23:17:32 +01:00
|
|
|
public ITrAttrType.AttributeType getType() {
|
2012-06-17 19:53:05 +02:00
|
|
|
return attributeType.getType();
|
|
|
|
}
|
|
|
|
|
2015-01-01 23:17:32 +01:00
|
|
|
@Override
|
|
|
|
public String getDataType() {
|
|
|
|
return attributeType.getDataType();
|
|
|
|
}
|
|
|
|
|
2012-06-17 19:53:05 +02:00
|
|
|
}
|