Example usage for javax.el PropertyNotWritableException PropertyNotWritableException

List of usage examples for javax.el PropertyNotWritableException PropertyNotWritableException

Introduction

In this page you can find the example usage for javax.el PropertyNotWritableException PropertyNotWritableException.

Prototype

public PropertyNotWritableException(Throwable cause) 

Source Link

Usage

From source file:com.foreveross.modules.jsf.SpringBeanELResolver.java

@Override
public void setValue(ELContext elContext, Object base, Object property, Object value) throws ELException {
    if (base == null) {
        String beanName = property.toString();
        BeanFactory bf = getBeanFactory(elContext);
        if (bf.containsBean(beanName)) {
            if (value == bf.getBean(beanName)) {
                // Setting the bean reference to the same value is alright - can simply be ignored...
                elContext.setPropertyResolved(true);
            } else {
                throw new PropertyNotWritableException("Variable '" + beanName
                        + "' refers to a Spring bean which by definition is not writable");
            }//from  ww w  . j a v  a 2 s .c  o  m
        }
    }
}

From source file:org.rhq.enterprise.gui.common.paging.PageControlELResolver.java

@Override
public Class<?> getType(ELContext context, Object base, Object property) {
    Class<?> result = null;

    if (context == null) {
        throw new NullPointerException("ELContext was null for getType method in PageControlELResolver");
    }/*  w  w w  .  j  a v  a2s . co m*/

    if (base == null) {
        // We don't handle setting top-level implicit objects.
    } else if (base.equals(PageControlView.class) || (base instanceof PageControlView)) {
        String propertyName = property.toString().toLowerCase();

        if ("pagesize".equals(propertyName)) {
            result = Integer.class;
        } else if ("pagenumber".equals(propertyName)) {
            result = Integer.class;
        } else if ("unlimited".equals(propertyName)) {
            result = Boolean.class;
        } else {
            throw new PropertyNotWritableException(
                    "Only the pageSize and pageNumber properties of a PageControl object can be resolved");
        }

        context.setPropertyResolved(true);
    }

    return result;
}

From source file:org.springframework.webflow.expression.el.SpringBeanWebFlowELResolver.java

@Override
public void setValue(ELContext elContext, Object base, Object property, Object value) throws ELException {
    if (base == null) {
        String beanName = property.toString();
        BeanFactory bf = getBeanFactory(elContext);
        if (bf.containsBean(beanName)) {
            if (value == bf.getBean(beanName)) {
                // Setting the bean reference to the same value is alright - can simply be ignored...
                elContext.setPropertyResolved(true);
            } else {
                throw new PropertyNotWritableException("Variable '" + beanName + "' refers to "
                        + "a Spring bean which by definition is not writable");
            }/*from   w w  w.  ja  v  a2 s  .  com*/
        }
    }
}