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

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

本文整理了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

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

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

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

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

  1. /**
  2. * Handle broken serialization from other tools.
  3. * @return the resolved object, not null
  4. */
  5. private Object readResolve() {
  6. if (DateTimeZone.UTC.equals(getChronology().getZone()) == false) {
  7. return new YearMonth(this, getChronology().withUTC());
  8. }
  9. return this;
  10. }

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

  1. /**
  2. * Handle broken serialization from other tools.
  3. * @return the resolved object, not null
  4. */
  5. private Object readResolve() {
  6. if (DateTimeZone.UTC.equals(getChronology().getZone()) == false) {
  7. return new YearMonth(this, getChronology().withUTC());
  8. }
  9. return this;
  10. }

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

  1. /**
  2. * Returns a copy of this year-month with the month of year field updated.
  3. * <p>
  4. * YearMonth is immutable, so there are no set methods.
  5. * Instead, this method returns a new instance with the value of
  6. * month of year changed.
  7. *
  8. * @param monthOfYear the month of year to set
  9. * @return a copy of this object with the field set, never null
  10. * @throws IllegalArgumentException if the value is invalid
  11. */
  12. public YearMonth withMonthOfYear(int monthOfYear) {
  13. int[] newValues = getValues();
  14. newValues = getChronology().monthOfYear().set(this, MONTH_OF_YEAR, newValues, monthOfYear);
  15. return new YearMonth(this, newValues);
  16. }

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

  1. /**
  2. * Returns a copy of this year-month with the year field updated.
  3. * <p>
  4. * YearMonth is immutable, so there are no set methods.
  5. * Instead, this method returns a new instance with the value of
  6. * year changed.
  7. *
  8. * @param year the year to set
  9. * @return a copy of this object with the field set, never null
  10. * @throws IllegalArgumentException if the value is invalid
  11. */
  12. public YearMonth withYear(int year) {
  13. int[] newValues = getValues();
  14. newValues = getChronology().year().set(this, YEAR, newValues, year);
  15. return new YearMonth(this, newValues);
  16. }

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

  1. /**
  2. * Returns a copy of this year-month with the year field updated.
  3. * <p>
  4. * YearMonth is immutable, so there are no set methods.
  5. * Instead, this method returns a new instance with the value of
  6. * year changed.
  7. *
  8. * @param year the year to set
  9. * @return a copy of this object with the field set, never null
  10. * @throws IllegalArgumentException if the value is invalid
  11. */
  12. public YearMonth withYear(int year) {
  13. int[] newValues = getValues();
  14. newValues = getChronology().year().set(this, YEAR, newValues, year);
  15. return new YearMonth(this, newValues);
  16. }

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

  1. /**
  2. * Returns a copy of this year-month with the month of year field updated.
  3. * <p>
  4. * YearMonth is immutable, so there are no set methods.
  5. * Instead, this method returns a new instance with the value of
  6. * month of year changed.
  7. *
  8. * @param monthOfYear the month of year to set
  9. * @return a copy of this object with the field set, never null
  10. * @throws IllegalArgumentException if the value is invalid
  11. */
  12. public YearMonth withMonthOfYear(int monthOfYear) {
  13. int[] newValues = getValues();
  14. newValues = getChronology().monthOfYear().set(this, MONTH_OF_YEAR, newValues, monthOfYear);
  15. return new YearMonth(this, newValues);
  16. }

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

  1. /**
  2. * Returns a copy of this year-month with the specified chronology.
  3. * This instance is immutable and unaffected by this method call.
  4. * <p>
  5. * This method retains the values of the fields, thus the result will
  6. * typically refer to a different instant.
  7. * <p>
  8. * The time zone of the specified chronology is ignored, as YearMonth
  9. * operates without a time zone.
  10. *
  11. * @param newChronology the new chronology, null means ISO
  12. * @return a copy of this year-month with a different chronology, never null
  13. * @throws IllegalArgumentException if the values are invalid for the new chronology
  14. */
  15. public YearMonth withChronologyRetainFields(Chronology newChronology) {
  16. newChronology = DateTimeUtils.getChronology(newChronology);
  17. newChronology = newChronology.withUTC();
  18. if (newChronology == getChronology()) {
  19. return this;
  20. } else {
  21. YearMonth newYearMonth = new YearMonth(this, newChronology);
  22. newChronology.validate(newYearMonth, getValues());
  23. return newYearMonth;
  24. }
  25. }

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

  1. /**
  2. * Returns a copy of this year-month with the specified chronology.
  3. * This instance is immutable and unaffected by this method call.
  4. * <p>
  5. * This method retains the values of the fields, thus the result will
  6. * typically refer to a different instant.
  7. * <p>
  8. * The time zone of the specified chronology is ignored, as YearMonth
  9. * operates without a time zone.
  10. *
  11. * @param newChronology the new chronology, null means ISO
  12. * @return a copy of this year-month with a different chronology, never null
  13. * @throws IllegalArgumentException if the values are invalid for the new chronology
  14. */
  15. public YearMonth withChronologyRetainFields(Chronology newChronology) {
  16. newChronology = DateTimeUtils.getChronology(newChronology);
  17. newChronology = newChronology.withUTC();
  18. if (newChronology == getChronology()) {
  19. return this;
  20. } else {
  21. YearMonth newYearMonth = new YearMonth(this, newChronology);
  22. newChronology.validate(newYearMonth, getValues());
  23. return newYearMonth;
  24. }
  25. }

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

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

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

  1. /**
  2. * Handle broken serialization from other tools.
  3. * @return the resolved object, not null
  4. */
  5. private Object readResolve() {
  6. if (DateTimeZone.UTC.equals(getChronology().getZone()) == false) {
  7. return new YearMonth(this, getChronology().withUTC());
  8. }
  9. return this;
  10. }

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

  1. /**
  2. * Returns a copy of this year-month with the month of year field updated.
  3. * <p>
  4. * YearMonth is immutable, so there are no set methods.
  5. * Instead, this method returns a new instance with the value of
  6. * month of year changed.
  7. *
  8. * @param monthOfYear the month of year to set
  9. * @return a copy of this object with the field set, never null
  10. * @throws IllegalArgumentException if the value is invalid
  11. */
  12. public YearMonth withMonthOfYear(int monthOfYear) {
  13. int[] newValues = getValues();
  14. newValues = getChronology().monthOfYear().set(this, MONTH_OF_YEAR, newValues, monthOfYear);
  15. return new YearMonth(this, newValues);
  16. }

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

  1. /**
  2. * Returns a copy of this year-month with the year field updated.
  3. * <p>
  4. * YearMonth is immutable, so there are no set methods.
  5. * Instead, this method returns a new instance with the value of
  6. * year changed.
  7. *
  8. * @param year the year to set
  9. * @return a copy of this object with the field set, never null
  10. * @throws IllegalArgumentException if the value is invalid
  11. */
  12. public YearMonth withYear(int year) {
  13. int[] newValues = getValues();
  14. newValues = getChronology().year().set(this, YEAR, newValues, year);
  15. return new YearMonth(this, newValues);
  16. }

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

  1. /**
  2. * Returns a copy of this year-month with the specified chronology.
  3. * This instance is immutable and unaffected by this method call.
  4. * <p>
  5. * This method retains the values of the fields, thus the result will
  6. * typically refer to a different instant.
  7. * <p>
  8. * The time zone of the specified chronology is ignored, as YearMonth
  9. * operates without a time zone.
  10. *
  11. * @param newChronology the new chronology, null means ISO
  12. * @return a copy of this year-month with a different chronology, never null
  13. * @throws IllegalArgumentException if the values are invalid for the new chronology
  14. */
  15. public YearMonth withChronologyRetainFields(Chronology newChronology) {
  16. newChronology = DateTimeUtils.getChronology(newChronology);
  17. newChronology = newChronology.withUTC();
  18. if (newChronology == getChronology()) {
  19. return this;
  20. } else {
  21. YearMonth newYearMonth = new YearMonth(this, newChronology);
  22. newChronology.validate(newYearMonth, getValues());
  23. return newYearMonth;
  24. }
  25. }

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

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

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

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

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

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

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

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

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

  1. /**
  2. * Handle broken serialization from other tools.
  3. * @return the resolved object, not null
  4. */
  5. private Object readResolve() {
  6. if (DateTimeZone.UTC.equals(getChronology().getZone()) == false) {
  7. return new YearMonth(this, getChronology().withUTC());
  8. }
  9. return this;
  10. }

相关文章