/** * Constructs a DT object with the given value. * The stored value will be in the following * format YYYY[MM[DD]]. */ public CommonDT(String val) throws DataTypeException { this.setValue(val); } //end constructor
/** * Constructs a DT object with the given value. * The stored value will be in the following * format YYYY[MM[DD]]. */ public CommonDT(String val) throws DataTypeException { this.setValue(val); } //end constructor
/** * Convenience setter which sets the value using a {@link Date} object. Passing in <code>null</code> clears any existing value. * * Note: Sets fields using maximum possible precision * * @param theDate The date object from which to retrieve values * @since 1.1 */ public void setValue(Date theDate) throws DataTypeException { if (theDate == null) { setValue((String)null); return; } Calendar calendar = Calendar.getInstance(); calendar.setTime(theDate); setValue(calendar); }
/** * Convenience setter which sets the value using a {@link Date} object. Passing in <code>null</code> clears any existing value. * * Note: Sets fields using maximum possible precision * * @param theDate The date object from which to retrieve values * @since 1.1 */ public void setValue(Date theDate) throws DataTypeException { if (theDate == null) { setValue((String)null); return; } Calendar calendar = Calendar.getInstance(); calendar.setTime(theDate); setValue(calendar); }
/** * @see AbstractPrimitive#setValue(java.lang.String) * @throws DataTypeException if the value is incorrectly formatted and either validation is * enabled for this primitive or detail setters / getters have been called, forcing further * parsing. */ public void setValue(String theValue) throws DataTypeException { super.setValue(theValue); if (myDetail != null) { myDetail.setValue(theValue); } }
/** * @see AbstractPrimitive#setValue(java.lang.String) * @throws DataTypeException if the value is incorrectly formatted and either validation is * enabled for this primitive or detail setters / getters have been called, forcing further * parsing. */ public void setValue(String theValue) throws DataTypeException { super.setValue(theValue); if (myDetail != null) { myDetail.setValue(theValue); } }
/** * Convenience setter which sets the value using a {@link Calendar} object. Passing in <code>null</code> clears any existing value. * * Note: Sets fields using maximum possible precision * * @param theCalendar The calendar object from which to retrieve values * @since 1.1 */ public void setValue(Calendar theCalendar) throws DataTypeException { if (theCalendar == null) { setValue((String)null); return; } int yr = theCalendar.get(Calendar.YEAR); int mnth = theCalendar.get(Calendar.MONTH) + 1; int dy = theCalendar.get(Calendar.DATE); setYearMonthDayPrecision(yr, mnth, dy); }
/** * Convenience setter which sets the value using a {@link Calendar} object. Passing in <code>null</code> clears any existing value. * * Note: Sets fields using maximum possible precision * * @param theCalendar The calendar object from which to retrieve values * @since 1.1 */ public void setValue(Calendar theCalendar) throws DataTypeException { if (theCalendar == null) { setValue((String)null); return; } int yr = theCalendar.get(Calendar.YEAR); int mnth = theCalendar.get(Calendar.MONTH) + 1; int dy = theCalendar.get(Calendar.DATE); setYearMonthDayPrecision(yr, mnth, dy); }