static InternalPrinter of(DateTimePrinter underlying) { if (underlying instanceof InternalPrinterDateTimePrinter) { return (InternalPrinter) underlying; } if (underlying == null) { return null; } return new DateTimePrinterInternalPrinter(underlying); }
public void printTo(Appendable appendable, ReadablePartial partial, Locale locale) throws IOException { if (appendable instanceof StringBuffer) { StringBuffer buf = (StringBuffer) appendable; underlying.printTo(buf, partial, locale); } else if (appendable instanceof Writer) { Writer out = (Writer) appendable; underlying.printTo(out, partial, locale); } else { StringBuffer buf = new StringBuffer(estimatePrintedLength()); underlying.printTo(buf, partial, locale); appendable.append(buf); } }
static DateTimePrinter of(InternalPrinter underlying) { if (underlying instanceof DateTimePrinterInternalPrinter) { return ((DateTimePrinterInternalPrinter) underlying).getUnderlying(); } if (underlying instanceof DateTimePrinter) { return (DateTimePrinter) underlying; } if (underlying == null) { return null; } return new InternalPrinterDateTimePrinter(underlying); }
/** * Creates a new formatter, however you will normally use the factory * or the builder. * * @param printer the internal printer, null if cannot print * @param parser the internal parser, null if cannot parse */ public DateTimeFormatter( DateTimePrinter printer, DateTimeParser parser) { this(DateTimePrinterInternalPrinter.of(printer), DateTimeParserInternalParser.of(parser)); }
/** * Creates a new formatter, however you will normally use the factory * or the builder. * * @param printer the internal printer, null if cannot print * @param parser the internal parser, null if cannot parse */ public DateTimeFormatter( DateTimePrinter printer, DateTimeParser parser) { this(DateTimePrinterInternalPrinter.of(printer), DateTimeParserInternalParser.of(parser)); }
/** * Appends just a printer. With no matching parser, a parser cannot be * built from this DateTimeFormatterBuilder. * <p> * The printer interface is part of the low-level part of the formatting API. * Normally, instances are extracted from another formatter. * Note however that any formatter specific information, such as the locale, * time-zone, chronology, offset parsing or pivot/default year, will not be * extracted by this method. * * @param printer the printer to add, not null * @return this DateTimeFormatterBuilder, for chaining * @throws IllegalArgumentException if printer is null or of an invalid type */ public DateTimeFormatterBuilder append(DateTimePrinter printer) { checkPrinter(printer); return append0(DateTimePrinterInternalPrinter.of(printer), null); }
public void printTo(Appendable appendable, long instant, Chronology chrono, int displayOffset, DateTimeZone displayZone, Locale locale) throws IOException { if (appendable instanceof StringBuffer) { StringBuffer buf = (StringBuffer) appendable; underlying.printTo(buf, instant, chrono, displayOffset, displayZone, locale); } else if (appendable instanceof Writer) { Writer out = (Writer) appendable; underlying.printTo(out, instant, chrono, displayOffset, displayZone, locale); } else { StringBuffer buf = new StringBuffer(estimatePrintedLength()); underlying.printTo(buf, instant, chrono, displayOffset, displayZone, locale); appendable.append(buf); } }
static InternalPrinter of(DateTimePrinter underlying) { if (underlying instanceof InternalPrinterDateTimePrinter) { return (InternalPrinter) underlying; } if (underlying == null) { return null; } return new DateTimePrinterInternalPrinter(underlying); }
static DateTimePrinter of(InternalPrinter underlying) { if (underlying instanceof DateTimePrinterInternalPrinter) { return ((DateTimePrinterInternalPrinter) underlying).getUnderlying(); } if (underlying instanceof DateTimePrinter) { return (DateTimePrinter) underlying; } if (underlying == null) { return null; } return new InternalPrinterDateTimePrinter(underlying); }
/** * Appends just a printer. With no matching parser, a parser cannot be * built from this DateTimeFormatterBuilder. * <p> * The printer interface is part of the low-level part of the formatting API. * Normally, instances are extracted from another formatter. * Note however that any formatter specific information, such as the locale, * time-zone, chronology, offset parsing or pivot/default year, will not be * extracted by this method. * * @param printer the printer to add, not null * @return this DateTimeFormatterBuilder, for chaining * @throws IllegalArgumentException if printer is null or of an invalid type */ public DateTimeFormatterBuilder append(DateTimePrinter printer) { checkPrinter(printer); return append0(DateTimePrinterInternalPrinter.of(printer), null); }
public void printTo(Appendable appendable, ReadablePartial partial, Locale locale) throws IOException { if (appendable instanceof StringBuffer) { StringBuffer buf = (StringBuffer) appendable; underlying.printTo(buf, partial, locale); } else if (appendable instanceof Writer) { Writer out = (Writer) appendable; underlying.printTo(out, partial, locale); } else { StringBuffer buf = new StringBuffer(estimatePrintedLength()); underlying.printTo(buf, partial, locale); appendable.append(buf); } }
static InternalPrinter of(DateTimePrinter underlying) { if (underlying instanceof InternalPrinterDateTimePrinter) { return (InternalPrinter) underlying; } if (underlying == null) { return null; } return new DateTimePrinterInternalPrinter(underlying); }
static DateTimePrinter of(InternalPrinter underlying) { if (underlying instanceof DateTimePrinterInternalPrinter) { return ((DateTimePrinterInternalPrinter) underlying).getUnderlying(); } if (underlying instanceof DateTimePrinter) { return (DateTimePrinter) underlying; } if (underlying == null) { return null; } return new InternalPrinterDateTimePrinter(underlying); }
public void printTo(Appendable appendable, long instant, Chronology chrono, int displayOffset, DateTimeZone displayZone, Locale locale) throws IOException { if (appendable instanceof StringBuffer) { StringBuffer buf = (StringBuffer) appendable; underlying.printTo(buf, instant, chrono, displayOffset, displayZone, locale); } else if (appendable instanceof Writer) { Writer out = (Writer) appendable; underlying.printTo(out, instant, chrono, displayOffset, displayZone, locale); } else { StringBuffer buf = new StringBuffer(estimatePrintedLength()); underlying.printTo(buf, instant, chrono, displayOffset, displayZone, locale); appendable.append(buf); } }
static InternalPrinter of(DateTimePrinter underlying) { if (underlying instanceof InternalPrinterDateTimePrinter) { return (InternalPrinter) underlying; } if (underlying == null) { return null; } return new DateTimePrinterInternalPrinter(underlying); }
static DateTimePrinter of(InternalPrinter underlying) { if (underlying instanceof DateTimePrinterInternalPrinter) { return ((DateTimePrinterInternalPrinter) underlying).getUnderlying(); } if (underlying instanceof DateTimePrinter) { return (DateTimePrinter) underlying; } if (underlying == null) { return null; } return new InternalPrinterDateTimePrinter(underlying); }
public void printTo(Appendable appendable, ReadablePartial partial, Locale locale) throws IOException { if (appendable instanceof StringBuffer) { StringBuffer buf = (StringBuffer) appendable; underlying.printTo(buf, partial, locale); } else if (appendable instanceof Writer) { Writer out = (Writer) appendable; underlying.printTo(out, partial, locale); } else { StringBuffer buf = new StringBuffer(estimatePrintedLength()); underlying.printTo(buf, partial, locale); appendable.append(buf); } }
/** * Appends a printer/parser pair. * <p> * The printer and parser interfaces are the low-level part of the formatting API. * Normally, instances are extracted from another formatter. * Note however that any formatter specific information, such as the locale, * time-zone, chronology, offset parsing or pivot/default year, will not be * extracted by this method. * * @param printer the printer to add, not null * @param parser the parser to add, not null * @return this DateTimeFormatterBuilder, for chaining * @throws IllegalArgumentException if printer or parser is null or of an invalid type */ public DateTimeFormatterBuilder append(DateTimePrinter printer, DateTimeParser parser) { checkPrinter(printer); checkParser(parser); return append0(DateTimePrinterInternalPrinter.of(printer), DateTimeParserInternalParser.of(parser)); }