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

jadex.bridge.modelinfo.ModelValueProvider Maven / Gradle / Ivy

Go to download

Jadex bridge is a base package for kernels and platforms, i.e., it is used by both and provides commonly used interfaces and classes for active components and their management.

There is a newer version: 4.0.267
Show newest version
package jadex.bridge.modelinfo;


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

/**
 *  Default model value provider.
 */
public class ModelValueProvider implements IModelValueProvider
{
	//-------- constants --------
	
	/** Constant for no configuration selected. */
	public static final String ANY_CONFIG = "any_config";
	
	//-------- attributes --------
	
	/** The values. */
	protected Map values;
	
	//-------- constructors --------
	
	/**
	 *  Create a new provider.
	 */
	public ModelValueProvider()
	{
	}
	
	/**
	 *  Create a new provider.
	 */
	public ModelValueProvider(Map values)
	{
		this.values = values;
	}
	
	//-------- methods --------
	
	/**
	 *  Get the value.
	 *  @return The value.
	 */
	public Object getValue(String configname)
	{
		Object ret = null;
		if(values!=null)
		{
			ret = values.get(configname!=null && values.containsKey(configname)? configname: ANY_CONFIG);
		}
		return ret;
	}
	
	/**
	 *  Set the value.
	 *  @param value The value to set.
	 */
	public void setValue(Object value)
	{
		if(values==null)
			values = new HashMap();
		values.put(ANY_CONFIG, value);
	}
	
	/**
	 *  Set the value.
	 *  @param value The value to set.
	 */
	public void setValue(String configname, Object value)
	{
		if(values==null)
			values = new HashMap();
		values.put(configname, value);
	}

	/**
	 *  Get the values.
	 *  @return the values.
	 */
	public Map getValues()
	{
		return values;
	}

	/**
	 *  Set the values.
	 *  @param values The values to set.
	 */
	public void setValues(Map values)
	{
		this.values = values;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy