List of usage examples for org.joda.time Chronology validate
public abstract void validate(ReadablePartial partial, int[] values);
From source file:net.sourceforge.fenixedu.util.HourMinuteSecond.java
License:Open Source License
/** * Creates a new HourMinuteSecond instance with the specified chronology. * This instance is immutable and unaffected by this method call. * <p>//from ww w.j a v a2 s . co m * This method retains the values of the fields, thus the result will typically refer to a different instant. * <p> * The time zone of the specified chronology is ignored, as HourMinuteSecond operates without a time zone. * * @param newChronology * the new chronology, null means ISO * @return a copy of this datetime with a different chronology * @throws IllegalArgumentException * if the values are invalid for the new chronology */ public HourMinuteSecond withChronologyRetainFields(Chronology newChronology) { newChronology = DateTimeUtils.getChronology(newChronology); newChronology = newChronology.withUTC(); if (newChronology == getChronology()) { return this; } else { HourMinuteSecond newHourMinuteSecond = new HourMinuteSecond(this, newChronology); newChronology.validate(newHourMinuteSecond, getValues()); return newHourMinuteSecond; } }