Class DateContext

  • All Implemented Interfaces:
    TypeContext<java.util.Date>

    public final class DateContext
    extends FormatContext<java.util.Date>
    This TypeContext deals with the old Date. There is another implementation that tries to deal with the newer date time API – TemporalContext.
    • Field Detail

      • DEFAULT_PART

        private static final DatePart DEFAULT_PART
      • DEFAULT_STYLE

        private static final DateStyle DEFAULT_STYLE
    • Constructor Detail

      • DateContext

        public DateContext()
      • DateContext

        public DateContext​(DatePart part)
      • DateContext

        public DateContext​(DatePart part,
                           DateStyle style,
                           java.util.Locale locale)
    • 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 a String and then parses that back to an object (of the original type).
      • configureFormat

        protected void configureFormat​(java.text.Format format,
                                       java.lang.Object object)
        Specified by:
        configureFormat in class FormatContext<java.util.Date>
      • handleFormatException

        protected java.lang.String handleFormatException​(java.text.Format format,
                                                         java.lang.Object object)
        Specified by:
        handleFormatException in class FormatContext<java.util.Date>
      • handleParseException

        protected java.util.Date handleParseException​(java.text.Format format,
                                                      java.lang.String string)
        Specified by:
        handleParseException in class FormatContext<java.util.Date>