package com.qianwen.core.tool.time; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.function.Predicate; import java.util.function.Supplier; import org.joda.time.DateTime; /* loaded from: blade-core-tool-9.3.0.0-SNAPSHOT.jar:org/springblade/core/tool/time/SampleJDKDateFormatter.class */ public class SampleJDKDateFormatter implements DateFormatter { Predicate predicate; Supplier formatSupplier; public SampleJDKDateFormatter(Predicate predicate, Supplier formatSupplier) { this.predicate = predicate; this.formatSupplier = formatSupplier; } @Override // org.springblade.core.tool.time.DateFormatter public boolean support(String str) { return this.predicate.test(str); } @Override // org.springblade.core.tool.time.DateFormatter public Date format(String str) { try { return this.formatSupplier.get().parse(str); } catch (ParseException var3) { var3.printStackTrace(); return null; } } @Override // org.springblade.core.tool.time.DateFormatter public String getPattern() { return this.formatSupplier.get().toPattern(); } @Override // org.springblade.core.tool.time.DateFormatter public String toString(Date date) { return new DateTime(date).toString(getPattern()); } }