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

cn.sylinx.hbatis.ext.parse.ParaMapBuilder Maven / Gradle / Ivy

There is a newer version: 2.0.0.RELEASE
Show newest version
package cn.sylinx.hbatis.ext.parse;

import java.util.HashMap;
import java.util.Map;

import cn.sylinx.hbatis.kit.StrKit;

/**
 * 参数构建器
 * 
 * @author han
 *
 */
public class ParaMapBuilder {

	private Map map = new HashMap<>();

	public ParaMapBuilder put(String key, Object value) {
		if(value != null) {
			map.put(key, value);
		}
		return this;
	}

	public ParaMapBuilder like(String key, String value) {
		if (StrKit.isNotBlank(value)) {
			map.put(key, "%" + value + "%");
		}
		return this;
	}

	public ParaMapBuilder likeLeft(String key, String value) {
		if (StrKit.isNotBlank(value)) {
			map.put(key, "%" + value);
		}
		return this;
	}

	public ParaMapBuilder likeRight(String key, String value) {
		if (StrKit.isNotBlank(value)) {
			map.put(key, value + "%");
		}
		return this;
	}

	public Map build() {
		return map;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy