Skip to content

Commit

Permalink
typetools: DatatypeFactory getter
Browse files Browse the repository at this point in the history
Signed-off-by: Ketoth Xupack <ketoth.xupack@gmail.com>
  • Loading branch information
KetothXupack committed Oct 23, 2013
1 parent c621a25 commit 23df8b3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ static void setDefaultTimezone(final String id) {
TimeZone.setDefault(TimeZone.getTimeZone(id));
}

public static DatatypeFactory getDatatypeFactory() {
return LazyDataTypeFactorySingleton.getFactory();
}

/**
* @return {@link XMLGregorianCalendar XMLGregorianCalendar} representing current date in {@code UTC} timezone
*
Expand All @@ -66,7 +70,7 @@ public static XMLGregorianCalendar toXmlCalendar(final Date date, final String t
final GregorianCalendar calendar = new GregorianCalendar();
calendar.setTimeZone(TimeZone.getTimeZone(timezoneId));
calendar.setTime(date);
return LazyDataTypeFactorySingleton.getFactory().newXMLGregorianCalendar(calendar);
return getDatatypeFactory().newXMLGregorianCalendar(calendar);
}

public static boolean ne(@Nonnull final XMLGregorianCalendar c1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public void xmlCalendar() {
public void comparing() {
final XMLGregorianCalendar d1 = TTime.xmlCalendarUtcNow();
final XMLGregorianCalendar d2 = TTime.xmlCalendarUtcNow();
d2.add(TTime.getDatatypeFactory().newDuration(10));

assertTrue(TTime.eq(d1, d1));
assertFalse(TTime.eq(d2, d1));
Expand Down

0 comments on commit 23df8b3

Please sign in to comment.