cn.sylinx.hbatis.kit.Pair Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hbatis-core Show documentation
Show all versions of hbatis-core Show documentation
hbatis is a simple orm framework
The newest version!
package cn.sylinx.hbatis.kit;
import cn.sylinx.hbatis.exception.HbatisException;
@SuppressWarnings("serial")
public class Pair extends Tuple {
public static Pair of(Object key, Object value) {
return new Pair(key, value);
}
public static Pair apply(Object key, Object value) {
return of(key, value);
}
public Pair(Object key, Object value) {
super(new Object[] { key, value });
}
public T getKey() {
return getObject(0);
}
public T getValue() {
return getObject(1);
}
@Override
public void setItems(Object[] items) {
if (items == null || items.length != 2) {
throw new HbatisException("invalid pair");
}
super.setItems(items);
}
}