Package com.asakusafw.runtime.value

Examples of com.asakusafw.runtime.value.DateTime


    public java.sql.Timestamp getPrimitiveJavaObject(Object o) {
        DateTimeOption object = (DateTimeOption) o;
        if (object == null || object.isNull()) {
            return null;
        }
        DateTime value = object.get();

        // FIXME for optimization
        @SuppressWarnings("deprecation")
        java.sql.Timestamp result = new java.sql.Timestamp(
                value.getYear() - 1900, value.getMonth() - 1, value.getDay(),
                value.getHour(), value.getMinute(), value.getSecond(), 0);
        return result;
    }
View Full Code Here


        all.set("c_long", 100000L);
        all.set("c_float", 1.5f);
        all.set("c_double", 2.5f);
        all.set("c_decimal", new BigDecimal("3.1415"));
        all.set("c_date", new Date(2011, 9, 1));
        all.set("c_datetime", new DateTime(2011, 12, 31, 23, 59, 59));

        BinaryStreamFormat<Object> unsafe = unsafe(support);

        ByteArrayOutputStream output = new ByteArrayOutputStream();
        ModelOutput<Object> writer = unsafe.createOutput(model.unwrap().getClass(), "hello", output);
View Full Code Here

        all.set("c_long", 100000L);
        all.set("c_float", 1.5f);
        all.set("c_double", 2.5f);
        all.set("c_decimal", new BigDecimal("3.1415"));
        all.set("c_date", new Date(2011, 9, 1));
        all.set("c_datetime", new DateTime(2011, 12, 31, 23, 59, 59));

        BinaryStreamFormat<Object> unsafe = unsafe(support);

        ByteArrayOutputStream output = new ByteArrayOutputStream();
        ModelOutput<Object> writer = unsafe.createOutput(model.unwrap().getClass(), "hello", output);
View Full Code Here

        ModelWrapper model = loaded.newModel("Model");
        model.set("text_value", new Text("\u3042\u3044\u3046\u3048\u304a"));
        model.set("true_value", true);
        model.set("false_value", false);
        model.set("date_value", new Date(2011, 10, 11));
        model.set("date_time_value", new DateTime(2011, 1, 2, 13, 14, 15));
        BinaryStreamFormat<Object> support = unsafe(loaded.newObject("csv", "ModelCsvFormat"));

        ByteArrayOutputStream output = new ByteArrayOutputStream();
        ModelOutput<Object> writer = support.createOutput(model.unwrap().getClass(), "hello", output);
        writer.write(model.unwrap());
View Full Code Here

        object.setPDouble(2.5d);
        object.setPDecimal(new BigDecimal("3.141592"));
        object.setPTextAsString("Hello, world!");
        object.setPBoolean(true);
        object.setPDate(new Date(2011, 5, 2));
        object.setPDatetime(new DateTime(2011, 12, 31, 23, 59, 59));

        DataModelReflection ref = def.toReflection(object);
        assertThat(ref.getValue(p("p_int")), is((Object) 100));
        assertThat(ref.getValue(p("p_long")), is((Object) 200L));
        assertThat(ref.getValue(p("p_byte")), is((Object) (byte) 127));
View Full Code Here

        object.setPByte((byte) 127);
        object.setPDecimal(new BigDecimal("3.141592"));
        object.setPTextAsString("Hello, world!");
        object.setPBoolean(true);
        object.setPDate(new Date(2011, 5, 2));
        object.setPDatetime(new DateTime(2011, 12, 31, 23, 59, 59));

        DataModelReflection ref = def.toReflection(object);
        Variety restored = def.toObject(ref);
        assertThat(restored, not(sameInstance(object)));
        assertThat(restored, equalTo(object));
View Full Code Here

        DateTimeOption option = new DateTimeOption();

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

        parser.fill(option);
        assertThat(option.get(), is(new DateTime(2011, 3, 31, 23, 59, 59)));

        parser.fill(option);
        assertThat(option.get(), is(new DateTime(1971, 4, 1, 1, 2, 3)));

        parser.fill(option);
        assertThat(option.get(), is(new DateTime(1971, 4, 1, 1, 2, 3)));

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

        parser.endRecord();
View Full Code Here

        DateTimeOption option = new DateTimeOption();

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

        parser.fill(option);
        assertThat(option.get(), is(new DateTime(2011, 3, 31, 23, 59, 59)));

        parser.fill(option);
        assertThat(option.get(), is(new DateTime(1971, 4, 1, 1, 2, 3)));

        parser.fill(option);
        assertThat(option.get(), is(new DateTime(1971, 4, 1, 1, 2, 3)));

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

        parser.endRecord();
View Full Code Here

            DateTimeOption date = new DateTimeOption();
            while (parser.next()) {
                parser.fill(date);
                parser.endRecord();
                if (rows == 0) {
                    assertThat(date, is(new DateTimeOption(new DateTime(1999, 12, 31, 1, 23, 45))));
                }
                rows++;
            }
            parser.close();
            assertThat(rows, is(count));
View Full Code Here

    }

    private DateTime time(int y, int m, int d, int h, int min, int s) {
        int days = DateUtil.getDayFromDate(y, m, d);
        int secs = DateUtil.getSecondFromTime(h, min, s);
        DateTime date = new DateTime();
        date.setElapsedSeconds((long) days * 86400 + secs);
        return date;
    }
View Full Code Here

TOP

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

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.