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


Java FieldUtils.verifyValueBounds方法代码示例

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


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

示例1: getDateTimeMillis

import org.joda.time.field.FieldUtils; //导入方法依赖的package包/类
public long getDateTimeMillis(
        int year, int monthOfYear, int dayOfMonth,
        int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)
        throws IllegalArgumentException {
    Chronology base;
    if ((base = getBase()) != null) {
        return base.getDateTimeMillis(year, monthOfYear, dayOfMonth,
                                      hourOfDay, minuteOfHour, secondOfMinute, millisOfSecond);
    }

    FieldUtils.verifyValueBounds(DateTimeFieldType.hourOfDay(), hourOfDay, 0, 23);
    FieldUtils.verifyValueBounds(DateTimeFieldType.minuteOfHour(), minuteOfHour, 0, 59);
    FieldUtils.verifyValueBounds(DateTimeFieldType.secondOfMinute(), secondOfMinute, 0, 59);
    FieldUtils.verifyValueBounds(DateTimeFieldType.millisOfSecond(), millisOfSecond, 0, 999);

    return getDateMidnightMillis(year, monthOfYear, dayOfMonth)
        + hourOfDay * DateTimeConstants.MILLIS_PER_HOUR
        + minuteOfHour * DateTimeConstants.MILLIS_PER_MINUTE
        + secondOfMinute * DateTimeConstants.MILLIS_PER_SECOND
        + millisOfSecond;
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:22,代码来源:BasicChronology.java

示例2: set

import org.joda.time.field.FieldUtils; //导入方法依赖的package包/类
/**
 * Set the Month component of the specified time instant.<p>
 * If the new month has less total days than the specified
 * day of the month, this value is coerced to the nearest
 * sane value. e.g.<p>
 * 07-31 to month 6 = 06-30<p>
 * 03-31 to month 2 = 02-28 or 02-29 depending<p>
 * 
 * @param instant  the time instant in millis to update.
 * @param month  the month (1,12) to update the time to.
 * @return the updated time instant.
 * @throws IllegalArgumentException  if month is invalid
 */
public long set(long instant, int month) {
    FieldUtils.verifyValueBounds(this, month, MIN, iMax);
    //
    int thisYear = iChronology.getYear(instant);
    //
    int thisDom = iChronology.getDayOfMonth(instant, thisYear);
    int maxDom = iChronology.getDaysInYearMonth(thisYear, month);
    if (thisDom > maxDom) {
        // Quietly force DOM to nearest sane value.
        thisDom = maxDom;
    }
    // Return newly calculated millis value
    return iChronology.getYearMonthDayMillis(thisYear, month, thisDom) +
        iChronology.getMillisOfDay(instant);
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:29,代码来源:BasicMonthOfYearDateTimeField.java

示例3: set

import org.joda.time.field.FieldUtils; //导入方法依赖的package包/类
public long set(long instant, int year) {
    FieldUtils.verifyValueBounds(this, year, 0, getMaximumValue());
    if (getWrappedField().get(instant) < 0) {
        year = -year;
    }
    return super.set(instant, year);
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:8,代码来源:ISOYearOfEraDateTimeField.java

示例4: set

import org.joda.time.field.FieldUtils; //导入方法依赖的package包/类
/**
 * Set the Era component of the specified time instant.
 * 
 * @param instant  the time instant in millis to update.
 * @param era  the era to update the time to.
 * @return the updated time instant.
 * @throws IllegalArgumentException  if era is invalid.
 */
public long set(long instant, int era) {
    FieldUtils.verifyValueBounds(this, era, DateTimeConstants.BCE, DateTimeConstants.CE);
        
    int oldEra = get(instant);
    if (oldEra != era) {
        int year = iChronology.getYear(instant);
        return iChronology.setYear(instant, -year);
    } else {
        return instant;
    }
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:20,代码来源:GJEraDateTimeField.java

示例5: set

import org.joda.time.field.FieldUtils; //导入方法依赖的package包/类
/** @inheritDoc */
public long set(long instant, int era) {
    FieldUtils.verifyValueBounds(this, era, ERA_VALUE, ERA_VALUE);
    return instant;
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:6,代码来源:BasicSingleEraDateTimeField.java

示例6: set

import org.joda.time.field.FieldUtils; //导入方法依赖的package包/类
public long set(long instant, int year) {
    FieldUtils.verifyValueBounds
        (this, year, iChronology.getMinYear(), iChronology.getMaxYear());
    return iChronology.setYear(instant, year);
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:6,代码来源:BasicYearDateTimeField.java

示例7: getDateMidnightMillis

import org.joda.time.field.FieldUtils; //导入方法依赖的package包/类
/**
 * Gets the milliseconds for a date at midnight.
 * 
 * @param year  the year
 * @param monthOfYear  the month
 * @param dayOfMonth  the day
 * @return the milliseconds
 */
long getDateMidnightMillis(int year, int monthOfYear, int dayOfMonth) {
    FieldUtils.verifyValueBounds(DateTimeFieldType.year(), year, getMinYear(), getMaxYear());
    FieldUtils.verifyValueBounds(DateTimeFieldType.monthOfYear(), monthOfYear, 1, getMaxMonth(year));
    FieldUtils.verifyValueBounds(DateTimeFieldType.dayOfMonth(), dayOfMonth, 1, getDaysInYearMonth(year, monthOfYear));
    return getYearMonthDayMillis(year, monthOfYear, dayOfMonth);
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:15,代码来源:BasicChronology.java

示例8: set

import org.joda.time.field.FieldUtils; //导入方法依赖的package包/类
/**
 * Set the year component of the specified time instant.
 * 
 * @param instant  the time instant in millis to update.
 * @param year  the year (0,292278994) to update the time to.
 * @return the updated time instant.
 * @throws IllegalArgumentException  if year is invalid.
 */
public long set(long instant, int year) {
    FieldUtils.verifyValueBounds(this, year, 1, getMaximumValue());
    if (iChronology.getYear(instant) <= 0) {
        year = 1 - year;
    }
    return super.set(instant, year);
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:16,代码来源:GJYearOfEraDateTimeField.java


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