Java 类org.hibernate.PropertyAccessException 实例源码

项目:lams    文件:DirectPropertyAccessor.java   
@Override
public void set(Object target, Object value, SessionFactoryImplementor factory) throws HibernateException {
    try {
        field.set(target, value);
    }
    catch (Exception e) {
        if(value == null && field.getType().isPrimitive()) {
            throw new PropertyAccessException(
                    e, 
                    "Null value was assigned to a property of primitive type", 
                    true, 
                    clazz, 
                    name
                );                  
        } else {
            throw new PropertyAccessException(e, "could not set a field value by reflection", true, clazz, name);
        }
    }
}
项目:cacheonix-core    文件:DirectPropertyAccessor.java   
public void set(Object target, Object value, SessionFactoryImplementor factory) throws HibernateException {
    try {
        field.set(target, value);
    }
    catch (Exception e) {
        if(value == null && field.getType().isPrimitive()) {
            throw new PropertyAccessException(
                    e, 
                    "Null value was assigned to a property of primitive type", 
                    true, 
                    clazz, 
                    name
                );                  
        } else {
            throw new PropertyAccessException(e, "could not set a field value by reflection", true, clazz, name);
        }
    }
}
项目:lams    文件:DirectPropertyAccessor.java   
@Override
public Object get(Object target) throws HibernateException {
    try {
        return field.get(target);
    }
    catch (Exception e) {
        throw new PropertyAccessException(e, "could not get a field value by reflection", false, clazz, name);
    }
}
项目:lams    文件:AccessOptimizerAdapter.java   
@Override
public Object[] getPropertyValues(Object object) {
    try {
        return bulkAccessor.getPropertyValues( object );
    }
    catch ( Throwable t ) {
        throw new PropertyAccessException(
                t,
                PROPERTY_GET_EXCEPTION,
                false,
                mappedClass,
                getterName( t, bulkAccessor )
        );
    }
}
项目:lams    文件:AccessOptimizerAdapter.java   
@Override
public void setPropertyValues(Object object, Object[] values) {
    try {
        bulkAccessor.setPropertyValues( object, values );
    }
    catch ( Throwable t ) {
        throw new PropertyAccessException(
                t,
                PROPERTY_SET_EXCEPTION,
                true,
                mappedClass,
                setterName( t, bulkAccessor )
        );
    }
}
项目:cacheonix-core    文件:DirectPropertyAccessor.java   
public Object get(Object target) throws HibernateException {
    try {
        return field.get(target);
    }
    catch (Exception e) {
        throw new PropertyAccessException(e, "could not get a field value by reflection", false, clazz, name);
    }
}
项目:cacheonix-core    文件:AccessOptimizerAdapter.java   
public Object[] getPropertyValues(Object object) {
    try {
        return bulkAccessor.getPropertyValues( object );
    }
    catch ( Throwable t ) {
        throw new PropertyAccessException(
                t,
                PROPERTY_GET_EXCEPTION,
                false,
                mappedClass,
                getterName( t, bulkAccessor )
            );
    }
}
项目:cacheonix-core    文件:AccessOptimizerAdapter.java   
public void setPropertyValues(Object object, Object[] values) {
    try {
        bulkAccessor.setPropertyValues( object, values );
    }
    catch ( Throwable t ) {
        throw new PropertyAccessException(
                t,
                PROPERTY_SET_EXCEPTION,
                true,
                mappedClass,
                setterName( t, bulkAccessor )
        );
    }
}
项目:cacheonix-core    文件:AccessOptimizerAdapter.java   
public Object[] getPropertyValues(Object object) {
    try {
        return bulkBean.getPropertyValues( object );
    }
    catch ( Throwable t ) {
        throw new PropertyAccessException(
                t,
                PROPERTY_GET_EXCEPTION,
                false,
                mappedClass,
                getterName( t, bulkBean )
        );
    }
}
项目:cacheonix-core    文件:AccessOptimizerAdapter.java   
public void setPropertyValues(Object object, Object[] values) {
    try {
        bulkBean.setPropertyValues( object, values );
    }
    catch ( Throwable t ) {
        throw new PropertyAccessException(
                t,
                PROPERTY_SET_EXCEPTION,
                true,
                mappedClass,
                setterName( t, bulkBean )
        );
    }
}
项目:query-utils    文件:OptionAwareDirectPropertyAccessor.java   
@Override
public Setter getSetter(final Class theClass, final String propertyName) throws PropertyNotFoundException {
    final Field field = find(OptionAwareDirectPropertyAccessor_.fieldName.andThen(equalTo(propertyName)), fields(theClass)).get();
    final boolean isOption = Option.class.isAssignableFrom(field.getType());
    return new Setter() {
        @Override
        public void set(Object target, Object value, SessionFactoryImplementor factory) throws HibernateException {
            try {
                field.setAccessible(true);
                field.set(target, isOption ? Option.of(value) : value);
            }
            catch (Exception e) {
                throw new PropertyAccessException(e, "could not set a field value by reflection", true, theClass, propertyName);
            }
        }

        @Override
        public String getMethodName() {
            return null;
        }

        @Override
        public Method getMethod() {
            return null;
        }
    };
}