Package org.joda.time

Examples of org.joda.time.LocalDate


   
    @Test
    public void jodaPropertiesUpdated() throws Exception {
       
        // LocalDate
        final LocalDate ld = new LocalDate(2013,5,1);
        modifyLink = getObjectPropertyReprModifyLink("JODA", "73", "localDateProperty");
        argRepr = modifyLink.getArguments().mapPut("value", asIsoNoT(ld.toDate()));
        assertThat(followedRepr(modifyLink,argRepr).getDate("value"), is(ld.toDate()));


        // LocalDateTime
        final LocalDateTime ldt = new LocalDateTime(2013,2,1,14,15,0);
        modifyLink = getObjectPropertyReprModifyLink("JODA", "73", "localDateTimeProperty");
View Full Code Here


        return new Date(getTime());
    }

    public static LocalDate getTimeAsLocalDate() {
        final DateTimeZone timeZone = DateTimeZone.forTimeZone(TimeZone.getDefault());
        return new LocalDate(getTime(), timeZone);
    }
View Full Code Here

        createEntity();
    }

    private JodaValuedEntity createEntity() {
        final JodaValuedEntity jve = jodaValuesEntityRepository.newEntity();
        jve.setLocalDateProperty(new LocalDate(2008,3,21));
        jve.setLocalDateTimeProperty(new LocalDateTime(2009, 4, 29, 13, 45, 22));
        jve.setDateTimeProperty(new DateTime(2010, 3, 31, 9, 50, 43, DateTimeZone.UTC));
        return jve;
    }
View Full Code Here

        memento.set("someDouble", 1234567890.123456);
        memento.set("someBooleanTrue", Boolean.TRUE);
        memento.set("someBooleanFalse", Boolean.FALSE);
        memento.set("someBigInteger", new BigInteger("123456789012345678901234567890"));
        memento.set("someBigDecimal", new BigDecimal("123456789012345678901234567890.123456789"));
        memento.set("someLocalDate", new LocalDate(2013,9,3));
       
        memento.set("someBookmark", new Bookmark("CUS", "12345"));
        memento.set("someNullValue", null);
       
        memento.set("someEnum", DOW.Wed);
       
        final String str = memento.asString();
       
        final Memento memento2 = mementoService.parse(str);
       
        assertThat(memento2.get("someString", String.class), is("a string"));
        assertThat(memento2.get("someStringWithDoubleSpaces", String.class), is("a  string"));
        assertThat(memento2.get("someByte", Byte.class), is((byte)123));
        assertThat(memento2.get("someShort", Short.class), is((short)12345));
        assertThat(memento2.get("someInt", Integer.class), is(123456789));
        assertThat(memento2.get("someLong", Long.class), is(1234567890123456789L));
        assertThat(memento2.get("someFloat", Float.class), is(123.45F));
        assertThat(memento2.get("someDouble", Double.class), is(1234567890.123456));
        assertThat(memento2.get("someBooleanTrue", Boolean.class), is(Boolean.TRUE));
        assertThat(memento2.get("someBooleanFalse", Boolean.class), is(Boolean.FALSE));
        assertThat(memento2.get("someBigInteger", BigInteger.class), is(new BigInteger("123456789012345678901234567890")));
        assertThat(memento2.get("someBigDecimal", BigDecimal.class), is(new BigDecimal("123456789012345678901234567890.123456789")));
        assertThat(memento2.get("someLocalDate", LocalDate.class), is(new LocalDate(2013,9,3)));
        assertThat(memento2.get("someBookmark", Bookmark.class), is(new Bookmark("CUS", "12345")));
       
        // a nullValue can be grabbed as any type, will always succeed
        assertThat(memento2.get("someNullValue", Integer.class), is(nullValue()));
        assertThat(memento2.get("someNullValue", Bookmark.class), is(nullValue()));
View Full Code Here

                Element rootEl = xmlDoc.getDocumentElement();
               
                assertThat(
                        xmlSnapshotService.getChildElementValue(rootEl, "app:someString", String.class), is("OXF"));
                assertThat(
                        xmlSnapshotService.getChildElementValue(rootEl, "app:someLocalDate", LocalDate.class), is(new LocalDate(2013,4,1)));
                assertThat(
                        xmlSnapshotService.getChildElementValue(rootEl, "app:someBigDecimal", BigDecimal.class), is(new BigDecimal("123456789012345678901234567890.12345678")));
                assertThat(
                        xmlSnapshotService.getChildElementValue(rootEl, "app:someBigInteger", BigInteger.class), is(new BigInteger("12345678901234567890123456789012345678")));
                assertThat(
View Full Code Here

    private JodaLocalDateUtil(){}
   
    static LocalDate parseDate(final String dateStr, final Localization localization, List<DateTimeFormatter> parseFormatters) {
        Iterable<DateTimeFormatter> elements = Iterables.transform(parseFormatters, JodaFunctions.withLocale(localization));
        LocalDate parsedDate = parseDate(dateStr, elements);
        return parsedDate;
    }
View Full Code Here

    }

    // //////////////////////////////////////

    static LocalDate relativeDate(final LocalDate contextDate, final String str, final boolean add) {
        LocalDate relativeDate = contextDate;
        if (str.equals("")) {
            return contextDate;
        }

        try {
View Full Code Here

    @Override
    protected LocalDate doParse(final Object context, final String entry, final Localization localization) {

        updateTitleStringFormatterIfOverridden();
       
        LocalDate contextDate = (LocalDate) context;

        final String dateString = entry.trim().toUpperCase();
        if (dateString.startsWith("+") && contextDate != null) {
            return JodaLocalDateUtil.relativeDate(contextDate, dateString, true);
        } else if (dateString.startsWith("-"&& contextDate != null) {
View Full Code Here

    @Override
    public String titleString(final Object value, final Localization localization) {
        if (value == null) {
            return null;
        }
        final LocalDate date = (LocalDate) value;
        DateTimeFormatter f = titleStringFormatter;
        if (localization != null) {
            f = titleStringFormatter.withLocale(localization.getLocale());
        }
        return JodaLocalDateUtil.titleString(f, date);
View Full Code Here

        return JodaLocalDateUtil.titleString(f, date);
    }

    @Override
    public String titleStringWithMask(final Object value, final String usingMask) {
        final LocalDate date = (LocalDate) value;
        return JodaLocalDateUtil.titleString(DateTimeFormat.forPattern(usingMask), date);
    }
View Full Code Here

TOP

Related Classes of org.joda.time.LocalDate

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.