org.joda.time.YearMonth.getChronology()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(9.7k)|赞(0)|评价(0)|浏览(149)

本文整理了Java中org.joda.time.YearMonth.getChronology()方法的一些代码示例,展示了YearMonth.getChronology()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YearMonth.getChronology()方法的具体详情如下:
包路径:org.joda.time.YearMonth
类名称:YearMonth
方法名:getChronology

YearMonth.getChronology介绍

暂无

代码示例

代码示例来源:origin: joda-time/joda-time

/**
 * Converts this object to a LocalDate with the same year-month and chronology.
 *
 * @param dayOfMonth the day of month to use, valid for chronology, such as 1-31 for ISO
 * @return a LocalDate with the same year-month and chronology, never null
 */
public LocalDate toLocalDate(int dayOfMonth) {
  return new LocalDate(getYear(), getMonthOfYear(), dayOfMonth, getChronology());
}

代码示例来源:origin: JodaOrg/joda-time

/**
 * Converts this object to a LocalDate with the same year-month and chronology.
 *
 * @param dayOfMonth the day of month to use, valid for chronology, such as 1-31 for ISO
 * @return a LocalDate with the same year-month and chronology, never null
 */
public LocalDate toLocalDate(int dayOfMonth) {
  return new LocalDate(getYear(), getMonthOfYear(), dayOfMonth, getChronology());
}

代码示例来源:origin: joda-time/joda-time

/**
 * Handle broken serialization from other tools.
 * @return the resolved object, not null
 */
private Object readResolve() {
  if (DateTimeZone.UTC.equals(getChronology().getZone()) == false) {
    return new YearMonth(this, getChronology().withUTC());
  }
  return this;
}

代码示例来源:origin: JodaOrg/joda-time

/**
 * Handle broken serialization from other tools.
 * @return the resolved object, not null
 */
private Object readResolve() {
  if (DateTimeZone.UTC.equals(getChronology().getZone()) == false) {
    return new YearMonth(this, getChronology().withUTC());
  }
  return this;
}

代码示例来源:origin: joda-time/joda-time

/**
 * Returns a copy of this year-month with the month of year field updated.
 * <p>
 * YearMonth is immutable, so there are no set methods.
 * Instead, this method returns a new instance with the value of
 * month of year changed.
 *
 * @param monthOfYear  the month of year to set
 * @return a copy of this object with the field set, never null
 * @throws IllegalArgumentException if the value is invalid
 */
public YearMonth withMonthOfYear(int monthOfYear) {
  int[] newValues = getValues();
  newValues = getChronology().monthOfYear().set(this, MONTH_OF_YEAR, newValues, monthOfYear);
  return new YearMonth(this, newValues);
}

代码示例来源:origin: joda-time/joda-time

/**
 * Returns a copy of this year-month with the year field updated.
 * <p>
 * YearMonth is immutable, so there are no set methods.
 * Instead, this method returns a new instance with the value of
 * year changed.
 *
 * @param year  the year to set
 * @return a copy of this object with the field set, never null
 * @throws IllegalArgumentException if the value is invalid
 */
public YearMonth withYear(int year) {
  int[] newValues = getValues();
  newValues = getChronology().year().set(this, YEAR, newValues, year);
  return new YearMonth(this, newValues);
}

代码示例来源:origin: JodaOrg/joda-time

/**
 * Returns a copy of this year-month with the year field updated.
 * <p>
 * YearMonth is immutable, so there are no set methods.
 * Instead, this method returns a new instance with the value of
 * year changed.
 *
 * @param year  the year to set
 * @return a copy of this object with the field set, never null
 * @throws IllegalArgumentException if the value is invalid
 */
public YearMonth withYear(int year) {
  int[] newValues = getValues();
  newValues = getChronology().year().set(this, YEAR, newValues, year);
  return new YearMonth(this, newValues);
}

代码示例来源:origin: JodaOrg/joda-time

/**
 * Returns a copy of this year-month with the month of year field updated.
 * <p>
 * YearMonth is immutable, so there are no set methods.
 * Instead, this method returns a new instance with the value of
 * month of year changed.
 *
 * @param monthOfYear  the month of year to set
 * @return a copy of this object with the field set, never null
 * @throws IllegalArgumentException if the value is invalid
 */
public YearMonth withMonthOfYear(int monthOfYear) {
  int[] newValues = getValues();
  newValues = getChronology().monthOfYear().set(this, MONTH_OF_YEAR, newValues, monthOfYear);
  return new YearMonth(this, newValues);
}

代码示例来源:origin: joda-time/joda-time

/**
 * Returns a copy of this year-month with the specified chronology.
 * This instance is immutable and unaffected by this method call.
 * <p>
 * This method retains the values of the fields, thus the result will
 * typically refer to a different instant.
 * <p>
 * The time zone of the specified chronology is ignored, as YearMonth
 * operates without a time zone.
 *
 * @param newChronology  the new chronology, null means ISO
 * @return a copy of this year-month with a different chronology, never null
 * @throws IllegalArgumentException if the values are invalid for the new chronology
 */
public YearMonth withChronologyRetainFields(Chronology newChronology) {
  newChronology = DateTimeUtils.getChronology(newChronology);
  newChronology = newChronology.withUTC();
  if (newChronology == getChronology()) {
    return this;
  } else {
    YearMonth newYearMonth = new YearMonth(this, newChronology);
    newChronology.validate(newYearMonth, getValues());
    return newYearMonth;
  }
}

代码示例来源:origin: JodaOrg/joda-time

