本文整理汇总了Java中org.joda.time.base.AbstractPartial类的典型用法代码示例。如果您正苦于以下问题:Java AbstractPartial类的具体用法?Java AbstractPartial怎么用?Java AbstractPartial使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AbstractPartial类属于org.joda.time.base包,在下文中一共展示了AbstractPartial类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: rollForwardWith
import org.joda.time.base.AbstractPartial; //导入依赖的package包/类
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;
}
示例2: format
import org.joda.time.base.AbstractPartial; //导入依赖的package包/类
@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);
}
}
示例3: convertPartialToCalendar
import org.joda.time.base.AbstractPartial; //导入依赖的package包/类
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;
}
示例4: convertPartialToDate
import org.joda.time.base.AbstractPartial; //导入依赖的package包/类
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();
}
示例5: convertPartialToDate
import org.joda.time.base.AbstractPartial; //导入依赖的package包/类
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();
}
示例6: before
import org.joda.time.base.AbstractPartial; //导入依赖的package包/类
@Override
public boolean before(final AbstractPartial date1, final AbstractPartial date2) {
return date1.isBefore(date2);
}
示例7: after
import org.joda.time.base.AbstractPartial; //导入依赖的package包/类
@Override
public boolean after(final AbstractPartial date1, final AbstractPartial date2) {
return date1.isAfter(date2);
}
示例8: equals
import org.joda.time.base.AbstractPartial; //导入依赖的package包/类
@Override
public boolean equals(final AbstractPartial date1, final AbstractPartial date2) {
return date1.equals(date2);
}
示例9: createTextField
import org.joda.time.base.AbstractPartial; //导入依赖的package包/类
@Override
protected HtmlComponent createTextField(Object object, Class type) {
Date date = convertPartialToDate((AbstractPartial) object);
return super.createTextField(date, type);
}
示例10: createTextField
import org.joda.time.base.AbstractPartial; //导入依赖的package包/类
@Override
protected HtmlComponent createTextField(Object object, Class type) {
Date date = convertPartialToDate((AbstractPartial) object);
return super.createTextField(date, type);
}
示例11: format
import org.joda.time.base.AbstractPartial; //导入依赖的package包/类
/**
* 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);
示例12: before
import org.joda.time.base.AbstractPartial; //导入依赖的package包/类
/**
* Usage: #joda.before(date1, date2)
*
* @see org.joda.time.base.AbstractPartial#isBefore(org.joda.time.ReadablePartial)
*/
boolean before(AbstractPartial date1, AbstractPartial date2);
示例13: after
import org.joda.time.base.AbstractPartial; //导入依赖的package包/类
/**
* Usage: #joda.after(date1, date2)
*
* @see org.joda.time.base.AbstractPartial#isAfter(org.joda.time.ReadablePartial)
*/
boolean after(AbstractPartial date1, AbstractPartial date2);
示例14: equals
import org.joda.time.base.AbstractPartial; //导入依赖的package包/类
/**
* Usage: #joda.equals(date1, date2)
*
* @see org.joda.time.base.AbstractPartial#equals(java.lang.Object)
*/
boolean equals(AbstractPartial date1, AbstractPartial date2);