package uk.ac.reload.editor.style;

//M:

import java.lang.Exception;

public class Value {

    //El nombre de la preferencia de la que es valor
    private String sName;
    
    //La clase java a la que pertenece
    private Class cValue;
    
    //Valor actual
    private Object oValue;
    
    //Tag xml
    private String xmlTag;
    
    public Value(String sName, Object oValue, String xmlTag){
        this.sName = sName;
        this.oValue = oValue;
        this.cValue = oValue.getClass();
        this.xmlTag = xmlTag;
    }
    
    public String getName(){
        return sName;
    }
    
    public Object getValue(){
        return oValue;
    }
    
    public Class getValueClass(){
        return cValue;
    }
    
    public String getXMLTag(){
        return xmlTag;
    }
    
    public void setValue(Object oValue) throws Exception{
        Exception e = new Exception ("-Incompatible class type value");
        if(oValue.getClass() != cValue) throw e;
        this.oValue= oValue;
    }
}
