Package org.joda.time

Examples of org.joda.time.LocalDate$Property


  }

  @Test
  public void testToLocalDate() {
    XMLGregorianCalendar cal = toXmlDate(new DateTime());
    LocalDate date = toLocalDate(cal);
    assertEquals(cal.getYear(), date.getYear());
    assertEquals(cal.getMonth(), date.getMonthOfYear());
    assertEquals(cal.getDay(), date.getDayOfMonth());
  }
View Full Code Here


  }

  @Test
  public void testToXmlDate_fromLocalDate() {

    LocalDate cal = new LocalDate();
    XMLGregorianCalendar xmlCal = toXmlDate(cal);

    assertEquals(cal.getYear(), xmlCal.getYear());
    // Calendar.MONTH is zero based, xmlCal is one based.
    assertEquals(cal.getMonthOfYear(), xmlCal.getMonth());
    assertEquals(cal.getDayOfMonth(), xmlCal.getDay());
  }
View Full Code Here

       
        final LinkRepresentation updateLink = domainObjectRepr.getLinkWithRel(Rel.UPDATE);
       
        final JsonRepresentation argRepr = updateLink.getArguments();
       
        final LocalDate ld = new LocalDate(2013,5,1);
        final LocalDateTime ldt = new LocalDateTime(2013,2,1,14,15,0);
        final DateTime dt = new DateTime(2013,2,1,14,15,0);
        final String s = "New string";
       
        argRepr.mapPut("localDateProperty.value", asIsoNoT(ld.toDate()));
        argRepr.mapPut("localDateTimeProperty.value", asIso(ldt.toDate()));
        argRepr.mapPut("dateTimeProperty.value", asIso(dt.toDate()));
        argRepr.mapPut("stringProperty.value", s);

        final RestfulResponse<JsonRepresentation> result = client.follow(updateLink, argRepr);
        assertThat(result.getStatus(), is(HttpStatusCode.OK));
       
        final DomainObjectRepresentation afterResp = result.getEntity().as(DomainObjectRepresentation.class);
       
        assertThat(afterResp.getProperty("localDateProperty").getDate("value"), is(ld.toDate()));
        assertThat(afterResp.getProperty("localDateTimeProperty").getDateTime("value"), is(ldt.toDate()));
        assertThat(afterResp.getProperty("dateTimeProperty").getDateTime("value"), is(dt.toDate()));
        assertThat(afterResp.getProperty("stringProperty").getString("value"), is(s));
    }
View Full Code Here

   
    @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

TOP

Related Classes of org.joda.time.LocalDate$Property

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.