1 16 package org.joda.time.field; 17 18 import java.io.Serializable ; 19 import java.util.Locale ; 20 import org.joda.time.DateTimeField; 21 import org.joda.time.DateTimeFieldType; 22 import org.joda.time.DurationField; 23 import org.joda.time.ReadablePartial; 24 25 36 public class DelegatedDateTimeField extends DateTimeField implements Serializable { 37 38 39 private static final long serialVersionUID = -4730164440214502503L; 40 41 42 private final DateTimeField iField; 43 44 private final DateTimeFieldType iType; 45 46 51 public DelegatedDateTimeField(DateTimeField field) { 52 this(field, null); 53 } 54 55 61 public DelegatedDateTimeField(DateTimeField field, DateTimeFieldType type) { 62 super(); 63 if (field == null) { 64 throw new IllegalArgumentException ("The field must not be null"); 65 } 66 iField = field; 67 iType = (type == null ? field.getType() : type); 68 } 69 70 75 public final DateTimeField getWrappedField() { 76 return iField; 77 } 78 79 public DateTimeFieldType getType() { 80 return iType; 81 } 82 83 public String getName() { 84 return iType.getName(); 85 } 86 87 public boolean isSupported() { 88 return iField.isSupported(); 89 } 90 91 public boolean isLenient() { 92 return iField.isLenient(); 93 } 94 95 public int get(long instant) { 96 return iField.get(instant); 97 } 98 99 public String getAsText(long instant, Locale locale) { 100 return iField.getAsText(instant, locale); 101 } 102 103 public String getAsText(long instant) { 104 return iField.getAsText(instant); 105 } 106 107 public String getAsText(ReadablePartial partial, int fieldValue, Locale locale) { 108 return iField.getAsText(partial, fieldValue, locale); 109 } 110 111 public String getAsText(ReadablePartial partial, Locale locale) { 112 return iField.getAsText(partial, locale); 113 } 114 115 public String getAsText(int fieldValue, Locale locale) { 116 return iField.getAsText(fieldValue, locale); 117 } 118 119 public String getAsShortText(long instant, Locale locale) { 120 return iField.getAsShortText(instant, locale); 121 } 122 123 public String getAsShortText(long instant) { 124 return iField.getAsShortText(instant); 125 } 126 127 public String getAsShortText(ReadablePartial partial, int fieldValue, Locale locale) { 128 return iField.getAsShortText(partial, fieldValue, locale); 129 } 130 131 public String getAsShortText(ReadablePartial partial, Locale locale) { 132 return iField.getAsShortText(partial, locale); 133 } 134 135 public String getAsShortText(int fieldValue, Locale locale) { 136 return iField.getAsShortText(fieldValue, locale); 137 } 138 139 public long add(long instant, int value) { 140 return iField.add(instant, value); 141 } 142 143 public long add(long instant, long value) { 144 return iField.add(instant, value); 145 } 146 147 public int[] add(ReadablePartial instant, int fieldIndex, int[] values, int valueToAdd) { 148 return iField.add(instant, fieldIndex, values, valueToAdd); 149 } 150 151 public int[] addWrapPartial(ReadablePartial instant, int fieldIndex, int[] values, int valueToAdd) { 152 return iField.addWrapPartial(instant, fieldIndex, values, valueToAdd); 153 } 154 155 public long addWrapField(long instant, int value) { 156 return iField.addWrapField(instant, value); 157 } 158 159 public int[] addWrapField(ReadablePartial instant, int fieldIndex, int[] values, int valueToAdd) { 160 return iField.addWrapField(instant, fieldIndex, values, valueToAdd); 161 } 162 163 public int getDifference(long minuendInstant, long subtrahendInstant) { 164 return iField.getDifference(minuendInstant, subtrahendInstant); 165 } 166 167 public long getDifferenceAsLong(long minuendInstant, long subtrahendInstant) { 168 return iField.getDifferenceAsLong(minuendInstant, subtrahendInstant); 169 } 170 171 public long set(long instant, int value) { 172 return iField.set(instant, value); 173 } 174 175 public long set(long instant, String text, Locale locale) { 176 return iField.set(instant, text, locale); 177 } 178 179 public long set(long instant, String text) { 180 return iField.set(instant, text); 181 } 182 183 public int[] set(ReadablePartial instant, int fieldIndex, int[] values, int newValue) { 184 return iField.set(instant, fieldIndex, values, newValue); 185 } 186 187 public int[] set(ReadablePartial instant, int fieldIndex, int[] values, String text, Locale locale) { 188 return iField.set(instant, fieldIndex, values, text, locale); 189 } 190 191 public DurationField getDurationField() { 192 return iField.getDurationField(); 193 } 194 195 public DurationField getRangeDurationField() { 196 return iField.getRangeDurationField(); 197 } 198 199 public boolean isLeap(long instant) { 200 return iField.isLeap(instant); 201 } 202 203 public int getLeapAmount(long instant) { 204 return iField.getLeapAmount(instant); 205 } 206 207 public DurationField getLeapDurationField() { 208 return iField.getLeapDurationField(); 209 } 210 211 public int getMinimumValue() { 212 return iField.getMinimumValue(); 213 } 214 215 public int getMinimumValue(long instant) { 216 return iField.getMinimumValue(instant); 217 } 218 219 public int getMinimumValue(ReadablePartial instant) { 220 return iField.getMinimumValue(instant); 221 } 222 223 public int getMinimumValue(ReadablePartial instant, int[] values) { 224 return iField.getMinimumValue(instant, values); 225 } 226 227 public int getMaximumValue() { 228 return iField.getMaximumValue(); 229 } 230 231 public int getMaximumValue(long instant) { 232 return iField.getMaximumValue(instant); 233 } 234 235 public int getMaximumValue(ReadablePartial instant) { 236 return iField.getMaximumValue(instant); 237 } 238 239 public int getMaximumValue(ReadablePartial instant, int[] values) { 240 return iField.getMaximumValue(instant, values); 241 } 242 243 public int getMaximumTextLength(Locale locale) { 244 return iField.getMaximumTextLength(locale); 245 } 246 247 public int getMaximumShortTextLength(Locale locale) { 248 return iField.getMaximumShortTextLength(locale); 249 } 250 251 public long roundFloor(long instant) { 252 return iField.roundFloor(instant); 253 } 254 255 public long roundCeiling(long instant) { 256 return iField.roundCeiling(instant); 257 } 258 259 public long roundHalfFloor(long instant) { 260 return iField.roundHalfFloor(instant); 261 } 262 263 public long roundHalfCeiling(long instant) { 264 return iField.roundHalfCeiling(instant); 265 } 266 267 public long roundHalfEven(long instant) { 268 return iField.roundHalfEven(instant); 269 } 270 271 public long remainder(long instant) { 272 return iField.remainder(instant); 273 } 274 275 public String toString() { 276 return ("DateTimeField[" + getName() + ']'); 277 } 278 279 } 280 | Popular Tags |