Package org.ojalgo.type.context
Class DateContext
- 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>
ThisTypeContext
deals 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 DatePart
DEFAULT_PART
private static DateStyle
DEFAULT_STYLE
private DatePart
myPart
private DateStyle
myStyle
-
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 void
configureFormat(java.text.Format format, java.lang.Object object)
java.util.Date
enforce(java.util.Date object)
Will force the object to conform to the context's specification.DatePart
getPart()
DateStyle
getStyle()
CalendarDateUnit
getUnit()
protected java.lang.String
handleFormatException(java.text.Format format, java.lang.Object object)
protected java.util.Date
handleParseException(java.text.Format format, java.lang.String string)
static java.text.Format
toFormat(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:TypeContext
Will force the object to conform to the context's specification. The default implementation formats aString
and 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:
configureFormat
in classFormatContext<java.util.Date>
-
handleFormatException
protected java.lang.String handleFormatException(java.text.Format format, java.lang.Object object)
- Specified by:
handleFormatException
in classFormatContext<java.util.Date>
-
handleParseException
protected java.util.Date handleParseException(java.text.Format format, java.lang.String string)
- Specified by:
handleParseException
in classFormatContext<java.util.Date>
-
-