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

jp.sf.amateras.mirage.bean.PropertyDescImpl Maven / Gradle / Ivy

package jp.sf.amateras.mirage.bean;

import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;

import jp.sf.amateras.mirage.exception.BeanDescException;

public class PropertyDescImpl implements PropertyDesc {

	private PropertyWrapper propertyWrapper;

	public PropertyDescImpl(PropertyWrapper propertyWrapper){
		this.propertyWrapper = propertyWrapper;
	}

//	@Override
	public Object getValue(Object entity){
		try {
			return propertyWrapper.get(entity);
		} catch (IllegalAccessException ex) {
			throw new BeanDescException(ex);

		} catch (InvocationTargetException ex) {
			throw new BeanDescException(ex);

		}
	}

//	@Override
	public void setValue(Object entity, Object value){
		try {
			propertyWrapper.set(entity, value);
		} catch (IllegalAccessException ex) {
			throw new BeanDescException(ex);

		} catch (InvocationTargetException ex) {
			throw new BeanDescException(ex);

		}
	}

//	@Override
	public boolean isReadable(){
		return propertyWrapper.isReadable();
	}

//	@Override
	public boolean isWritable(){
		return propertyWrapper.isWritable();
	}

//	@Override
	public Class getPropertyType(){
		return propertyWrapper.getType();
	}

//	@Override
	public String getPropertyName(){
		return propertyWrapper.getName();
	}

//	@Override
	public Field getField(){
		return propertyWrapper.getField();
	}

//	@Override
	public  T getAnnotation(Class type){
		return propertyWrapper.getAnnotation(type);
	}

//	@Override
	public boolean isTransient() {
		return propertyWrapper.isTransient();
	}

	@Override
	public String toString() {
		return new StringBuilder(super.toString())
			.append("[").append(getPropertyName()).append(":").append(propertyWrapper.getType() == null ? null :
				propertyWrapper.getType().getSimpleName()).append("]")
			.toString();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy