Examples of StringBuilderDocument


Examples of org.codehaus.preon.el.util.StringBuilderDocument

     */

    public Reference<Resolver> selectItem(Expression<Integer, Resolver> index)
            throws BindingException {
        StringBuilder builder = new StringBuilder();
        index.document(new StringBuilderDocument(builder));
        throw new BindingException("Cannot resolve index on BindingContext.");
    }
View Full Code Here

Examples of org.codehaus.preon.el.util.StringBuilderDocument

                if (bindingsByName.containsKey(name)) {
                    Binding binding = bindingsByName.get(name);

                    if (context == null) {
                        StringBuilderDocument document = new StringBuilderDocument();
                        // TODO:
//                        binding.describe(new ParaContentsDocument(document));
                        throw new BindingException("Failed to resolve "
                                + document.toString()
                                + " due to incomplete context.");
                    }

                    try {
                        return binding.get(context);
View Full Code Here

Examples of org.codehaus.preon.el.util.StringBuilderDocument

    public void testSimplifySimple() {
        IntegerNode<Object> node1 = new IntegerNode<Object>(12);
        IntegerNode<Object> node2 = new IntegerNode<Object>(5);
        ArithmeticNode<Object> node3 = new ArithmeticNode<Object>(Operator.plus, node1, node2);
        node3.simplify();
        StringBuilderDocument doc = new StringBuilderDocument();
        node3.document(doc);
        assertEquals("the sum of 12 and 5", doc.toString());
        Node<Integer, Object> node4 = node3.simplify();
        doc = new StringBuilderDocument();
        node4.document(doc);
        assertEquals("17", doc.toString());
    }
View Full Code Here

Examples of org.codehaus.preon.el.util.StringBuilderDocument

        IntegerNode<Object> node2 = new IntegerNode<Object>(5);
        IntegerNode<Object> node3 = new IntegerNode<Object>(5);
        ArithmeticNode<Object> node4 = new ArithmeticNode<Object>(Operator.plus, node1, node2);
        node4 = new ArithmeticNode<Object>(Operator.plus, node4, node3);
        Node<Integer, Object> result = node4.simplify();
        StringBuilderDocument doc = new StringBuilderDocument();
        result.document(doc);
        assertEquals("22", doc.toString());
    }
View Full Code Here

Examples of org.codehaus.preon.el.util.StringBuilderDocument

        IntegerReferenceNode<Object> node3 = new IntegerReferenceNode<Object>(
                new TestReference("a"));
        ArithmeticNode<Object> node4 = new ArithmeticNode<Object>(Operator.plus, node1, node2);
        node4 = new ArithmeticNode<Object>(Operator.plus, node4, node3);
        Node<Integer, Object> result = node4.simplify();
        StringBuilderDocument doc = new StringBuilderDocument();
        result.document(doc);
        assertEquals("the sum of 17 and a", doc.toString());
    }
View Full Code Here

Examples of org.codehaus.preon.el.util.StringBuilderDocument

    }

    @Test
    public void testSelectNonExistingProperty() {
        StringBuilder builder = new StringBuilder();
        Document document = new StringBuilderDocument(builder);
        String propertyName = "pi";
        Reference selected1 = createMock(Reference.class);
        Reference selected2 = createMock(Reference.class);
        expect(reference1.getType()).andReturn(String.class);
        expect(reference2.getType()).andReturn(String.class);
View Full Code Here

Examples of org.codehaus.preon.el.util.StringBuilderDocument

    }

    @Test
    public void testNarrow() {
        StringBuilder builder = new StringBuilder();
        Document document = new StringBuilderDocument(builder);
        String propertyName = "pi";
        expect(reference1.narrow(String.class)).andReturn(reference1);
        expect(reference2.narrow(String.class)).andReturn(reference2);
        expect(reference1.getType()).andReturn(String.class).times(2);
        expect(reference2.getType()).andReturn(String.class).times(2);
View Full Code Here

Examples of org.codehaus.preon.el.util.StringBuilderDocument

    }

    @Test
    public void testNarrowPartly() {
        StringBuilder builder = new StringBuilder();
        Document document = new StringBuilderDocument(builder);
        String propertyName = "pi";
        expect(reference1.narrow(String.class)).andReturn(reference1);
        expect(reference2.narrow(String.class)).andReturn(null);
        expect(reference1.getType()).andReturn(String.class).times(2);
        expect(reference2.getType()).andReturn(String.class).times(1);
View Full Code Here

Examples of org.codehaus.preon.el.util.StringBuilderDocument

        verify(reference1, reference2, context);
    }

    @Test
    public void testDocumentation() {
        StringBuilderDocument document = new StringBuilderDocument();
        expect(reference1.getReferenceContext()).andReturn(context);
        expect(reference2.getReferenceContext()).andReturn(context);
        expect(reference3.getReferenceContext()).andReturn(context);
        expect(reference1.getType()).andReturn(String.class);
        expect(reference2.getType()).andReturn(String.class);
        expect(reference3.getType()).andReturn(String.class);
        reference1.document(document);
        reference2.document(document);
        reference3.document(document);
        replay(reference1, reference2, reference3);
        MultiReference multi = new MultiReference(reference1, reference2, reference3);
        multi.document(document);
        System.out.println(document.toString());
        verify(reference1, reference2, reference3);
    }
View Full Code Here

Examples of org.codehaus.preon.el.util.StringBuilderDocument

        levi.father = wilfred;
        assertEquals("Levi", personsName.resolve(levi));
        assertEquals("Wilfred", fathersName.resolve(levi));
        assertEquals("Wilfred", personsName.resolve(wilfred));
        StringBuilder builder = new StringBuilder();
        fathersName.document(new StringBuilderDocument(builder));
        System.out.println(builder.toString());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.