Package com.asakusafw.runtime.value

Examples of com.asakusafw.runtime.value.StringOption


        this.length = info.getLength();
    }

    @Override
    protected ValueOption<?> newObject() {
        return new StringOption();
    }
View Full Code Here


        return new StringOption();
    }

    @Override
    public HiveChar getPrimitiveJavaObject(Object o) {
        StringOption object = (StringOption) o;
        if (object == null || object.isNull()) {
            return null;
        }
        return new HiveChar(object.getAsString(), length);
    }
View Full Code Here

        return new HiveChar(object.getAsString(), length);
    }

    @Override
    public HiveCharWritable getPrimitiveWritableObject(Object o) {
        StringOption object = (StringOption) o;
        if (object == null || object.isNull()) {
            return null;
        }
        HiveCharWritable writable = new HiveCharWritable();
        writable.getTextValue().set(object.get());
        return writable;
    }
View Full Code Here

        writer.flush();
        output.close();

        DataModelReader<Object> reader = support.createReader("testing", new ByteArrayInputStream(output.toByteArray()));
        assertThat(reader.readTo(buffer.unwrap()), is(true));
        assertThat(buffer.getOption("value"), is((Object) new StringOption("Hello, world!")));
        assertThat(buffer.getOption("path"), is((Object) new StringOption("testing")));
        assertThat(reader.readTo(buffer.unwrap()), is(false));
    }
View Full Code Here

        writer.flush();
        output.close();

        DataModelReader<Object> reader = support.createReader("testing", new ByteArrayInputStream(output.toByteArray()));
        assertThat(reader.readTo(buffer.unwrap()), is(true));
        assertThat(buffer.getOption("value"), is((Object) new StringOption("Hello\nworld!")));
        assertThat(buffer.getOption("number"), is((Object) new IntOption(1)));
        assertThat(reader.readTo(buffer.unwrap()), is(true));
        assertThat(buffer.getOption("value"), is((Object) new StringOption("Hello\nworld!")));
        assertThat(buffer.getOption("number"), is((Object) new IntOption(3)));
        assertThat(reader.readTo(buffer.unwrap()), is(false));
    }
View Full Code Here

        writer.flush();
        output.close();

        DataModelReader<Object> reader = support.createReader("testing", new ByteArrayInputStream(output.toByteArray()));
        assertThat(reader.readTo(buffer.unwrap()), is(true));
        assertThat(buffer.getOption("value"), is((Object) new StringOption("Hello\nworld!")));
        assertThat(buffer.getOption("number"), is((Object) new LongOption(1)));
        assertThat(reader.readTo(buffer.unwrap()), is(true));
        assertThat(buffer.getOption("value"), is((Object) new StringOption("Hello\nworld!")));
        assertThat(buffer.getOption("number"), is((Object) new LongOption(2)));
        assertThat(reader.readTo(buffer.unwrap()), is(false));
    }
View Full Code Here

        writer.flush();
        output.close();

        DataModelReader<Object> reader = support.createReader("testing", new ByteArrayInputStream(output.toByteArray()));
        assertThat(reader.readTo(buffer.unwrap()), is(true));
        assertThat(buffer.getOption("value"), is((Object) new StringOption("Hello, world!")));
        assertThat(buffer.getOption("ignored"), is((Object) new StringOption()));
        assertThat(reader.readTo(buffer.unwrap()), is(false));
    }
View Full Code Here

                CsvConfiguration.DEFAULT_DATE_TIME_FORMAT);
        ByteArrayInputStream input = new ByteArrayInputStream(string.getBytes(conf.getCharset()));
        CsvParser parser = new CsvParser(input, string, conf);
        List<String[]> results = Lists.create();
        try {
            StringOption buffer = new StringOption();
            while (parser.next()) {
                String[] line = new String[columns];
                for (int i = 0; i < columns; i++) {
                    parser.fill(buffer);
                    line[i] = buffer.or((String) null);
                }
                parser.endRecord();
                results.add(line);
            }
            parser.close();
View Full Code Here

        super(TypeInfoFactory.stringTypeInfo);
    }

    @Override
    protected ValueOption<?> newObject() {
        return new StringOption();
    }
View Full Code Here

        return new StringOption();
    }

    @Override
    public String getPrimitiveJavaObject(Object o) {
        StringOption object = (StringOption) o;
        if (object == null || object.isNull()) {
            return null;
        }
        return object.getAsString();
    }
View Full Code Here

TOP

Related Classes of com.asakusafw.runtime.value.StringOption

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.