1 16 package org.joda.time.chrono; 17 18 import java.util.Locale ; 19 20 import org.joda.time.DateTimeConstants; 21 import org.joda.time.DateTimeFieldType; 22 import org.joda.time.DurationField; 23 import org.joda.time.field.PreciseDurationDateTimeField; 24 25 34 final class GJDayOfWeekDateTimeField extends PreciseDurationDateTimeField { 35 36 37 private static final long serialVersionUID = -3857947176719041436L; 38 39 private final BasicChronology iChronology; 40 41 44 GJDayOfWeekDateTimeField(BasicChronology chronology, DurationField days) { 45 super(DateTimeFieldType.dayOfWeek(), days); 46 iChronology = chronology; 47 } 48 49 55 public int get(long instant) { 56 return iChronology.getDayOfWeek(instant); 57 } 58 59 66 public String getAsText(int fieldValue, Locale locale) { 67 return GJLocaleSymbols.forLocale(locale).dayOfWeekValueToText(fieldValue); 68 } 69 70 77 public String getAsShortText(int fieldValue, Locale locale) { 78 return GJLocaleSymbols.forLocale(locale).dayOfWeekValueToShortText(fieldValue); 79 } 80 81 89 protected int convertText(String text, Locale locale) { 90 return GJLocaleSymbols.forLocale(locale).dayOfWeekTextToValue(text); 91 } 92 93 public DurationField getRangeDurationField() { 94 return iChronology.weeks(); 95 } 96 97 102 public int getMinimumValue() { 103 return DateTimeConstants.MONDAY; 104 } 105 106 111 public int getMaximumValue() { 112 return DateTimeConstants.SUNDAY; 113 } 114 115 121 public int getMaximumTextLength(Locale locale) { 122 return GJLocaleSymbols.forLocale(locale).getDayOfWeekMaxTextLength(); 123 } 124 125 131 public int getMaximumShortTextLength(Locale locale) { 132 return GJLocaleSymbols.forLocale(locale).getDayOfWeekMaxShortTextLength(); 133 } 134 135 138 private Object readResolve() { 139 return iChronology.dayOfWeek(); 140 } 141 } 142 | Popular Tags |