Package org.skyscreamer.yoga.selector

Examples of org.skyscreamer.yoga.selector.CompositeSelector


        ObjectMapHierarchicalModelImpl model = new ObjectMapHierarchicalModelImpl();

        FieldSelector selector = new FieldSelector();
        selector.register( "randomStrings", new FieldSelector() );

        resultTraverser.traverse( input, new CompositeSelector( resolver.getBaseSelector(), selector ), model, requestContext );

        Map<String, Object> objectTree = model.getUnderlyingModel();
        Assert.assertEquals( list, objectTree.get( "randomStrings" ) );
    }
View Full Code Here


        FieldSelector selector = new FieldSelector();
        selector.register( "anotherKey", new FieldSelector() );
        selector.register( "aThirdKey", new FieldSelector() );

        resultTraverser.traverse( map, new CompositeSelector( resolver.getBaseSelector(), selector ), model, requestContext );
        Map<String, Object> objectTree = model.getUnderlyingModel();
       
        // "someKey" should not be selected from map
        Assert.assertEquals( null, objectTree.get( "someKey" ) );
       
View Full Code Here

        ObjectMapHierarchicalModelImpl model = new ObjectMapHierarchicalModelImpl();

        FieldSelector selector = new FieldSelector();
        selector.register( "randomStrings", new FieldSelector() );

        resultTraverser.traverse( input, new CompositeSelector( resolver.getBaseSelector(), selector ), model, requestContext );

        Map<String, Object> objectTree = model.getUnderlyingModel();
        Assert.assertEquals( list, objectTree.get( "randomStrings" ) );
    }
View Full Code Here

        ObjectMapHierarchicalModelImpl model = new ObjectMapHierarchicalModelImpl();

        FieldSelector fieldSelector = new FieldSelector();
        fieldSelector.register( "other", new FieldSelector() );

        CompositeSelector selector = new CompositeSelector( resolver.getBaseSelector(), fieldSelector );
        resultTraverser.traverse( input, selector, model, requestContext );

        Map<String, Object> objectTree = model.getUnderlyingModel();
        Assert.assertEquals( 0, objectTree.get( "id" ) );
        Assert.assertEquals( "someValue", objectTree.get( "other" ) );
View Full Code Here

        input.setLeaf( new BasicTestDataLeaf() );
        input.setId( "fooId" );

        FieldSelector fieldSelector = new FieldSelector();
        fieldSelector.register( "leaf", new FieldSelector() );
        CompositeSelector selector = new CompositeSelector( resolver.getBaseSelector(), fieldSelector );

        ObjectMapHierarchicalModelImpl model = new ObjectMapHierarchicalModelImpl();

        resultTraverser.traverse( input, selector, model, requestContext );
View Full Code Here

    {
        BasicTestDataLeaf input = new BasicTestDataLeaf();
        ObjectMapHierarchicalModelImpl model = new ObjectMapHierarchicalModelImpl();
        FieldSelector fieldSelector = new FieldSelector();
        fieldSelector.register( "someField", new FieldSelector() );
        resultTraverser.traverse( input, new CompositeSelector( resolver.getBaseSelector(), fieldSelector ), model, requestContext );
        Map<String, Object> objectTree = model.getUnderlyingModel();
        Assert.assertEquals( "customValue", objectTree.get( "someField" ) );
    }
View Full Code Here

TOP

Related Classes of org.skyscreamer.yoga.selector.CompositeSelector

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.