Package org.joda.time

Examples of org.joda.time.LocalDate


    @Test
    public void defaultEventType() throws Exception {
       
        SomeDomainObject sdo = new SomeDomainObject();
        Identifier identifier = Identifier.propertyOrCollectionIdentifier(SomeDomainObject.class, "someDateProperty");
        LocalDate oldValue = new LocalDate(2013,4,1);
        LocalDate newValue = new LocalDate(2013,5,2);
       
        final PropertyInteractionEvent<Object, Object> ev =
                new InteractionHelper(null).newPropertyInteractionEvent(PropertyInteractionEvent.Default.class, identifier, sdo, oldValue, newValue);
        assertThat(ev.getSource(), is((Object)sdo));
        assertThat(ev.getIdentifier(), is(identifier));
View Full Code Here


    @Test
    public void customEventType() throws Exception {

        SomeDomainObject sdo = new SomeDomainObject();
        Identifier identifier = Identifier.propertyOrCollectionIdentifier(SomeDomainObject.class, "someDateProperty");
        LocalDate oldValue = new LocalDate(2013,4,1);
        LocalDate newValue = new LocalDate(2013,5,2);
       
        final PropertyInteractionEvent<SomeDomainObject, LocalDate> ev =
                new InteractionHelper(null).newPropertyInteractionEvent(SomeDatePropertyChangedEvent.class, identifier, sdo, oldValue, newValue);
        assertThat(ev.getSource(), is(sdo));
        assertThat(ev.getIdentifier(), is(identifier));
View Full Code Here

    @Test
    public void defaultEventType() throws Exception {
       
        SomeDomainObject sdo = new SomeDomainObject();
        Identifier identifier = Identifier.propertyOrCollectionIdentifier(SomeDomainObject.class, "someDateProperty");
        LocalDate oldValue = new LocalDate(2013,4,1);
        LocalDate newValue = null;
       
        final PropertyInteractionEvent<Object, Object> ev =
                new InteractionHelper(null).newPropertyInteractionEvent(PropertyInteractionEvent.Default.class, identifier, sdo, oldValue, newValue);
        assertThat(ev.getSource(), is((Object)sdo));
        assertThat(ev.getIdentifier(), is(identifier));
View Full Code Here

    @Test
    public void customEventType() throws Exception {

        SomeDomainObject sdo = new SomeDomainObject();
        Identifier identifier = Identifier.propertyOrCollectionIdentifier(SomeDomainObject.class, "someDateProperty");
        LocalDate oldValue = new LocalDate(2013,4,1);
        LocalDate newValue = null;
       
        final PropertyInteractionEvent<SomeDomainObject, LocalDate> ev =
                new InteractionHelper(null).newPropertyInteractionEvent(SomeDatePropertyChangedEvent.class, identifier, sdo, oldValue, newValue);
        assertThat(ev.getSource(), is(sdo));
        assertThat(ev.getIdentifier(), is(identifier));
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

    // EncoderDecoder
    // //////////////////////////////////////////////////////////////////

    @Override
    protected String doEncode(final Object object) {
        final LocalDate date = (LocalDate) object;
        return encode(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.