當前位置: 首頁>>代碼示例>>Java>>正文


Java DateTimeUtils.getChronology方法代碼示例

本文整理匯總了Java中org.joda.time.DateTimeUtils.getChronology方法的典型用法代碼示例。如果您正苦於以下問題:Java DateTimeUtils.getChronology方法的具體用法?Java DateTimeUtils.getChronology怎麽用?Java DateTimeUtils.getChronology使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.joda.time.DateTimeUtils的用法示例。


在下文中一共展示了DateTimeUtils.getChronology方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: BasePeriod

import org.joda.time.DateTimeUtils; //導入方法依賴的package包/類
/**
 * Creates a new period based on another using the {@link ConverterManager}.
 *
 * @param period  the period to convert
 * @param type  which set of fields this period supports, null means use type from object
 * @param chrono  the chronology to use, null means ISO default
 * @throws IllegalArgumentException if period is invalid
 * @throws IllegalArgumentException if an unsupported field's value is non-zero
 */
protected BasePeriod(Object period, PeriodType type, Chronology chrono) {
    super();
    PeriodConverter converter = ConverterManager.getInstance().getPeriodConverter(period);
    type = (type == null ? converter.getPeriodType(period) : type);
    type = checkPeriodType(type);
    iType = type;
    if (this instanceof ReadWritablePeriod) {
        iValues = new int[size()];
        chrono = DateTimeUtils.getChronology(chrono);
        converter.setInto((ReadWritablePeriod) this, period, chrono);
    } else {
        iValues = new MutablePeriod(period, type, chrono).getValues();
    }
}
 
開發者ID:redfish64,項目名稱:TinyTravelTracker,代碼行數:24,代碼來源:BasePeriod.java

示例2: selectChronology

import org.joda.time.DateTimeUtils; //導入方法依賴的package包/類
/**
 * Determines the correct chronology to use.
 *
 * @param chrono  the proposed chronology
 * @return the actual chronology
 */
private Chronology selectChronology(Chronology chrono) {
    chrono = DateTimeUtils.getChronology(chrono);
    if (iChrono != null) {
        chrono = iChrono;
    }
    if (iZone != null) {
        chrono = chrono.withZone(iZone);
    }
    return chrono;
}
 
開發者ID:redfish64,項目名稱:TinyTravelTracker,代碼行數:17,代碼來源:DateTimeFormatter.java

示例3: DateTimeParserBucket

import org.joda.time.DateTimeUtils; //導入方法依賴的package包/類
/**
 * Constructs a bucket, with the option of specifying the pivot year for
 * two-digit year parsing.
 *
 * @param instantLocal  the initial millis from 1970-01-01T00:00:00, local time
 * @param chrono  the chronology to use
 * @param locale  the locale to use
 * @param pivotYear  the pivot year to use when parsing two-digit years
 * @since 2.0
 */
public DateTimeParserBucket(long instantLocal, Chronology chrono,
        Locale locale, Integer pivotYear, int defaultYear) {
    super();
    chrono = DateTimeUtils.getChronology(chrono);
    iMillis = instantLocal;
    iZone = chrono.getZone();
    iChrono = chrono.withUTC();
    iLocale = (locale == null ? Locale.getDefault() : locale);
    iPivotYear = pivotYear;
    iDefaultYear = defaultYear;
}
 
開發者ID:redfish64,項目名稱:TinyTravelTracker,代碼行數:22,代碼來源:DateTimeParserBucket.java

示例4: selectChronology

import org.joda.time.DateTimeUtils; //導入方法依賴的package包/類
private Chronology selectChronology() {
    Chronology chrono = DateTimeUtils.getChronology(null);
    if (getChronolgy() != null) {
        chrono = getChronolgy();
    }
    if (getZone() != null) {
        chrono = chrono.withZone(getZone());
    }
    return chrono;
}
 
開發者ID:KRMAssociatesInc,項目名稱:eHMP,代碼行數:11,代碼來源:PointInTimeFormatter.java

示例5: BaseInterval

