/*
 * ExpObject.java
 *
 * Created on September 26, 2006, 11:40 AM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package it.businesslogic.ireport.gui.expbuilder;

/**
 *
 * @author gtoffoli
 */
public class ExpObject {
    
    public static final int TYPE_FIELD = 0;
    public static final int TYPE_VARIABLE = 1;
    public static final int TYPE_PARAM = 2;
    
    private String name = "";
    private int type = TYPE_FIELD;
    private String  classType = "java.lang.String";
    
    /** Creates a new instance of ExpObject */
    public ExpObject(String name, int type, String classType) {
        
        this.setName(name);
        this.setType(type);
        this.setClassType(classType);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getClassType() {
        return classType;
    }

    public void setClassType(String classType) {
        this.classType = classType;
    }
    
    public String getExpression()
    {
        if (getType() == TYPE_FIELD) return "$F{" + getName() + "}";
        if (getType() == TYPE_VARIABLE) return "$V{" + getName() + "}";
        if (getType() == TYPE_PARAM) return "$P{" + getName() + "}";
        return getName();
    }
    
    
    
}
