/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * Gets the chronology of the datetime that this property is linked to. * * @return the chronology * @since 1.4 */ protected Chronology getChronology() { return iInstant.getChronology(); }
/** * Gets the milliseconds of the datetime that this property is linked to. * * @return the milliseconds */ protected long getMillis() { return iInstant.getMillis(); }
/** 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()); }