import org.joda.time.DateTimeUtils; //導入方法依賴的package包/類
/**
 * Constructs an interval from a start and end instant.
 * 
 * @param startInstant  start of this interval, as milliseconds from 1970-01-01T00:00:00Z.
 * @param endInstant  end of this interval, as milliseconds from 1970-01-01T00:00:00Z.
 * @param chrono  the chronology to use, null is ISO default
 * @throws IllegalArgumentException if the end is before the start
 */
protected BaseInterval(long startInstant, long endInstant, Chronology chrono) {
    super();
    iChronology = DateTimeUtils.getChronology(chrono);
    checkInterval(startInstant, endInstant);
    iStartMillis = startInstant;
    iEndMillis = endInstant;
}
 
開發者ID:redfish64,項目名稱:TinyTravelTracker,代碼行數:16,代碼來源:BaseInterval.java

示例6: setInterval

import org.joda.time.DateTimeUtils; //導入方法依賴的package包/類
/**
 * Sets this interval from two millisecond instants and a chronology.
 *
 * @param startInstant  the start of the time interval
 * @param endInstant  the start of the time interval
 * @param chrono  the chronology, not null
 * @throws IllegalArgumentException if the end is before the start
 */
protected void setInterval(long startInstant, long endInstant, Chronology chrono) {
    checkInterval(startInstant, endInstant);
    iStartMillis = startInstant;
    iEndMillis = endInstant;
    iChronology = DateTimeUtils.getChronology(chrono);
}
 
開發者ID:redfish64,項目名稱:TinyTravelTracker,代碼行數:15,代碼來源:BaseInterval.java

示例7: BasePartial

import org.joda.time.DateTimeUtils; //導入方法依賴的package包/類
/**
 * Constructs a partial extracting the partial fields from the specified
 * milliseconds using the chronology provided.
 * <p>
 * The constructor uses the time zone of the chronology specified.
 * Once the constructor is complete, all further calculations are performed
 * without reference to a timezone (by switching to UTC).
 *
 * @param instant  the milliseconds from 1970-01-01T00:00:00Z
 * @param chronology  the chronology, null means ISOChronology in the default zone
 */
protected BasePartial(long instant, Chronology chronology) {
    super();
    chronology = DateTimeUtils.getChronology(chronology);
    iChronology = chronology.withUTC();
    iValues = chronology.get(this, instant);
}
 
開發者ID:redfish64,項目名稱:TinyTravelTracker,代碼行數:18,代碼來源:BasePartial.java

示例8: getChronology

import org.joda.time.DateTimeUtils; //導入方法依賴的package包/類
/**
 * Gets the chronology, which is taken from the ReadableInstant.
 * <p>
 * If the passed in chronology is non-null, it is used.
 * Otherwise the chronology from the instant is used.
 * 
 * @param object  the ReadablePartial to convert, must not be null
 * @param chrono  the chronology to use, null means use that from object
 * @return the chronology, never null
 */
public Chronology getChronology(Object object, Chronology chrono) {
    if (chrono == null) {
        chrono = ((ReadablePartial) object).getChronology();
        chrono = DateTimeUtils.getChronology(chrono);
    }
    return chrono;
}
 
開發者ID:redfish64,項目名稱:TinyTravelTracker,代碼行數:18,代碼來源:ReadablePartialConverter.java

示例9: getChronology

import org.joda.time.DateTimeUtils; //導入方法依賴的package包/類
/**
 * Gets the chronology, which is taken from the ReadableInstant.
 * <p>
 * If the passed in chronology is non-null, it is used.
 * Otherwise the chronology from the instant is used.
 * 
 * @param object  the ReadableInstant to convert, must not be null
 * @param chrono  the chronology to use, null means use that from object
 * @return the chronology, never null
 */
public Chronology getChronology(Object object, Chronology chrono) {
    if (chrono == null) {
        chrono = ((ReadableInstant) object).getChronology();
        chrono = DateTimeUtils.getChronology(chrono);
    }
    return chrono;
}
 
開發者ID:redfish64,項目名稱:TinyTravelTracker,代碼行數:18,代碼來源:ReadableInstantConverter.java

示例10: setInto

