当前位置: 首页>>代码示例>>Java>>正文


Java ReadablePartial.isSupported方法代码示例

本文整理汇总了Java中org.joda.time.ReadablePartial.isSupported方法的典型用法代码示例。如果您正苦于以下问题:Java ReadablePartial.isSupported方法的具体用法?Java ReadablePartial.isSupported怎么用?Java ReadablePartial.isSupported使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.joda.time.ReadablePartial的用法示例。


在下文中一共展示了ReadablePartial.isSupported方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getMaximumValue

import org.joda.time.ReadablePartial; //导入方法依赖的package包/类
@Override
public int getMaximumValue(ReadablePartial partial) {
    if (partial.isSupported(DateTimeFieldType.monthOfYear())) {
        int month = partial.get(DateTimeFieldType.monthOfYear());
        return this.daysInMonth[month - 1]; // Months are 1-based
    }
    return this.getMaximumValue();
}
 
开发者ID:NOAA-PMEL,项目名称:LAS,代码行数:9,代码来源:DayOfMonthOfFixedYearDateTimeField.java

示例2: isToday

import org.joda.time.ReadablePartial; //导入方法依赖的package包/类
/**
 * See {@link android.text.format.DateUtils#isToday} for full docs.
 *
 * @return true if the supplied when is today else false
 */
public static boolean isToday(ReadablePartial time) {
    if (!time.isSupported(DateTimeFieldType.dayOfMonth())
        || !time.isSupported(DateTimeFieldType.monthOfYear())
        || !time.isSupported(DateTimeFieldType.year())) {
        throw new IllegalArgumentException("isToday() must be passed a ReadablePartial that supports day of " +
            "month, month of year and year.");
    }

    LocalDate localDate = time instanceof LocalDate ? (LocalDate) time : new LocalDate(time);
    return LocalDate.now().compareTo(localDate) == 0;
}
 
开发者ID:BenAlderfer,项目名称:RIT-Dining-Planner-Android,代码行数:17,代码来源:DateUtils.java

示例3: getRelativeDateTimeString

import org.joda.time.ReadablePartial; //导入方法依赖的package包/类
/**
 * Return string describing the time until/elapsed time since 'time' formatted like
 * "[relative time/date], [time]".
 *
 * See {@link android.text.format.DateUtils#getRelativeDateTimeString} for full docs.
 *
 * @throws IllegalArgumentException if using a ReadablePartial without a time component
 * @see #getRelativeDateTimeString(Context, ReadableInstant, ReadablePeriod, int)
 */
public static CharSequence getRelativeDateTimeString(Context context, ReadablePartial time,
                                                     ReadablePeriod transitionResolution, int flags) {
    if (!time.isSupported(DateTimeFieldType.hourOfDay())
        || !time.isSupported(DateTimeFieldType.minuteOfHour())) {
        throw new IllegalArgumentException("getRelativeDateTimeString() must be passed a ReadablePartial that " +
            "supports time, otherwise it makes no sense");
    }

    return getRelativeDateTimeString(context, time.toDateTime(DateTime.now()), transitionResolution, flags);
}
 
开发者ID:BenAlderfer,项目名称:RIT-Dining-Planner-Android,代码行数:20,代码来源:DateUtils.java

示例4: printTo

import org.joda.time.ReadablePartial; //导入方法依赖的package包/类
public void printTo(StringBuffer buf, ReadablePartial partial, Locale locale) {
    if (partial.isSupported(iFieldType)) {
        try {
            FormatUtils.appendUnpaddedInteger(buf, partial.get(iFieldType));
        } catch (RuntimeException e) {
            buf.append('\ufffd');
        }
    } else {
        buf.append('\ufffd');
    }
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:12,代码来源:DateTimeFormatterBuilder.java

示例5: getTwoDigitYear

import org.joda.time.ReadablePartial; //导入方法依赖的package包/类
private int getTwoDigitYear(ReadablePartial partial) {
    if (partial.isSupported(iType)) {
        try {
            int year = partial.get(iType);
            if (year < 0) {
                year = -year;
            }
            return year % 100;
        } catch (RuntimeException e) {}
    } 
    return -1;
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:13,代码来源:DateTimeFormatterBuilder.java

示例6: print

import org.joda.time.ReadablePartial; //导入方法依赖的package包/类
private String print(ReadablePartial partial, Locale locale) {
    if (partial.isSupported(iFieldType)) {
        DateTimeField field = iFieldType.getField(partial.getChronology());
        if (iShort) {
            return field.getAsShortText(partial, locale);
        } else {
            return field.getAsText(partial, locale);
        }
    } else {
        return "\ufffd";
    }
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:13,代码来源:DateTimeFormatterBuilder.java

示例7: printTo

import org.joda.time.ReadablePartial; //导入方法依赖的package包/类
public void printTo(StringBuffer buf, ReadablePartial partial, Locale locale) {
    for (DateTimeFieldType type : contingentOnFields) {
        if (partial.isSupported(type)) {
            buf.append(literal);
            return;
        }
    }
}
 
开发者ID:KRMAssociatesInc,项目名称:eHMP,代码行数:9,代码来源:ParseUtils.java


注:本文中的org.joda.time.ReadablePartial.isSupported方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。