package net.sf.jasperreports.engine.base;

import java.io.Serializable;
import net.sf.jasperreports.engine.JRDatasetParameter;
import net.sf.jasperreports.engine.JRExpression;
import net.sf.jasperreports.engine.JRRuntimeException;

public class JRBaseDatasetParameter implements JRDatasetParameter, Serializable {
  private static final long serialVersionUID = 10200L;
  
  protected String name = null;
  
  protected JRExpression expression = null;
  
  protected JRBaseDatasetParameter() {}
  
  protected JRBaseDatasetParameter(JRDatasetParameter datasetParameter, JRBaseObjectFactory factory) {
    factory.put(datasetParameter, this);
    this.name = datasetParameter.getName();
    this.expression = factory.getExpression(datasetParameter.getExpression());
  }
  
  public String getName() {
    return this.name;
  }
  
  public JRExpression getExpression() {
    return this.expression;
  }
  
  public Object clone() {
    try {
      return super.clone();
    } catch (CloneNotSupportedException e) {
      throw new JRRuntimeException(e);
    } 
  }
}
