SCViewer/plugins/com.minres.scviewer.databas.../src/com/minres/scviewer/database/text/TxAttribute.java

67 lines
1.6 KiB
Java

/*******************************************************************************
* 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
*******************************************************************************/
package com.minres.scviewer.database.text;
import java.io.Serializable;
import com.minres.scviewer.database.AssociationType;
import com.minres.scviewer.database.DataType;
import com.minres.scviewer.database.tx.ITxAttribute;
public class TxAttribute implements ITxAttribute, Serializable {
/**
*
*/
private static final long serialVersionUID = 4767726016651807152L;
private TxAttributeType attributeType;
private String value=null;
TxAttribute(TxAttributeType attributeType){
this.attributeType=attributeType;
}
TxAttribute(TxAttributeType type, String value){
attributeType=type;
switch(type.getDataType()){
case STRING:
case ENUMERATION:
this.value=value.substring(1, value.length()-1);
break;
default:
this.value=value;
}
}
@Override
public String getName() {
return attributeType.getName();
}
@Override
public AssociationType getType() {
return attributeType.getType();
}
@Override
public DataType getDataType() {
return attributeType.getDataType();
}
@Override
public Object getValue() {
return value;
}
}