package eu.dnetlib.dlms.jdbc;

/**
 * Description of a parameter in a PreparedStatement.
 * 
 * @author lexis
 */
public class ParamInfo {

	/** Value of the parameter. */
	private Object value;
	/** The type of the value. One of the value in the enum DorotyObjectEnum. */
	private DorotyObjectEnum type;

	/** No args constructor. */
	public ParamInfo() {
	}

	/**
	 * Constructor.
	 * 
	 * @param val
	 *            Object that is the value of the parameter
	 */
	public ParamInfo(final Object val) {
		this.value = val;
	}

	/**
	 * Constructor.
	 * 
	 * @param val
	 *            Object that is the value of the parameter
	 * @param type
	 *            Types value that indicates the type of this instance's value.
	 */
	public ParamInfo(final Object val, final DorotyObjectEnum type) {
		this.value = val;
		this.type = type;
	}

	public void setValue(final Object value) {
		this.value = value;
	}

	public Object getValue() {
		return this.value;
	}

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

	public DorotyObjectEnum getType() {
		return this.type;
	}

	/**
	 * Gets the DorotyCode of this ParamInfo type.
	 * 
	 * @return an integer that is a type code as defined in DorotyObejctEnum.DorotyCode
	 */
	public int getTypeCode() {
		return this.type.getTypeCode();
	}

	/**
	 * Gets the name of the Java class represented in the system by this' type.
	 * 
	 * @return a String that is the name of the Java class represented in the Doroty system by the value of this.type.
	 */
	public String getJavaClassName() {
		return this.type.getJavaClass().getName();
	}

}
