Beispiel #1
0
 /**
  * Gets the property object for the specified type, which contains many useful methods.
  *
  * @param type the field type to get the chronology for
  * @return the property object
  * @throws IllegalArgumentException if the field is null or unsupported
  * @since 1.2
  */
 public Property property(DateTimeFieldType type) {
   if (type == null) {
     throw new IllegalArgumentException("The DateTimeFieldType must not be null");
   }
   DateTimeField field = type.getField(getChronology());
   if (field.isSupported() == false) {
     throw new IllegalArgumentException("Field '" + type + "' is not supported");
   }
   return new Property(this, field);
 }
Beispiel #2
0
 /**
  * Sets the value of one of the fields of the instant, such as hourOfDay.
  *
  * @param type a field type, usually obtained from DateTimeFieldType, not null
  * @param value the value to set the field to
  * @throws IllegalArgumentException if the value is null or invalid
  */
 public void set(DateTimeFieldType type, int value) {
   if (type == null) {
     throw new IllegalArgumentException("Field must not be null");
   }
   setMillis(type.getField(getChronology()).set(getMillis(), value));
 }
Beispiel #3
0
 /** Reads the property from a safe serialization format. */
 private void readObject(ObjectInputStream oos) throws IOException, ClassNotFoundException {
   iInstant = (MutableDateTime) oos.readObject();
   DateTimeFieldType type = (DateTimeFieldType) oos.readObject();
   iField = type.getField(iInstant.getChronology());
 }