/** * Constructs a TM object with the given value. * The stored value will be in the following * format HH[MM[SS[.S[S[S[S]]]]]][+/-ZZZZ]. */ public CommonTM(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 precision up to the second * Note: Date is timezone-agnostic, representing always GMT time * * @param theDate The date object from which to retrieve values * @since 1.1 */ public void setValueToSecond(Date theDate) throws DataTypeException { if (theDate == null) { setValue((String)null); return; } Calendar calendar = Calendar.getInstance(); calendar.setTime(theDate); setValueToSecond(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 precision up to the minute * Note: Date is timezone-agnostic, representing always GMT time * * @param theDate The date object from which to retrieve values * @since 1.1 */ public void setValueToMinute(Date theDate) throws DataTypeException { if (theDate == null) { setValue((String)null); return; } Calendar calendar = Calendar.getInstance(); calendar.setTime(theDate); setValueToMinute(calendar); }
/** * Constructs a TM object with the given value. * The stored value will be in the following * format HH[MM[SS[.S[S[S[S]]]]]][+/-ZZZZ]. */ public CommonTM(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 precision up to the second * Note: Date is timezone-agnostic, representing always GMT time * * @param theDate The date object from which to retrieve values * @since 1.1 */ public void setValueToSecond(Date theDate) throws DataTypeException { if (theDate == null) { setValue((String)null); return; } Calendar calendar = Calendar.getInstance(); calendar.setTime(theDate); setValueToSecond(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 precision up to the minute * Note: Date is timezone-agnostic, representing always GMT time * * @param theDate The date object from which to retrieve values * @since 1.1 */ public void setValueToMinute(Date theDate) throws DataTypeException { if (theDate == null) { setValue((String)null); return; } Calendar calendar = Calendar.getInstance(); calendar.setTime(theDate); setValueToMinute(calendar); }
/** * Convenience setter which sets the value using a {@link Calendar} object. Passing in <code>null</code> clears any existing value. * * Note: Sets fields using precision up to the millisecond, and sets the timezone offset to * the current system offset * Note: Date is timezone-agnostic, representing always GMT time * * @param theDate The calendar object from which to retrieve values * @since 1.1 */ public void setValue(Date theDate) throws DataTypeException { if (theDate == null) { setValue((String)null); return; } GregorianCalendar cal = new GregorianCalendar(); cal.setTime(theDate); setValue(cal); }
/** * Convenience setter which sets the value using a {@link Calendar} object. Passing in <code>null</code> clears any existing value. * * Note: Sets fields using precision up to the millisecond, and sets the timezone offset to * the current system offset * Note: Date is timezone-agnostic, representing always GMT time * * @param theDate The calendar object from which to retrieve values * @since 1.1 */ public void setValue(Date theDate) throws DataTypeException { if (theDate == null) { setValue((String)null); return; } GregorianCalendar cal = new GregorianCalendar(); cal.setTime(theDate); setValue(cal); }
/** * @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 precision up to the minute * * @param theCalendar The calendar object from which to retrieve values * @since 1.1 */ public void setValueToMinute(Calendar theCalendar) throws DataTypeException { if (theCalendar == null) { setValue((String)null); return; } int hr = theCalendar.get(Calendar.HOUR_OF_DAY); int min = theCalendar.get(Calendar.MINUTE); setHourMinutePrecision(hr, min); }
/** * Convenience setter which sets the value using a {@link Calendar} object. Passing in <code>null</code> clears any existing value. * * Note: Sets fields using precision up to the minute * * @param theCalendar The calendar object from which to retrieve values * @since 1.1 */ public void setValueToMinute(Calendar theCalendar) throws DataTypeException { if (theCalendar == null) { setValue((String)null); return; } int hr = theCalendar.get(Calendar.HOUR_OF_DAY); int min = theCalendar.get(Calendar.MINUTE); setHourMinutePrecision(hr, min); }
/** * Convenience setter which sets the value using a {@link Calendar} object. Passing in <code>null</code> clears any existing value. * * Note: Sets fields using precision up to the second * * @param theCalendar The calendar object from which to retrieve values * @since 1.1 */ public void setValueToSecond(Calendar theCalendar) throws DataTypeException { if (theCalendar == null) { setValue((String)null); return; } int hr = theCalendar.get(Calendar.HOUR_OF_DAY); int min = theCalendar.get(Calendar.MINUTE); int sec = theCalendar.get(Calendar.SECOND); setHourMinSecondPrecision(hr, min, sec); }
/** * Convenience setter which sets the value using a {@link Calendar} object. Passing in <code>null</code> clears any existing value. * * Note: Sets fields using precision up to the second * * @param theCalendar The calendar object from which to retrieve values * @since 1.1 */ public void setValueToSecond(Calendar theCalendar) throws DataTypeException { if (theCalendar == null) { setValue((String)null); return; } int hr = theCalendar.get(Calendar.HOUR_OF_DAY); int min = theCalendar.get(Calendar.MINUTE); int sec = theCalendar.get(Calendar.SECOND); setHourMinSecondPrecision(hr, min, sec); }
/** * Convenience setter which sets the value using a {@link Calendar} object. Passing in <code>null</code> clears any existing value. * * Note: Sets fields using precision up to the millisecond, including timezone offset * * @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 hr = theCalendar.get(Calendar.HOUR_OF_DAY); int min = theCalendar.get(Calendar.MINUTE); float sec = theCalendar.get(Calendar.SECOND) + (theCalendar.get(Calendar.MILLISECOND) / 1000.0F); setHourMinSecondPrecision(hr, min, sec); // 3410095: care for integer overflow and timezones not at the full hour, e.g. India int hourOffset= theCalendar.get(Calendar.ZONE_OFFSET) / (1000 * 60 * 60); int minuteOffset = (theCalendar.get(Calendar.ZONE_OFFSET) / (1000 * 60)) % 60; int zoneOffset = hourOffset * 100 + minuteOffset; setOffset(zoneOffset); }
/** * Convenience setter which sets the value using a {@link Calendar} object. Passing in <code>null</code> clears any existing value. * * Note: Sets fields using precision up to the millisecond, including timezone offset * * @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 hr = theCalendar.get(Calendar.HOUR_OF_DAY); int min = theCalendar.get(Calendar.MINUTE); float sec = theCalendar.get(Calendar.SECOND) + (theCalendar.get(Calendar.MILLISECOND) / 1000.0F); setHourMinSecondPrecision(hr, min, sec); // 3410095: care for integer overflow and timezones not at the full hour, e.g. India int hourOffset= theCalendar.get(Calendar.ZONE_OFFSET) / (1000 * 60 * 60); int minuteOffset = (theCalendar.get(Calendar.ZONE_OFFSET) / (1000 * 60)) % 60; int zoneOffset = hourOffset * 100 + minuteOffset; setOffset(zoneOffset); }