/**
 * Returns a copy of this year-month with the specified chronology.
 * This instance is immutable and unaffected by this method call.
 * <p>
 * This method retains the values of the fields, thus the result will
 * typically refer to a different instant.
 * <p>
 * The time zone of the specified chronology is ignored, as YearMonth
 * operates without a time zone.
 *
 * @param newChronology  the new chronology, null means ISO
 * @return a copy of this year-month with a different chronology, never null
 * @throws IllegalArgumentException if the values are invalid for the new chronology
 */
public YearMonth withChronologyRetainFields(Chronology newChronology) {
  newChronology = DateTimeUtils.getChronology(newChronology);
  newChronology = newChronology.withUTC();
  if (newChronology == getChronology()) {
    return this;
  } else {
    YearMonth newYearMonth = new YearMonth(this, newChronology);
    newChronology.validate(newYearMonth, getValues());
    return newYearMonth;
  }
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Converts this object to a LocalDate with the same year-month and chronology.
 *
 * @param dayOfMonth the day of month to use, valid for chronology, such as 1-31 for ISO
 * @return a LocalDate with the same year-month and chronology, never null
 */
public LocalDate toLocalDate(int dayOfMonth) {
  return new LocalDate(getYear(), getMonthOfYear(), dayOfMonth, getChronology());
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Handle broken serialization from other tools.
 * @return the resolved object, not null
 */
private Object readResolve() {
  if (DateTimeZone.UTC.equals(getChronology().getZone()) == false) {
    return new YearMonth(this, getChronology().withUTC());
  }
  return this;
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Returns a copy of this year-month with the month of year field updated.
 * <p>
 * YearMonth is immutable, so there are no set methods.
 * Instead, this method returns a new instance with the value of
 * month of year changed.
 *
 * @param monthOfYear  the month of year to set
 * @return a copy of this object with the field set, never null
 * @throws IllegalArgumentException if the value is invalid
 */
public YearMonth withMonthOfYear(int monthOfYear) {
  int[] newValues = getValues();
  newValues = getChronology().monthOfYear().set(this, MONTH_OF_YEAR, newValues, monthOfYear);
  return new YearMonth(this, newValues);
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Returns a copy of this year-month with the year field updated.
 * <p>
 * YearMonth is immutable, so there are no set methods.
 * Instead, this method returns a new instance with the value of
 * year changed.
 *
 * @param year  the year to set
 * @return a copy of this object with the field set, never null
 * @throws IllegalArgumentException if the value is invalid
 */
public YearMonth withYear(int year) {
  int[] newValues = getValues();
  newValues = getChronology().year().set(this, YEAR, newValues, year);
  return new YearMonth(this, newValues);
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Returns a copy of this year-month with the specified chronology.
 * This instance is immutable and unaffected by this method call.
 * <p>
 * This method retains the values of the fields, thus the result will
 * typically refer to a different instant.
 * <p>
 * The time zone of the specified chronology is ignored, as YearMonth
 * operates without a time zone.
 *
 * @param newChronology  the new chronology, null means ISO
 * @return a copy of this year-month with a different chronology, never null
 * @throws IllegalArgumentException if the values are invalid for the new chronology
 */
public YearMonth withChronologyRetainFields(Chronology newChronology) {
  newChronology = DateTimeUtils.getChronology(newChronology);
  newChronology = newChronology.withUTC();
  if (newChronology == getChronology()) {
    return this;
  } else {
    YearMonth newYearMonth = new YearMonth(this, newChronology);
    newChronology.validate(newYearMonth, getValues());
    return newYearMonth;
  }
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

/**
 * Converts this object to a LocalDate with the same year-month and chronology.
 *
 * @param dayOfMonth the day of month to use, valid for chronology, such as 1-31 for ISO
 * @return a LocalDate with the same year-month and chronology, never null
 */
public LocalDate toLocalDate(int dayOfMonth) {
  return new LocalDate(getYear(), getMonthOfYear(), dayOfMonth, getChronology());
}

代码示例来源:origin: Nextdoor/bender

/**
 * Converts this object to a LocalDate with the same year-month and chronology.
 *
 * @param dayOfMonth the day of month to use, valid for chronology, such as 1-31 for ISO
 * @return a LocalDate with the same year-month and chronology, never null
 */
public LocalDate toLocalDate(int dayOfMonth) {
  return new LocalDate(getYear(), getMonthOfYear(), dayOfMonth, getChronology());
}

代码示例来源:origin: redfish64/TinyTravelTracker

/**
 * Converts this object to a LocalDate with the same year-month and chronology.
 *
 * @param dayOfMonth the day of month to use, valid for chronology, such as 1-31 for ISO
 * @return a LocalDate with the same year-month and chronology, never null
 */
public LocalDate toLocalDate(int dayOfMonth) {
  return new LocalDate(getYear(), getMonthOfYear(), dayOfMonth, getChronology());
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

/**
 * Converts this object to a LocalDate with the same year-month and chronology.
 *
 * @param dayOfMonth the day of month to use, valid for chronology, such as 1-31 for ISO
 * @return a LocalDate with the same year-month and chronology, never null
 */
public LocalDate toLocalDate(int dayOfMonth) {
  return new LocalDate(getYear(), getMonthOfYear(), dayOfMonth, getChronology());
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

/**
 * Handle broken serialization from other tools.
 * @return the resolved object, not null
 */
private Object readResolve() {
  if (DateTimeZone.UTC.equals(getChronology().getZone()) == false) {
    return new YearMonth(this, getChronology().withUTC());
  }
  return this;
}

相关文章