Java Code Examples for org.joda.time.PeriodType#isSupported()

The following examples show how to use org.joda.time.PeriodType#isSupported() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Time_27_PeriodFormatterBuilder_s.java    From coming with MIT License 6 votes vote down vote up
boolean isSupported(PeriodType type, int field) {
    switch (field) {
    default:
        return false;
    case YEARS:
        return type.isSupported(DurationFieldType.years());
    case MONTHS:
        return type.isSupported(DurationFieldType.months());
    case WEEKS:
        return type.isSupported(DurationFieldType.weeks());
    case DAYS:
        return type.isSupported(DurationFieldType.days());
    case HOURS:
        return type.isSupported(DurationFieldType.hours());
    case MINUTES:
        return type.isSupported(DurationFieldType.minutes());
    case SECONDS:
        return type.isSupported(DurationFieldType.seconds());
    case MILLIS:
        return type.isSupported(DurationFieldType.millis());
    case SECONDS_MILLIS: // drop through
    case SECONDS_OPTIONAL_MILLIS:
        return type.isSupported(DurationFieldType.seconds()) ||
               type.isSupported(DurationFieldType.millis());
    }
}
 
Example 2
Source File: Time_27_PeriodFormatterBuilder_t.java    From coming with MIT License 6 votes vote down vote up
boolean isSupported(PeriodType type, int field) {
    switch (field) {
    default:
        return false;
    case YEARS:
        return type.isSupported(DurationFieldType.years());
    case MONTHS:
        return type.isSupported(DurationFieldType.months());
    case WEEKS:
        return type.isSupported(DurationFieldType.weeks());
    case DAYS:
        return type.isSupported(DurationFieldType.days());
    case HOURS:
        return type.isSupported(DurationFieldType.hours());
    case MINUTES:
        return type.isSupported(DurationFieldType.minutes());
    case SECONDS:
        return type.isSupported(DurationFieldType.seconds());
    case MILLIS:
        return type.isSupported(DurationFieldType.millis());
    case SECONDS_MILLIS: // drop through
    case SECONDS_OPTIONAL_MILLIS:
        return type.isSupported(DurationFieldType.seconds()) ||
               type.isSupported(DurationFieldType.millis());
    }
}
 
Example 3
Source File: Time_13_PeriodFormatterBuilder_s.java    From coming with MIT License 6 votes vote down vote up
boolean isSupported(PeriodType type, int field) {
    switch (field) {
    default:
        return false;
    case YEARS:
        return type.isSupported(DurationFieldType.years());
    case MONTHS:
        return type.isSupported(DurationFieldType.months());
    case WEEKS:
        return type.isSupported(DurationFieldType.weeks());
    case DAYS:
        return type.isSupported(DurationFieldType.days());
    case HOURS:
        return type.isSupported(DurationFieldType.hours());
    case MINUTES:
        return type.isSupported(DurationFieldType.minutes());
    case SECONDS:
        return type.isSupported(DurationFieldType.seconds());
    case MILLIS:
        return type.isSupported(DurationFieldType.millis());
    case SECONDS_MILLIS: // drop through
    case SECONDS_OPTIONAL_MILLIS:
        return type.isSupported(DurationFieldType.seconds()) ||
               type.isSupported(DurationFieldType.millis());
    }
}
 
Example 4
Source File: Time_13_PeriodFormatterBuilder_t.java    From coming with MIT License 6 votes vote down vote up
boolean isSupported(PeriodType type, int field) {
    switch (field) {
    default:
        return false;
    case YEARS:
        return type.isSupported(DurationFieldType.years());
    case MONTHS:
        return type.isSupported(DurationFieldType.months());
    case WEEKS:
        return type.isSupported(DurationFieldType.weeks());
    case DAYS:
        return type.isSupported(DurationFieldType.days());
    case HOURS:
        return type.isSupported(DurationFieldType.hours());
    case MINUTES:
        return type.isSupported(DurationFieldType.minutes());
    case SECONDS:
        return type.isSupported(DurationFieldType.seconds());
    case MILLIS:
        return type.isSupported(DurationFieldType.millis());
    case SECONDS_MILLIS: // drop through
    case SECONDS_OPTIONAL_MILLIS:
        return type.isSupported(DurationFieldType.seconds()) ||
               type.isSupported(DurationFieldType.millis());
    }
}
 
Example 5
Source File: PeriodFormatterBuilder.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
boolean isSupported(PeriodType type, int field) {
    switch (field) {
    default:
        return false;
    case YEARS:
        return type.isSupported(DurationFieldType.years());
    case MONTHS:
        return type.isSupported(DurationFieldType.months());
    case WEEKS:
        return type.isSupported(DurationFieldType.weeks());
    case DAYS:
        return type.isSupported(DurationFieldType.days());
    case HOURS:
        return type.isSupported(DurationFieldType.hours());
    case MINUTES:
        return type.isSupported(DurationFieldType.minutes());
    case SECONDS:
        return type.isSupported(DurationFieldType.seconds());
    case MILLIS:
        return type.isSupported(DurationFieldType.millis());
    case SECONDS_MILLIS: // drop through
    case SECONDS_OPTIONAL_MILLIS:
        return type.isSupported(DurationFieldType.seconds()) ||
               type.isSupported(DurationFieldType.millis());
    }
}
 
Example 6
Source File: PeriodFormatterBuilder.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
boolean isSupported(PeriodType type, int field) {
    switch (field) {
    default:
        return false;
    case YEARS:
        return type.isSupported(DurationFieldType.years());
    case MONTHS:
        return type.isSupported(DurationFieldType.months());
    case WEEKS:
        return type.isSupported(DurationFieldType.weeks());
    case DAYS:
        return type.isSupported(DurationFieldType.days());
    case HOURS:
        return type.isSupported(DurationFieldType.hours());
    case MINUTES:
        return type.isSupported(DurationFieldType.minutes());
    case SECONDS:
        return type.isSupported(DurationFieldType.seconds());
    case MILLIS:
        return type.isSupported(DurationFieldType.millis());
    case SECONDS_MILLIS: // drop through
    case SECONDS_OPTIONAL_MILLIS:
        return type.isSupported(DurationFieldType.seconds()) ||
               type.isSupported(DurationFieldType.millis());
    }
}