/*
* This file is part of rockframework.
*
* rockframework is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* rockframework is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>;.
*/
package br.net.woodstock.rockframework.core.jdbc;
import java.io.Serializable;
import br.net.woodstock.rockframework.core.RockFrameworkVersion;
import br.net.woodstock.rockframework.core.util.Assert;
import br.net.woodstock.rockframework.core.util.EqualsBuilder;
import br.net.woodstock.rockframework.core.util.HashCodeBuilder;
import br.net.woodstock.rockframework.core.util.ToStringBuilder;
public class Parameter implements Serializable {
private static final long serialVersionUID = RockFrameworkVersion.VERSION;
private Object value;
private Type type;
public Parameter(final Object value, final Type type) {
super();
Assert.notNull(type, "type");
this.value = value;
this.type = type;
}
public Type getType() {
return this.type;
}
public Object getValue() {
return this.value;
}
@Override
public boolean equals(final Object obj) {
if (!(obj instanceof Parameter)) {
return false;
}
Parameter other = (Parameter) obj;
return new EqualsBuilder().add(this.getValue(), other.getValue()).add(this.getType(), other.getType()).build().booleanValue();
}
@Override
public int hashCode() {
return new HashCodeBuilder().add(this.getValue()).add(this.getType()).build().intValue();
}
@Override
public String toString() {
return new ToStringBuilder(this.getClass()).add("value", this.getValue()).add("type", this.getType()).build();
}
}