下面列出了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));
}
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));
}
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));
}
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));
}
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));
}
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));
}
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));
}
@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;
}