import org.joda.time.DateTimeUtils; //導入方法依賴的package包/類
/**
 * Extracts duration values from an object of this converter's type, and
 * sets them into the given ReadWritableDuration.
 *
 * @param writablePeriod  period to get modified
 * @param object  the object to convert, must not be null
 * @param chrono  the chronology to use, must not be null
 * @throws NullPointerException if the duration or object is null
 * @throws ClassCastException if the object is an invalid type
 * @throws IllegalArgumentException if the object is invalid
 */
public void setInto(ReadWritablePeriod writablePeriod, Object object, Chronology chrono) {
    ReadableDuration dur = (ReadableDuration) object;
    chrono = DateTimeUtils.getChronology(chrono);
    long duration = dur.getMillis();
    int[] values = chrono.get(writablePeriod, duration);
    for (int i = 0; i < values.length; i++) {
        writablePeriod.setValue(i, values[i]);
    }
}
 
開發者ID:redfish64,項目名稱:TinyTravelTracker,代碼行數:21,代碼來源:ReadableDurationConverter.java

示例11: checkChronology

import org.joda.time.DateTimeUtils; //導入方法依賴的package包/類
/**
 * Checks the specified chronology before storing it, potentially altering it.
 * This method must not access any instance variables.
 * <p>
 * This implementation converts nulls to ISOChronology in the default zone.
 *
 * @param chronology the chronology to use, may be null
 * @return the chronology to store in this datetime, not null
 */
protected Chronology checkChronology(Chronology chronology) {
    return DateTimeUtils.getChronology(chronology);
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:13,代碼來源:BaseDateTime.java

示例12: checkChronology

import org.joda.time.DateTimeUtils; //導入方法依賴的package包/類
/**
 * Checks the specified chronology before storing it, potentially altering it.
 * This method must not access any instance variables.
 * <p>
 * This implementation converts nulls to ISOChronology in the default zone.
 *
 * @param chronology  the chronology to use, may be null
 * @return the chronology to store in this datetime, not null
 */
protected Chronology checkChronology(Chronology chronology) {
    return DateTimeUtils.getChronology(chronology);
}
 
開發者ID:redfish64,項目名稱:TinyTravelTracker,代碼行數:13,代碼來源:BaseDateTime.java

示例13: toDateTime

import org.joda.time.DateTimeUtils; //導入方法依賴的package包/類
/**
 * Get this object as a DateTime using the same chronology but a different zone.
 * 
 * @param zone time zone to apply, or default if null
 * @return a DateTime using the same millis
 */
public DateTime toDateTime(DateTimeZone zone) {
    Chronology chrono = DateTimeUtils.getChronology(getChronology());
    chrono = chrono.withZone(zone);
    return new DateTime(getMillis(), chrono);
}
 
開發者ID:redfish64,項目名稱:TinyTravelTracker,代碼行數:12,代碼來源:AbstractInstant.java

示例14: toMutableDateTime

import org.joda.time.DateTimeUtils; //導入方法依賴的package包/類
/**
 * Get this object as a MutableDateTime using the same chronology but a different zone.
 * 
 * @param zone time zone to apply, or default if null
 * @return a MutableDateTime using the same millis
 */
public MutableDateTime toMutableDateTime(DateTimeZone zone) {
    Chronology chrono = DateTimeUtils.getChronology(getChronology());
    chrono = chrono.withZone(zone);
    return new MutableDateTime(getMillis(), chrono);
}
 
開發者ID:redfish64,項目名稱:TinyTravelTracker,代碼行數:12,代碼來源:AbstractInstant.java

示例15: getChronology

import org.joda.time.DateTimeUtils; //導入方法依賴的package包/類
/**
 * Extracts the chronology from an object of this convertor's type
 * where the chronology is specified.
 * <p>
 * This implementation returns the chronology specified, or the
 * ISO chronology in the default zone if null passed in.
 * 
 * @param object  the object to convert
 * @param chrono  the chronology to use, null means ISO default
 * @return the chronology, never null
 */
public Chronology getChronology(Object object, Chronology chrono) {
    return DateTimeUtils.getChronology(chrono);
}
 
開發者ID:redfish64,項目名稱:TinyTravelTracker,代碼行數:15,代碼來源:AbstractConverter.java


注:本文中的org.joda.time.DateTimeUtils.getChronology方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。