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

com.bld.commons.reflection.model.ConditionsZoneModel Maven / Gradle / Ivy

There is a newer version: 3.0.6
Show newest version
/*
 * @author Francesco Baldi
 * @mail [email protected]
 * @class bld.commons.reflection.model.ConditionsZoneModel.java 
 */
package com.bld.commons.reflection.model;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import org.apache.commons.lang3.StringUtils;

import com.bld.commons.reflection.annotations.ConditionsZone;

/**
 * The Class ConditionsZoneModel.
 */
public class ConditionsZoneModel {

	/** The key. */
	private String key;

	/** The where. */
	private String where;

	/** The parameters. */
	private Map parameters;
	
	/** The nullables. */
	private Set nullables;
	
	

	/**
	 * Inits the.
	 */
	private void init() {
		this.where = "";
		this.parameters = new HashMap<>();
		this.nullables=new HashSet<>();
	}

	/**
	 * Instantiates a new conditions zone model.
	 *
	 * @param key the key
	 */
	public ConditionsZoneModel(String key) {
		super();
		this.key = key;
		this.init();
	}
	
	/**
	 * Instantiates a new conditions zone model.
	 *
	 * @param conditionsZone the conditions zone
	 */
	public ConditionsZoneModel(ConditionsZone conditionsZone) {
		super();
		this.key = conditionsZone.key();
		this.init();
	}

	/**
	 * Gets the key.
	 *
	 * @return the key
	 */
	public String getKey() {
		return key;
	}

	/**
	 * Gets the where.
	 *
	 * @return the where
	 */
	public String getWhere() {
		return where;
	}

	/**
	 * Sets the where.
	 *
	 * @param conditionsZone the new where
	 */
	public void setWhere(ConditionsZone conditionsZone) {
		if (conditionsZone != null)
			this.where = StringUtils.isNotBlank(this.where) || conditionsZone.initWhere() ? " where 1=1\n" : "";
	}

	/**
	 * Gets the parameters.
	 *
	 * @return the parameters
	 */
	public Map getParameters() {
		return parameters;
	}

	/**
	 * Adds the parameter.
	 *
	 * @param key the key
	 * @param value the value
	 */
	public void addParameter(String key, Object value) {
		if (StringUtils.isNotBlank(key))
			this.parameters.put(key, value);
	}

	/**
	 * Gets the nullables.
	 *
	 * @return the nullables
	 */
	public Set getNullables() {
		return nullables;
	}
	
	/**
	 * Adds the nullables.
	 *
	 * @param nullable the nullable
	 */
	public void addNullables(String nullable) {
		if (StringUtils.isNotBlank(nullable))
			this.nullables.add(nullable);
	}

	

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy