Class ZoneOffsetPrinterParser

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean allowSeconds
      Whether to allow seconds.
      private boolean includeColon
      Whether to include a colon.
      private java.lang.String utcText
      The text to use for UTC.
    • Constructor Summary

      Constructors 
      Constructor Description
      ZoneOffsetPrinterParser​(java.lang.String utcText, boolean includeColon, boolean allowSeconds)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean isPrintDataAvailable​(Calendrical calendrical)
      Checks if the calendrical contains the data necessary to be printed.
      int parse​(DateTimeParseContext context, java.lang.String parseText, int position)
      Parses from the supplied text and position into the calendrical.
      private boolean parseNumber​(int[] array, int arrayIndex, java.lang.String parseText, boolean required)
      Parse a two digit zero-prefixed number.
      void print​(Calendrical calendrical, java.lang.Appendable appendable, DateTimeFormatSymbols symbols)
      Prints the calendrical object to the appendable.
      java.lang.String toString()
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • utcText

        private final java.lang.String utcText
        The text to use for UTC.
      • includeColon

        private final boolean includeColon
        Whether to include a colon.
      • allowSeconds

        private final boolean allowSeconds
        Whether to allow seconds.
    • Constructor Detail

      • ZoneOffsetPrinterParser

        ZoneOffsetPrinterParser​(java.lang.String utcText,
                                boolean includeColon,
                                boolean allowSeconds)
        Constructor.
        Parameters:
        utcText - the text to use for UTC, not null
        includeColon - whether to include a colon
        allowSeconds - whether to allow seconds
    • Method Detail

      • print

        public void print​(Calendrical calendrical,
                          java.lang.Appendable appendable,
                          DateTimeFormatSymbols symbols)
                   throws java.io.IOException
        Prints the calendrical object to the appendable.
        Specified by:
        print in interface DateTimePrinter
        Parameters:
        calendrical - the calendrical to print, not null
        appendable - the appendable to add to, not null
        symbols - the formatting symbols to use, not null
        Throws:
        java.io.IOException - if the append throws an exception
      • isPrintDataAvailable

        public boolean isPrintDataAvailable​(Calendrical calendrical)
        Checks if the calendrical contains the data necessary to be printed.

        The implementation should not check the validity of the data, just whether there is sufficient data to attempt a print.

        Specified by:
        isPrintDataAvailable in interface DateTimePrinter
        Parameters:
        calendrical - the calendrical to check, not null
        Returns:
        true if the calendrical can be printed, false if not
      • parse

        public int parse​(DateTimeParseContext context,
                         java.lang.String parseText,
                         int position)
        Parses from the supplied text and position into the calendrical.
        Specified by:
        parse in interface DateTimeParser
        Parameters:
        context - the context to use and parse into, not null
        parseText - the input text to parse, not null
        position - the position to start parsing at, from 0 to the text length
        Returns:
        the new parse position, where negative means an error with the error position encoded using the complement ~ operator
      • parseNumber

        private boolean parseNumber​(int[] array,
                                    int arrayIndex,
                                    java.lang.String parseText,
                                    boolean required)
        Parse a two digit zero-prefixed number.
        Parameters:
        array - the array of parsed data, 0=pos,1=hours,2=mins,3=secs, not null
        arrayIndex - the index to parse the value into
        parseText - the offset id, not null
        required - whether this number is required
        Returns:
        true if an error occurred
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object