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

67 lines
1.6 KiB
Java
Raw Normal View History

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