panda.bean.handler.AbstractJavaBeanHandler Maven / Gradle / Ivy
package panda.bean.handler;
import java.lang.reflect.Type;
import panda.bean.Beans;
import panda.lang.reflect.Types;
/**
*
* @param class type
*/
public abstract class AbstractJavaBeanHandler extends AbstractBeanHandler {
/**
* Constructor
* @param beans bean handler factory
* @param type bean type
*/
public AbstractJavaBeanHandler(Beans beans, Type type) {
super(beans, type);
}
/**
* create bean object
* @return bean instance
*/
public T createObject() {
return Types.born(Types.getDefaultImplType(type));
}
// /**
// * @param propertyName property name
// * @return NoSuchPropertyException
// */
// protected RuntimeException noSuchPropertyException(String propertyName) {
// return new NoSuchPropertyException("Unknown property: " + propertyName + " [" + type + "].");
// }
//
// /**
// * @param propertyName property name
// * @return No getter method Exception
// */
// protected RuntimeException noGetterMethodException(String propertyName) {
// return new IncorrectAccessException("No getter method for property: "
// + propertyName + " [" + type + "].");
// }
//
// /**
// * @param propertyName property name
// * @return No setter method Exception
// */
// protected RuntimeException noSetterMethodException(String propertyName) {
// return new IncorrectAccessException("No setter method for property: "
// + propertyName + " [" + type + "].");
// }
/**
* @return a string representation of the object.
*/
public String toString() {
return getClass().getName() + ": " + type;
}
}