Package com.asakusafw.runtime.value

Examples of com.asakusafw.runtime.value.BooleanOption


        super(TypeInfoFactory.booleanTypeInfo);
    }

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


        return new BooleanOption();
    }

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

        return object.get();
    }

    @Override
    public Object getPrimitiveWritableObject(Object o) {
        BooleanOption object = (BooleanOption) o;
        if (object == null || object.isNull()) {
            return null;
        }
        return new BooleanWritable(object.get());
    }
View Full Code Here

    public void boolean_values() throws Exception {
        trueFormat = "true";
        falseFormat = "false";

        CsvParser parser = create("true,false,");
        BooleanOption option = new BooleanOption();

        assertThat(parser.next(), is(true));

        parser.fill(option);
        assertThat(option.get(), is(true));

        parser.fill(option);
        assertThat(option.get(), is(false));

        parser.fill(option);
        assertThat(option.isNull(), is(true));

        parser.endRecord();
        assertThat(parser.next(), is(false));
    }
View Full Code Here

     * booleanの値を出力するテスト。
     * @throws Exception 例外が発生した場合
     */
    @Test
    public void emitBoolean() throws Exception {
        BooleanOption value = new BooleanOption();

        value.modify(true);
        emitter.emit(value);
        value.modify(false);
        emitter.emit(value);
        emitter.endRecord();

        value.modify(false);
        emitter.emit(value);
        value.modify(true);
        emitter.emit(value);
        emitter.endRecord();

        value.setNull();
        emitter.emit(value);
        value.modify(true);
        emitter.emit(value);
        emitter.endRecord();
        emitter.close();

        RecordParser parser = parser();
        assertThat(parser.next(), is(true));
        parser.fill(value);
        assertThat(value.get(), is(true));
        parser.fill(value);
        assertThat(value.get(), is(false));

        assertThat(parser.next(), is(true));
        parser.fill(value);
        assertThat(value.get(), is(false));
        parser.fill(value);
        assertThat(value.get(), is(true));

        assertThat(parser.next(), is(true));
        parser.fill(value);
        assertThat(value.isNull(), is(true));
        parser.fill(value);
        assertThat(value.isNull(), is(false));
    }
View Full Code Here

     * test for boolean values.
     * @throws Exception if failed
     */
    @Test
    public void boolean_values() throws Exception {
        assertRestorable(new BooleanOption(true));
        assertRestorable(new BooleanOption(false));
        assertRestorable(new BooleanOption());

        trueFormat = "false";
        falseFormat = "true";
        assertRestorable(new BooleanOption(true));
        assertRestorable(new BooleanOption(false));
    }
View Full Code Here

     * booleanの値を解析するテスト。
     * @throws Exception 例外が発生した場合
     */
    @Test
    public void fillBoolean() throws Exception {
        BooleanOption value = new BooleanOption();
        create("boolean");

        assertThat(parser.next(), is(true));
        parser.fill(value);
        assertThat(value.get(), is(true));
        parser.fill(value);
        assertThat(value.get(), is(false));
        parser.endRecord();

        assertThat(parser.next(), is(true));
        parser.fill(value);
        assertThat(value.get(), is(false));
        parser.fill(value);
        assertThat(value.get(), is(true));
        parser.endRecord();

        assertThat(parser.next(), is(true));
        parser.fill(value);
        assertThat(value.isNull(), is(true));
        parser.fill(value);
        assertThat(value.isNull(), is(false));
        parser.endRecord();
    }
View Full Code Here

TOP

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

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.