- java.lang.Object
-
- org.ojalgo.type.context.FormatContext<java.util.Date>
-
- org.ojalgo.type.context.DateContext
-
- All Implemented Interfaces:
TypeContext<java.util.Date>
public final class DateContext extends FormatContext<java.util.Date>
ThisTypeContextdeals with the oldDate. There is another implementation that tries to deal with the newer date time API –TemporalContext.
-
-
Field Summary
Fields Modifier and Type Field Description private static DatePartDEFAULT_PARTprivate static DateStyleDEFAULT_STYLEprivate DatePartmyPartprivate DateStylemyStyle-
Fields inherited from class org.ojalgo.type.context.FormatContext
NBSP
-
-
Constructor Summary
Constructors Constructor Description DateContext()DateContext(DatePart part)DateContext(DatePart part, DateStyle style, java.util.Locale locale)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidconfigureFormat(java.text.Format format, java.lang.Object object)java.util.Dateenforce(java.util.Date object)Will force the object to conform to the context's specification.DatePartgetPart()DateStylegetStyle()CalendarDateUnitgetUnit()protected java.lang.StringhandleFormatException(java.text.Format format, java.lang.Object object)protected java.util.DatehandleParseException(java.text.Format format, java.lang.String string)static java.text.FormattoFormat(DatePart part, DateStyle style, java.util.Locale locale)TypeContext<java.util.Date>withFormat(DatePart part, DateStyle style, java.util.Locale locale)-
Methods inherited from class org.ojalgo.type.context.FormatContext
format, format, getFormat, isConfigured, parse, withFormat
-
-
-
-
Method Detail
-
toFormat
public static java.text.Format toFormat(DatePart part, DateStyle style, java.util.Locale locale)
-
enforce
public java.util.Date enforce(java.util.Date object)
Description copied from interface:TypeContextWill force the object to conform to the context's specification. The default implementation formats aStringand then parses that back to an object (of the original type).
-
getPart
public DatePart getPart()
-
getStyle
public DateStyle getStyle()
-
getUnit
public CalendarDateUnit getUnit()
-
withFormat
public TypeContext<java.util.Date> withFormat(DatePart part, DateStyle style, java.util.Locale locale)
-
configureFormat
protected void configureFormat(java.text.Format format, java.lang.Object object)- Specified by:
configureFormatin classFormatContext<java.util.Date>
-
handleFormatException
protected java.lang.String handleFormatException(java.text.Format format, java.lang.Object object)- Specified by:
handleFormatExceptionin classFormatContext<java.util.Date>
-
handleParseException
protected java.util.Date handleParseException(java.text.Format format, java.lang.String string)- Specified by:
handleParseExceptionin classFormatContext<java.util.Date>
-
-