Package org.apache.sis.internal.util
Class TemporalUtilities
java.lang.Object
org.apache.sis.util.Static
org.apache.sis.internal.util.TemporalUtilities
Utilities related to ISO 19108 objects. This class may disappear after we reviewed
the GeoAPI-pending temporal interfaces.
- Since:
- 0.3
- Version:
- 1.2
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateDo not allow instantiation of this class. -
Method Summary
Modifier and TypeMethodDescriptionstatic InstantcreateInstant(Date time) Creates an instant for the given date.private static InstantcreateInstant(TemporalFactory factory, Date date) Creates an instant for the given date using the given factory.static PeriodcreatePeriod(Date begin, Date end) Creates a period for the given begin and end dates.static DategetDate(org.opengis.temporal.TemporalPrimitive time) Infers a value from the extent as aDateobject.static TemporalFactoryReturns a temporal factory if available.static DateTemporary method, to be removed after we upgraded metadata tojava.time.
-
Constructor Details
-
TemporalUtilities
private TemporalUtilities()Do not allow instantiation of this class.
-
-
Method Details
-
getTemporalFactory
Returns a temporal factory if available.- Returns:
- the temporal factory.
- Throws:
UnsupportedOperationException- if the temporal factory is not available on the classpath.
-
createInstant
Creates an instant for the given date using the given factory. -
createInstant
Creates an instant for the given date.- Parameters:
time- the date for which to create instant, ornull.- Returns:
- the instant, or
nullif the given time was null. - Throws:
UnsupportedOperationException- if the temporal factory is not available on the classpath.
-
createPeriod
Creates a period for the given begin and end dates. The given arguments can be null if theTemporalFactory.createInstant(Date)method accepts null dates, which stand for undetermined position.- Parameters:
begin- the begin date, inclusive.end- the end date, inclusive.- Returns:
- the period.
- Throws:
UnsupportedOperationException- if the temporal factory is not available on the classpath.
-
getDate
Infers a value from the extent as aDateobject. This method is used for compatibility with legacy API and may disappear in future SIS version.- Parameters:
time- the instant or period for which to get a date, ornull.- Returns:
- the requested time as a Java date, or
nullif none. - Since:
- 1.0
-
toDate
Temporary method, to be removed after we upgraded metadata tojava.time.- Parameters:
instant- the Java instant, ornull.- Returns:
- the legacy Java date, or
null.
-