java.time.format.DateTimeFormatterBuilder#parseCaseInsensitive ( )源码实例Demo

下面列出了java.time.format.DateTimeFormatterBuilder#parseCaseInsensitive ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

private DateTimeFormatter getFormatter(Locale locale, TextStyle style, boolean ci) {
    DateTimeFormatterBuilder db = new DateTimeFormatterBuilder();
    if (ci) {
        db = db.parseCaseInsensitive();
    }
    return db.appendZoneText(style)
             .toFormatter(locale)
             .withDecimalStyle(DecimalStyle.of(locale));
}
 
源代码2 项目: TencentKona-8   文件: TestZoneTextPrinterParser.java
private DateTimeFormatter getFormatter(Locale locale, TextStyle style, boolean ci) {
    DateTimeFormatterBuilder db = new DateTimeFormatterBuilder();
    if (ci) {
        db = db.parseCaseInsensitive();
    }
    return db.appendZoneText(style)
             .toFormatter(locale)
             .withDecimalStyle(DecimalStyle.of(locale));
}
 
源代码3 项目: jdk8u60   文件: TestZoneTextPrinterParser.java
private DateTimeFormatter getFormatter(Locale locale, TextStyle style, boolean ci) {
    DateTimeFormatterBuilder db = new DateTimeFormatterBuilder();
    if (ci) {
        db = db.parseCaseInsensitive();
    }
    return db.appendZoneText(style)
             .toFormatter(locale)
             .withDecimalStyle(DecimalStyle.of(locale));
}
 
源代码4 项目: openjdk-jdk8u   文件: TestZoneTextPrinterParser.java
private DateTimeFormatter getFormatter(Locale locale, TextStyle style, boolean ci) {
    DateTimeFormatterBuilder db = new DateTimeFormatterBuilder();
    if (ci) {
        db = db.parseCaseInsensitive();
    }
    return db.appendZoneText(style)
             .toFormatter(locale)
             .withDecimalStyle(DecimalStyle.of(locale));
}
 
private DateTimeFormatter getFormatter(Locale locale, TextStyle style, boolean ci) {
    DateTimeFormatterBuilder db = new DateTimeFormatterBuilder();
    if (ci) {
        db = db.parseCaseInsensitive();
    }
    return db.appendZoneText(style)
             .toFormatter(locale)
             .withDecimalStyle(DecimalStyle.of(locale));
}
 
源代码6 项目: openjdk-jdk9   文件: TestZoneTextPrinterParser.java
private DateTimeFormatter getFormatter(Locale locale, TextStyle style, boolean ci) {
    DateTimeFormatterBuilder db = new DateTimeFormatterBuilder();
    if (ci) {
        db = db.parseCaseInsensitive();
    }
    return db.appendZoneText(style)
             .toFormatter(locale)
             .withDecimalStyle(DecimalStyle.of(locale));
}
 
源代码7 项目: jdk8u-jdk   文件: TestZoneTextPrinterParser.java
private DateTimeFormatter getFormatter(Locale locale, TextStyle style, boolean ci) {
    DateTimeFormatterBuilder db = new DateTimeFormatterBuilder();
    if (ci) {
        db = db.parseCaseInsensitive();
    }
    return db.appendZoneText(style)
             .toFormatter(locale)
             .withDecimalStyle(DecimalStyle.of(locale));
}
 
源代码8 项目: hottub   文件: TestZoneTextPrinterParser.java
private DateTimeFormatter getFormatter(Locale locale, TextStyle style, boolean ci) {
    DateTimeFormatterBuilder db = new DateTimeFormatterBuilder();
    if (ci) {
        db = db.parseCaseInsensitive();
    }
    return db.appendZoneText(style)
             .toFormatter(locale)
             .withDecimalStyle(DecimalStyle.of(locale));
}
 
