All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.sylinx.hbatis.kit.Pair Maven / Gradle / Ivy

There is a newer version: 2.0.0.RELEASE
Show 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);
	}

	public  T getKey(Class clz) {
		return getObject(0);
	}

	public  T getValue(Class clz) {
		return getObject(1);
	}

	@Override
	public void setItems(Object[] items) {

		if (items == null || items.length != 2) {
			throw new HbatisException("not pair");
		}

		super.setItems(items);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy