Package org.codehaus.preon.el

Examples of org.codehaus.preon.el.BindingException


    public void testResolution2ndAttempt() {
        Object runtimeContext = new Object();
        Object result = new Object();
        expect(reference1.getReferenceContext()).andReturn(context);
        expect(reference2.getReferenceContext()).andReturn(context);
        expect(reference1.resolve(runtimeContext)).andThrow(new BindingException("Not found."));
        expect(reference2.resolve(runtimeContext)).andReturn(result);
        expect(reference1.getType()).andReturn(String.class);
        expect(reference2.getType()).andReturn(String.class);
        replay(reference1, reference2);
        MultiReference multi = new MultiReference(reference1, reference2);
View Full Code Here


        Object result = new Object();
        expect(reference1.getReferenceContext()).andReturn(context);
        expect(reference2.getReferenceContext()).andReturn(context);
        expect(reference1.getType()).andReturn(String.class);
        expect(reference2.getType()).andReturn(String.class);
        expect(reference1.resolve(runtimeContext)).andThrow(new BindingException("Not found."));
        expect(reference2.resolve(runtimeContext)).andThrow(new BindingException("Not found."));
        replay(reference1, reference2);
        MultiReference multi = new MultiReference(reference1, reference2);
        try {
            multi.resolve(runtimeContext);
        } finally {
View Full Code Here

        expect(reference2.getType()).andReturn(String.class);
        expect(selected1.getType()).andReturn(String.class);
        expect(reference1.getReferenceContext()).andReturn(context);
        expect(reference2.getReferenceContext()).andReturn(context);
        expect(reference1.selectAttribute(propertyName)).andReturn(selected1);
        expect(reference2.selectAttribute(propertyName)).andThrow(new BindingException("No property pi"));
        selected1.document(document);
        expect(selected1.getReferenceContext()).andReturn(context);
        replay(reference1, reference2, selected1, selected2);
        MultiReference multi = new MultiReference(reference1, reference2);
        Reference selected = multi.selectAttribute(propertyName);
View Full Code Here

        public Object get(String name) {
            if ("data".equals(name)) {
                return data;
            } else {
                throw new BindingException("No such variable: " + name); // TODO
            }
        }
View Full Code Here

                    "No indexed values defined for VariableContext.");
        }

        public Reference<VariableResolver> selectItem(
                Expression<Integer, VariableResolver> index) {
            throw new BindingException(
                    "No indexed values defined for VariableContext.");
        }
View Full Code Here

    public static <E> Node<Boolean, E> createBooleanNode(Node<?, E> node) {
        if (!boolean.class.isAssignableFrom(node.getType())
                && !Boolean.class.isAssignableFrom(node.getType())) {
            StringBuilder builder = new StringBuilder();
            node.document(new StringBuilderDocument(builder));
            throw new BindingException("Reference " + builder.toString()
                    + " does not resolve to boolean.");
        } else {
            return (Node<Boolean, E>) node;
        }
    }
View Full Code Here

        this.context = context;
        try {
            field = type.getDeclaredField(name);
            field.setAccessible(true);
        } catch (SecurityException e) {
            throw new BindingException("Binding to " + name + " forbidden.");
        } catch (NoSuchFieldException e) {
            throw new BindingException("No field named " + name + ".");
        }
    }
View Full Code Here

    public Object resolve(T context) {
        try {
            return field.get(reference.resolve(context));
        } catch (IllegalArgumentException e) {
            throw new BindingException("Cannot resolve " + field.getName()
                    + " on context.", e);
        } catch (IllegalAccessException e) {
            throw new BindingException("Access denied for field  "
                    + field.getName(), e);
        }
    }
View Full Code Here

        try {
            Expression<Integer, T> expr = Expressions.createInteger(context,
                    index);
            return selectItem(expr);
        } catch (InvalidExpressionException e) {
            throw new BindingException("Invalid index.", e);
        }
    }
View Full Code Here

        commonSuperType = calculateCommonSuperType(references);
        this.references = references;
        for (Reference<E> reference : references) {
            if (context != null) {
                if (!context.equals(reference.getReferenceContext())) {
                    throw new BindingException(
                            "Multiple types of runtime contexts.");
                }
            } else {
                context = reference.getReferenceContext();
            }
View Full Code Here

TOP

Related Classes of org.codehaus.preon.el.BindingException

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.