static class PeriodFormatterBuilder.Separator extends java.lang.Object implements PeriodPrinter, PeriodParser
Modifier and Type | Field and Description |
---|---|
private PeriodParser |
iAfterParser |
private PeriodPrinter |
iAfterPrinter |
private PeriodParser |
iBeforeParser |
private PeriodPrinter |
iBeforePrinter |
private java.lang.String |
iFinalText |
private java.lang.String[] |
iParsedForms |
private java.lang.String |
iText |
private boolean |
iUseAfter |
private boolean |
iUseBefore |
Constructor and Description |
---|
Separator(java.lang.String text,
java.lang.String finalText,
java.lang.String[] variants,
PeriodPrinter beforePrinter,
PeriodParser beforeParser,
boolean useBefore,
boolean useAfter) |
Modifier and Type | Method and Description |
---|---|
int |
calculatePrintedLength(ReadablePeriod period,
java.util.Locale locale)
Returns the exact number of characters produced for the given period.
|
int |
countFieldsToPrint(ReadablePeriod period,
int stopAt,
java.util.Locale locale)
Returns the amount of fields from the given period that this printer
will print.
|
(package private) PeriodFormatterBuilder.Separator |
finish(PeriodPrinter afterPrinter,
PeriodParser afterParser) |
int |
parseInto(ReadWritablePeriod period,
java.lang.String periodStr,
int position,
java.util.Locale locale)
Parses a period from the given text, at the given position, saving the
result into the fields of the given ReadWritablePeriod.
|
void |
printTo(java.lang.StringBuffer buf,
ReadablePeriod period,
java.util.Locale locale)
Prints a ReadablePeriod to a StringBuffer.
|
void |
printTo(java.io.Writer out,
ReadablePeriod period,
java.util.Locale locale)
Prints a ReadablePeriod to a Writer.
|
private final java.lang.String iText
private final java.lang.String iFinalText
private final java.lang.String[] iParsedForms
private final boolean iUseBefore
private final boolean iUseAfter
private final PeriodPrinter iBeforePrinter
private volatile PeriodPrinter iAfterPrinter
private final PeriodParser iBeforeParser
private volatile PeriodParser iAfterParser
Separator(java.lang.String text, java.lang.String finalText, java.lang.String[] variants, PeriodPrinter beforePrinter, PeriodParser beforeParser, boolean useBefore, boolean useAfter)
public int countFieldsToPrint(ReadablePeriod period, int stopAt, java.util.Locale locale)
PeriodPrinter
countFieldsToPrint
in interface PeriodPrinter
period
- the period to usestopAt
- stop counting at this value, enter a number ≥ 256 to count alllocale
- the locale to usepublic int calculatePrintedLength(ReadablePeriod period, java.util.Locale locale)
PeriodPrinter
calculatePrintedLength
in interface PeriodPrinter
period
- the period to uselocale
- the locale to usepublic void printTo(java.lang.StringBuffer buf, ReadablePeriod period, java.util.Locale locale)
PeriodPrinter
printTo
in interface PeriodPrinter
buf
- the formatted period is appended to this bufferperiod
- the period to formatlocale
- the locale to usepublic void printTo(java.io.Writer out, ReadablePeriod period, java.util.Locale locale) throws java.io.IOException
PeriodPrinter
printTo
in interface PeriodPrinter
out
- the formatted period is written outperiod
- the period to formatlocale
- the locale to usejava.io.IOException
public int parseInto(ReadWritablePeriod period, java.lang.String periodStr, int position, java.util.Locale locale)
PeriodParser
If it fails, the return value is negative, but the period may still be modified. To determine the position where the parse failed, apply the one's complement operator (~) on the return value.
parseInto
in interface PeriodParser
period
- a period that will be modifiedperiodStr
- text to parseposition
- position to start parsing fromlocale
- the locale to use for parsingPeriodFormatterBuilder.Separator finish(PeriodPrinter afterPrinter, PeriodParser afterParser)