private DateTimeFormatter getFormatter(Locale locale, TextStyle style, boolean ci) {
    DateTimeFormatterBuilder db = new DateTimeFormatterBuilder();
    if (ci) {
        db = db.parseCaseInsensitive();
    }
    return db.appendZoneText(style)
             .toFormatter(locale)
             .withDecimalStyle(DecimalStyle.of(locale));
}
 
源代码10 项目: openjdk-8   文件: TestZoneTextPrinterParser.java
private DateTimeFormatter getFormatter(Locale locale, TextStyle style, boolean ci) {
    DateTimeFormatterBuilder db = new DateTimeFormatterBuilder();
    if (ci) {
        db = db.parseCaseInsensitive();
    }
    return db.appendZoneText(style)
             .toFormatter(locale)
             .withDecimalStyle(DecimalStyle.of(locale));
}
 
源代码11 项目: jdk8u_jdk   文件: TestZoneTextPrinterParser.java
private DateTimeFormatter getFormatter(Locale locale, TextStyle style, boolean ci) {
    DateTimeFormatterBuilder db = new DateTimeFormatterBuilder();
    if (ci) {
        db = db.parseCaseInsensitive();
    }
    return db.appendZoneText(style)
             .toFormatter(locale)
             .withDecimalStyle(DecimalStyle.of(locale));
}
 
源代码12 项目: jdk8u-jdk   文件: TestZoneTextPrinterParser.java
private DateTimeFormatter getFormatter(Locale locale, TextStyle style, boolean ci) {
    DateTimeFormatterBuilder db = new DateTimeFormatterBuilder();
    if (ci) {
        db = db.parseCaseInsensitive();
    }
    return db.appendZoneText(style)
             .toFormatter(locale)
             .withDecimalStyle(DecimalStyle.of(locale));
}
 
源代码13 项目: jdk8u-dev-jdk   文件: TestZoneTextPrinterParser.java
private DateTimeFormatter getFormatter(Locale locale, TextStyle style, boolean ci) {
    DateTimeFormatterBuilder db = new DateTimeFormatterBuilder();
    if (ci) {
        db = db.parseCaseInsensitive();
    }
    return db.appendZoneText(style)
             .toFormatter(locale)
             .withDecimalStyle(DecimalStyle.of(locale));
}
 
@Override
public JsonDeserializer<?> createContextual(DeserializationContext ctxt,
        BeanProperty property) throws JsonMappingException
{
    JsonFormat.Value format = findFormatOverrides(ctxt, property, handledType());
    JSR310DateTimeDeserializerBase<?> deser = this;
    if (format != null) {
        // 17-Aug-2019, tatu: For 2.10 let's start considering leniency/strictness too
        if (format.hasLenient()) {
            Boolean leniency = format.getLenient();
            if (leniency != null) {
                deser = deser.withLeniency(leniency);
            }
        }
        if (format.hasPattern()) {
            final String pattern = format.getPattern();
            final Locale locale = format.hasLocale() ? format.getLocale() : ctxt.getLocale();
            DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder();
            if (acceptCaseInsensitiveValues(ctxt, format)) {
                builder.parseCaseInsensitive();
            }
            builder.appendPattern(pattern);
            DateTimeFormatter df;
            if (locale == null) {
                df = builder.toFormatter();
            } else {
                df = builder.toFormatter(locale);
            }

            // [#148]: allow strict parsing
            if (!deser.isLenient()) {
                df = df.withResolverStyle(ResolverStyle.STRICT);
            }

            // [#69]: For instant serializers/deserializers we need to configure the formatter with
            //a time zone picked up from JsonFormat annotation, otherwise serialization might not work
            if (format.hasTimeZone()) {
                df = df.withZone(format.getTimeZone().toZoneId());
            }
            deser = deser.withDateFormat(df);
        }
        // [#58]: For LocalDate deserializers we need to configure the formatter with
        //a shape picked up from JsonFormat annotation, to decide if the value is EpochSeconds
        JsonFormat.Shape shape = format.getShape();
        if (shape != null && shape != _shape) {
            deser = deser.withShape(shape);
        }
        // any use for TimeZone?
    }
    return deser;
}