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

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

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);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy