示例#1
0
 /**
  * Round to the nearest whole unit of this field. If halfway, the ceiling is favored over the
  * floor only if it makes this field's value even.
  *
  * @return the mutable datetime being used, so calls can be chained
  * @see DateTimeField#roundHalfEven
  */
 public MutableDateTime roundHalfEven() {
   iInstant.setMillis(getField().roundHalfEven(iInstant.getMillis()));
   return iInstant;
 }
示例#2
0
 /**
  * Sets a text value.
  *
  * @param text the text value to set
  * @param locale optional locale to use for selecting a text symbol
  * @return the mutable datetime being used, so calls can be chained
  * @throws IllegalArgumentException if the text value isn't valid
  * @see DateTimeField#set(long,java.lang.String,java.util.Locale)
  */
 public MutableDateTime set(String text, Locale locale) {
   iInstant.setMillis(getField().set(iInstant.getMillis(), text, locale));
   return iInstant;
 }
示例#3
0
 /**
  * Round to the highest whole unit of this field.
  *
  * @return the mutable datetime being used, so calls can be chained
  * @see DateTimeField#roundCeiling
  */
 public MutableDateTime roundCeiling() {
   iInstant.setMillis(getField().roundCeiling(iInstant.getMillis()));
   return iInstant;
 }
示例#4
0
 /**
  * Sets a value.
  *
  * @param value the value to set.
  * @return the mutable datetime being used, so calls can be chained
  * @see DateTimeField#set(long,int)
  */
 public MutableDateTime set(int value) {
   iInstant.setMillis(getField().set(iInstant.getMillis(), value));
   return iInstant;
 }
示例#5
0
 /**
  * Adds a value to the millis value.
  *
  * @param value the value to add
  * @return the mutable datetime being used, so calls can be chained
  * @see DateTimeField#add(long,long)
  */
 public MutableDateTime add(long value) {
   iInstant.setMillis(getField().add(iInstant.getMillis(), value));
   return iInstant;
 }
示例#6
0
 /**
  * Gets the chronology of the datetime that this property is linked to.
  *
  * @return the chronology
  * @since 1.4
  */
 protected Chronology getChronology() {
   return iInstant.getChronology();
 }
示例#7
0
 /**
  * Gets the milliseconds of the datetime that this property is linked to.
  *
  * @return the milliseconds
  */
 protected long getMillis() {
   return iInstant.getMillis();
 }
示例#8
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());
 }