/** * Builds another GDateBuilder with the same value * as this one. */ public Object clone() { return new GDateBuilder(this); }
/** * Constructs a GDate based on a java.util.Date. * <p> * The current offset of the default timezone is used as the timezone. * <p> * For example, if eastern daylight time is in effect at the given * date, the timezone on the east coast of the united states * translates to GMT-05:00 (EST) + 1:00 (DT offset) == GMT-04:00. */ public GDate(Date date) { // requires some date math, so ctor lives on GDateBuilder this(new GDateBuilder(date)); }
public static GDate lexGDate(String xsd_gdate, Collection errors) { try { return lexGDate(xsd_gdate); } catch (IllegalArgumentException e) { errors.add(XmlError.forMessage(e.getMessage())); return new GDateBuilder().toGDate(); } }
/** * Adds a duration to this GDate, and returns a new GDate. */ public GDate add(GDurationSpecification duration) { GDateBuilder builder = new GDateBuilder(this); builder.addGDuration(duration); return builder.toGDate(); }
public static GDateSpecification getGDateValue(Calendar c, int builtin_type_code) { GDateBuilder gDateBuilder = new GDateBuilder(c); gDateBuilder.setBuiltinTypeCode(builtin_type_code); GDate value = gDateBuilder.toGDate(); return value; }
/** * Adds a duration to this GDate, and returns a new GDate. */ public GDate subtract(GDurationSpecification duration) { GDateBuilder builder = new GDateBuilder(this); builder.subtractGDuration(duration); return builder.toGDate(); }
public static GDateSpecification getGDateValue(Date d, int builtin_type_code) { GDateBuilder gDateBuilder = new GDateBuilder(d); gDateBuilder.setBuiltinTypeCode(builtin_type_code); GDate value = gDateBuilder.toGDate(); return value; }
public static GDateSpecification getGDateValue(CharSequence v, int builtin_type_code) { GDateBuilder gDateBuilder = new GDateBuilder(v); gDateBuilder.setBuiltinTypeCode(builtin_type_code); GDate value = gDateBuilder.toGDate(); return value; }
public XmlCalendar getAttributeCalendarValue(int index) throws XMLStreamException { try { return new GDateBuilder(_charSeq.reloadAtt(index, CharSeqTrimWS.XMLWHITESPACE_TRIM)). getCalendar(); } catch(IllegalArgumentException e) { throw new InvalidLexicalValueException(e, _charSeq.getLocation()); } }
public Date getAttributeDateValue(int index) throws XMLStreamException { try { return new GDateBuilder(_charSeq.reloadAtt(index, CharSeqTrimWS.XMLWHITESPACE_TRIM)) .getDate(); } catch(IllegalArgumentException e) { throw new InvalidLexicalValueException(e, _charSeq.getLocation()); } }
public XmlCalendar getAttributeCalendarValue(String uri, String local) throws XMLStreamException { CharSequence cs = _charSeq.reloadAtt(uri, local, CharSeqTrimWS.XMLWHITESPACE_TRIM); try { return new GDateBuilder(cs).getCalendar(); } catch(IllegalArgumentException e) { throw new InvalidLexicalValueException(e, _charSeq.getLocation()); } }
public Date getAttributeDateValue(String uri, String local) throws XMLStreamException { try { CharSequence cs = _charSeq.reloadAtt(uri, local, CharSeqTrimWS.XMLWHITESPACE_TRIM); return new GDateBuilder(cs).getDate(); } catch(IllegalArgumentException e) { throw new InvalidLexicalValueException(e, _charSeq.getLocation()); } }
public XmlCalendar getCalendarValue() throws XMLStreamException, InvalidLexicalValueException { _charSeq.reload(CharSeqTrimWS.XMLWHITESPACE_TRIM); try { return new GDateBuilder(_charSeq).getCalendar(); } catch( IllegalArgumentException e) { throw new InvalidLexicalValueException(e, _charSeq.getLocation()); } }
public Date getDateValue() throws XMLStreamException, InvalidLexicalValueException { _charSeq.reload(CharSeqTrimWS.XMLWHITESPACE_TRIM); try { return new GDateBuilder(_charSeq).getDate(); } catch(IllegalArgumentException e) { throw new InvalidLexicalValueException(e, _charSeq.getLocation()); } }
protected void set_Calendar(Calendar c) { int code = schemaType().getPrimitiveType().getBuiltinTypeCode(); GDateBuilder gDateBuilder = new GDateBuilder(c); gDateBuilder.setBuiltinTypeCode(code); GDate value = gDateBuilder.toGDate(); if (_validateOnSet()) validateValue(value, _schemaType, _voorVc); _value = value; }
/** * The canonical string representation. Specific moments or * times-of-day in a specified timezone are normalized to * UTC time to produce a canonical string form for them. * Other recurring time specifications keep their timezone * information. */ public String canonicalString() { boolean needNormalize = (hasTimeZone() && getTimeZoneSign() != 0 && hasTime() && ((hasDay() == hasMonth() && hasDay() == hasYear()))); if (!needNormalize && getFraction()!=null && getFraction().scale() > 0) { BigInteger bi = getFraction().unscaledValue(); needNormalize = (bi.mod(TEN).signum() == 0); } if (!needNormalize) return toString(); GDateBuilder cdate = new GDateBuilder(this); cdate.normalize(); return cdate.toString(); }
/** * The canonical string representation. Specific moments or * times-of-day in a specified timezone are normalized to * UTC time to produce a canonical string form for them. * Other recurring time specifications keep their timezone * information. */ private void ensureCanonicalString() { if (_canonicalString != null) return; boolean needNormalize = (hasTimeZone() && getTimeZoneSign() != 0 && hasTime() && ((hasDay() == hasMonth() && hasDay() == hasYear()))); if (!needNormalize && getFraction() != null && getFraction().scale() > 0) { BigInteger bi = getFraction().unscaledValue(); needNormalize = (bi.mod(GDateBuilder.TEN).signum() == 0); } if (!needNormalize) _canonicalString = toString(); else { GDateBuilder gdb = new GDateBuilder(this); gdb.normalize(); _canonicalString = gdb.toString(); } }
protected void set_Date(Date v) { int code = schemaType().getPrimitiveType().getBuiltinTypeCode(); if (code != SchemaType.BTC_DATE && code != SchemaType.BTC_DATE_TIME || v == null) throw new XmlValueOutOfRangeException(); GDateBuilder gDateBuilder = new GDateBuilder(v); gDateBuilder.setBuiltinTypeCode(code); GDate value = gDateBuilder.toGDate(); if (_validateOnSet()) validateValue(value, _schemaType, _voorVc); _value = value; }
protected void set_int(int v) { int code = schemaType().getPrimitiveType().getBuiltinTypeCode(); if (code != SchemaType.BTC_G_DAY && code != SchemaType.BTC_G_MONTH && code != SchemaType.BTC_G_YEAR) throw new XmlValueOutOfRangeException(); GDateBuilder value = new GDateBuilder(); switch (code) { case SchemaType.BTC_G_DAY: value.setDay(v); break; case SchemaType.BTC_G_MONTH: value.setMonth(v); break; case SchemaType.BTC_G_YEAR: value.setYear(v); break; } if (_validateOnSet()) validateValue(value, _schemaType, _voorVc); _value = value.toGDate(); }
protected void set_GDate(GDateSpecification v) { int code = schemaType().getPrimitiveType().getBuiltinTypeCode(); GDate candidate; if (v.isImmutable() && (v instanceof GDate) && v.getBuiltinTypeCode() == code) candidate = (GDate)v; else { // truncate extra fields from the date if necessary. if (v.getBuiltinTypeCode() != code) { GDateBuilder gDateBuilder = new GDateBuilder(v); gDateBuilder.setBuiltinTypeCode(code); v = gDateBuilder; } candidate = new GDate(v); } if (_validateOnSet()) validateValue(candidate, _schemaType, _voorVc); _value = candidate; }