Package net.sourceforge.stripes.util.bean

Examples of net.sourceforge.stripes.util.bean.PropertyExpressionEvaluation


       
        Locale locale = getPageContext().getRequest().getLocale();

        for (String field : fields) {

            PropertyExpressionEvaluation eval = null;
           
            try {
                eval = new PropertyExpressionEvaluation(PropertyExpression.getExpression(field), bean);
            }
            catch (Exception e) {
                continue;
            }

            Class<?> fieldType = eval.getType();

            ValidationMetadata data = metadata.get(field);

            StringBuilder fieldInfo = new StringBuilder();
View Full Code Here


                        && !fieldErrors.containsKey(pname)) {
                    log.trace("Running binding for property with name: ", name);

                    // Determine the target type
                    ValidationMetadata validationInfo = validationInfos.get(name.getStrippedName());
                    PropertyExpressionEvaluation eval;
                    try {
                        eval = new PropertyExpressionEvaluation(PropertyExpression
                                .getExpression(pname), bean);
                    }
                    catch (Exception e) {
                        if (pname.equals(context.getEventName()))
                            continue;
                        else
                            throw e;
                    }
                    Class<?> type = eval.getType();
                    Class<?> scalarType = eval.getScalarType();

                    // Check to see if binding into this expression is permitted
                    if (!isBindingAllowed(eval))
                        continue;
View Full Code Here

                        && !fieldErrors.containsKey(pname)) {
                    log.trace("Running binding for property with name: ", name);

                    // Determine the target type
                    ValidationMetadata validationInfo = validationInfos.get(name.getStrippedName());
                    PropertyExpressionEvaluation eval;
                    try {
                        eval = new PropertyExpressionEvaluation(PropertyExpression
                                .getExpression(pname), bean);
                    }
                    catch (Exception e) {
                        if (pname.equals(context.getEventName()))
                            continue;
                        else
                            throw e;
                    }
                    Class<?> type = eval.getType();
                    Class<?> scalarType = eval.getScalarType();

                    // Check to see if binding into this expression is permitted
                    if (!isBindingAllowed(eval))
                        continue;
View Full Code Here

        bean = trip.getActionBean(beanType);
        for (int i = 0; i < properties.length; i++) {
            String fullName = beanType.getSimpleName() + "." + properties[i];
            log.debug("Testing binding security on ", fullName);
            PropertyExpression pe = PropertyExpression.getExpression(properties[i]);
            PropertyExpressionEvaluation eval = new PropertyExpressionEvaluation(pe, bean);
            Object value = eval.getValue();
            Assert.assertEquals(value != null, expect[i], "Property " + fullName + " should"
                    + (expect[i] ? " not" : "") + " be null but it is" + (expect[i] ? "" : " not"));
        }
    }
View Full Code Here

       
        Locale locale = getPageContext().getRequest().getLocale();

        for (String field : fields) {

            PropertyExpressionEvaluation eval = null;
           
            try {
                eval = new PropertyExpressionEvaluation(PropertyExpression.getExpression(field), bean);
            }
            catch (Exception e) {
                continue;
            }

            Class<?> fieldType = eval.getType();

            ValidationMetadata data = metadata.get(field);

            StringBuilder fieldInfo = new StringBuilder();
View Full Code Here

       
        Locale locale = getPageContext().getRequest().getLocale();

        for (String field : fields) {

            PropertyExpressionEvaluation eval = null;
           
            try {
                eval = new PropertyExpressionEvaluation(PropertyExpression.getExpression(field), bean);
            }
            catch (Exception e) {
                continue;
            }

            Class<?> fieldType = eval.getType();

            ValidationMetadata data = metadata.get(field);

            StringBuilder fieldInfo = new StringBuilder();
View Full Code Here

                        && !fieldErrors.containsKey(pname)) {
                    log.trace("Running binding for property with name: ", name);

                    // Determine the target type
                    ValidationMetadata validationInfo = validationInfos.get(name.getStrippedName());
                    PropertyExpressionEvaluation eval;
                    try {
                        eval = new PropertyExpressionEvaluation(PropertyExpression
                                .getExpression(pname), bean);
                    }
                    catch (Exception e) {
                        if (pname.equals(context.getEventName()))
                            continue;
                        else
                            throw e;
                    }
                    Class<?> type = eval.getType();
                    Class<?> scalarType = eval.getScalarType();

                    // Check to see if binding into this expression is permitted
                    if (!isBindingAllowed(eval))
                        continue;
View Full Code Here

        bean = trip.getActionBean(beanType);
        for (int i = 0; i < properties.length; i++) {
            String fullName = beanType.getSimpleName() + "." + properties[i];
            log.debug("Testing binding security on ", fullName);
            PropertyExpression pe = PropertyExpression.getExpression(properties[i]);
            PropertyExpressionEvaluation eval = new PropertyExpressionEvaluation(pe, bean);
            Object value = eval.getValue();
            Assert.assertEquals(value != null, expect[i], "Property " + fullName + " should"
                    + (expect[i] ? " not" : "") + " be null but it is" + (expect[i] ? "" : " not"));
        }
    }
View Full Code Here

        final TestBean bean = new TestBean();
        final BindingPolicyManager bpm = new BindingPolicyManager(TestBean.class);
        for (String expression : expressions) {
            log.debug("Testing illegal expression: " + expression);
            PropertyExpression pe = PropertyExpression.getExpression(expression);
            PropertyExpressionEvaluation eval = new PropertyExpressionEvaluation(pe, bean);
            Assert.assertFalse(bpm.isBindingAllowed(eval), "Binding should not be allowed for expression " + expression);
        }
    }
View Full Code Here

TOP

Related Classes of net.sourceforge.stripes.util.bean.PropertyExpressionEvaluation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.