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

panda.bean.BeanAccessor Maven / Gradle / Ivy

Go to download

Panda Core is the core module of Panda Framework, it contains commonly used utility classes similar to apache-commons.

There is a newer version: 1.8.0
Show newest version
package panda.bean;

@SuppressWarnings("rawtypes")
public class BeanAccessor {
	private Object bean;
	private BeanHandler handler;

	/**
	 * Constructor
	 * 
	 * @param handler bean handler
	 * @param bean bean object
	 */
	public BeanAccessor(BeanHandler handler, Object bean) {
		this.bean = bean;
		this.handler = handler;
	}

	/**
	 * get property value
	 * 
	 * @param name property name
	 * @return value
	 */
	@SuppressWarnings("unchecked")
	public Object get(String name) {
		return handler == null ? null : handler.getBeanValue(bean, name);
	}

	/**
	 * set property value
	 * 
	 * @param name property name
	 * @param value value
	 */
	@SuppressWarnings("unchecked")
	public void set(String name, Object value) {
		if (handler != null) {
			handler.setBeanValue(bean, name, value);
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy