Package org.milyn.flatfile

Examples of org.milyn.flatfile.Binding


    public void test_10() throws SmooksException, IOException, SAXException {
        Smooks smooks = new Smooks();

        smooks.setReaderConfig(new CSVRecordParserConfigurator("firstname,lastname,$ignore$,gender,age,country")
                .setBinding(new Binding("people", Person.class, BindingType.LIST)));

        JavaResult result = new JavaResult();
        smooks.filterSource(new StreamSource(getClass().getResourceAsStream("input-message-05.csv")), result);

        List<Person> people = (List<Person>) result.getBean("people");
View Full Code Here


    public void test_11() throws SmooksException, IOException, SAXException {
        Smooks smooks = new Smooks();

        smooks.setReaderConfig(new CSVRecordParserConfigurator("firstname,lastname,$ignore$,gender,age,country")
                .setBinding(new Binding("person", Person.class, BindingType.SINGLE)));

        JavaResult result = new JavaResult();
        smooks.filterSource(new StreamSource(getClass().getResourceAsStream("input-message-05.csv")), result);

        Person person = (Person) result.getBean("person");
View Full Code Here

    public void test_12() throws SmooksException, IOException, SAXException {
        Smooks smooks = new Smooks();

        smooks.setReaderConfig(new CSVRecordParserConfigurator("firstname,lastname,$ignore$,gender,age,country")
                .setBinding(new Binding("people", HashMap.class, BindingType.LIST)));

        JavaResult result = new JavaResult();
        smooks.filterSource(new StreamSource(getClass().getResourceAsStream("input-message-05.csv")), result);

        List<Map> people = (List<Map>) result.getBean("people");
View Full Code Here

    public void test_13_programmatic(FilterSettings filterSettings) throws SmooksException, IOException, SAXException {
        Smooks smooks = new Smooks();

        smooks.setReaderConfig(new CSVRecordParserConfigurator("firstname,lastname,$ignore$,gender,age,country")
                .setBinding(new Binding("people", Person.class, BindingType.MAP).setKeyField("age")));

        smooks.setFilterSettings(filterSettings);
        test_13(smooks);
    }
View Full Code Here

    public void test_14_programmatic(FilterSettings filterSettings) throws SmooksException, IOException, SAXException {
        Smooks smooks = new Smooks();

        smooks.setReaderConfig(new CSVRecordParserConfigurator("firstname,lastname,$ignore$,gender,age,country")
                .setBinding(new Binding("people", HashMap.class, BindingType.MAP).setKeyField("firstname")));

        smooks.setFilterSettings(filterSettings);
        test_14(smooks);
    }
View Full Code Here

    public void test_18() throws SmooksException, IOException, SAXException {
        Smooks smooks = new Smooks();

        smooks.setReaderConfig(new CSVRecordParserConfigurator("firstname?upper_case,lastname?uncap_first,$ignore$5")
                .setBinding(new Binding("people", HashMap.class, BindingType.LIST)));

        JavaResult result = new JavaResult();
        smooks.filterSource(new StreamSource(getClass().getResourceAsStream("input-message-05.csv")), result);

        List<Map> people = (List<Map>) result.getBean("people");
View Full Code Here

        AssertArgument.isNotNull(recordType, "recordType");

        smooks = new Smooks();
        smooks.setFilterSettings(FilterSettings.DEFAULT_SAX);
        smooks.setReaderConfig(new CSVRecordParserConfigurator(fields)
                .setBinding(new Binding(beanId, recordType, BindingType.LIST)));
    }
View Full Code Here

        AssertArgument.isNotNullAndNotEmpty(keyField, "keyField");

        smooks = new Smooks();
        smooks.setFilterSettings(FilterSettings.DEFAULT_SAX);
        smooks.setReaderConfig(new CSVRecordParserConfigurator(fields)
                .setBinding(new Binding(beanId, recordType, BindingType.MAP).setKeyField(keyField)));
    }
View Full Code Here

            // ****
            // And here's the configuration... configuring the CSV reader and the direct
            // binding config to create a List of Person objects (List<Person>)...
            // ****
            smooks.setReaderConfig(new CSVRecordParserConfigurator("firstName,lastName,gender,age,country")
                    .setBinding(new Binding("customerList", Customer.class, BindingType.LIST)));

            // Configure the execution context to generate a report...
            ExecutionContext executionContext = smooks.createExecutionContext();
            executionContext.setEventListener(new HtmlReportGenerator("target/report/report.html"));

View Full Code Here

TOP

Related Classes of org.milyn.flatfile.Binding

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.