Java 类org.joda.time.base.AbstractPartial 实例源码

项目:trolley-tracker-android-client    文件:Utils.java   
public static DateTime rollForwardWith(ReadableInstant now, AbstractPartial lp) {
    DateTime dt = lp.toDateTime(now);
    while (dt.isBefore(now)) {
        dt = dt.withFieldAdded(lp.getFieldTypes()[0].getRangeDurationType(), 1);
    }
    return dt;
}
项目:thymeleaf-joda    文件:JodaImpl.java   
@Override
public String format(final AbstractPartial target, String pattern) {
    try {
        return DateTimeFormat.forPattern(pattern).withLocale(locale).print(target);
    } catch (final Exception e) {
        throw new TemplateProcessingException(
                "Error formatting Joda LocalTime with pattern '" + pattern + "' for locale " + this.locale, e);
    }
}
项目:bennu-renderers    文件:PartialRenderer.java   
private Calendar convertPartialToCalendar(AbstractPartial partial) {
    Calendar calendar = Calendar.getInstance();
    calendar.clear();

    DateTimeFieldType[] fieldTypes = partial.getFieldTypes();
    for (DateTimeFieldType fieldType : fieldTypes) {
        if (fieldType.equals(DateTimeFieldType.dayOfMonth())) {
            calendar.set(Calendar.DAY_OF_MONTH, partial.get(DateTimeFieldType.dayOfMonth()));
            continue;
        }

        if (fieldType.equals(DateTimeFieldType.monthOfYear())) {
            calendar.set(Calendar.MONTH, partial.get(DateTimeFieldType.monthOfYear()) - 1);
            continue;
        }

        if (fieldType.equals(DateTimeFieldType.year())) {
            calendar.set(Calendar.YEAR, partial.get(DateTimeFieldType.year()));
            continue;
        }

        if (fieldType.equals(DateTimeFieldType.hourOfDay())) {
            calendar.set(Calendar.HOUR_OF_DAY, partial.get(DateTimeFieldType.hourOfDay()));
            continue;
        }

        if (fieldType.equals(DateTimeFieldType.minuteOfHour())) {
            calendar.set(Calendar.MINUTE, partial.get(DateTimeFieldType.minuteOfHour()));
            continue;
        }

        if (fieldType.equals(DateTimeFieldType.secondOfMinute())) {
            calendar.set(Calendar.SECOND, partial.get(DateTimeFieldType.secondOfMinute()));
            continue;
        }
    }

    return calendar;
}
项目:bennu-renderers    文件:MultipleFormatTimeInputRenderer.java   
private Date convertPartialToDate(AbstractPartial partial) {
    if (partial == null) {
        return null;
    }
    Calendar calendar = Calendar.getInstance();
    calendar.clear();
    if (isHour()) {
        calendar.set(Calendar.HOUR_OF_DAY, partial.get(DateTimeFieldType.hourOfDay()));
    }
    if (isMinute()) {
        calendar.set(Calendar.MINUTE, partial.get(DateTimeFieldType.minuteOfHour()));
    }
    return calendar.getTime();
}
项目:bennu-renderers    文件:PartialInputRenderer.java   
private Date convertPartialToDate(AbstractPartial partial) {
    if (partial == null) {
        return null;
    }

    Calendar calendar = Calendar.getInstance();
    calendar.clear();

    if (isDay()) {
        calendar.set(Calendar.DAY_OF_MONTH, partial.get(DateTimeFieldType.dayOfMonth()));
    }

    if (isMonth()) {
        calendar.set(Calendar.MONTH, partial.get(DateTimeFieldType.monthOfYear()) - 1);
    }

    if (isYear()) {
        calendar.set(Calendar.YEAR, partial.get(DateTimeFieldType.year()));
    }

    if (isHour()) {
        calendar.set(Calendar.HOUR_OF_DAY, partial.get(DateTimeFieldType.hourOfDay()));
    }

    if (isMinute()) {
        calendar.set(Calendar.MINUTE, partial.get(DateTimeFieldType.minuteOfHour()));
    }

    if (isSecond()) {
        calendar.set(Calendar.SECOND, partial.get(DateTimeFieldType.secondOfMinute()));
    }

    return calendar.getTime();
}
项目:thymeleaf-joda    文件:JodaImpl.java   
@Override
public boolean before(final AbstractPartial date1, final AbstractPartial date2) {
    return date1.isBefore(date2);
}
项目:thymeleaf-joda    文件:JodaImpl.java   
@Override
public boolean after(final AbstractPartial date1, final AbstractPartial date2) {
    return date1.isAfter(date2);
}
项目:thymeleaf-joda    文件:JodaImpl.java   
@Override
public boolean equals(final AbstractPartial date1, final AbstractPartial date2) {
    return date1.equals(date2);
}
项目:bennu-renderers    文件:MultipleFormatTimeInputRenderer.java   
@Override
protected HtmlComponent createTextField(Object object, Class type) {
    Date date = convertPartialToDate((AbstractPartial) object);
    return super.createTextField(date, type);
}
项目:bennu-renderers    文件:PartialInputRenderer.java   
@Override
protected HtmlComponent createTextField(Object object, Class type) {
    Date date = convertPartialToDate((AbstractPartial) object);

    return super.createTextField(date, type);
}
项目:thymeleaf-joda    文件:Joda.java   
/**
 * Usage: #joda.format(target, pattern)
 *
 * @param target  Joda {@link org.joda.time.LocalDate} or {@link org.joda.time.LocalTime}
 * @param pattern Valid {@link org.joda.time.format.DateTimeFormatter} pattern
 * @return Formatted string
 */
String format(AbstractPartial target, String pattern);
项目:thymeleaf-joda    文件:Joda.java   
/**
 * Usage: #joda.before(date1, date2)
 *
 * @see org.joda.time.base.AbstractPartial#isBefore(org.joda.time.ReadablePartial)
 */
boolean before(AbstractPartial date1, AbstractPartial date2);
项目:thymeleaf-joda    文件:Joda.java   
/**
 * Usage: #joda.after(date1, date2)
 *
 * @see org.joda.time.base.AbstractPartial#isAfter(org.joda.time.ReadablePartial)
 */
boolean after(AbstractPartial date1, AbstractPartial date2);
项目:thymeleaf-joda    文件:Joda.java   
/**
 * Usage: #joda.equals(date1, date2)
 *
 * @see org.joda.time.base.AbstractPartial#equals(java.lang.Object)
 */
boolean equals(AbstractPartial date1, AbstractPartial date2);