/** * Gets the format field to parse the from/to fields */ public String format() { return this.format == null ? null : this.format.format(); }
/** * Gets the format field to parse the from/to fields */ public String format() { return this.format == null ? null : this.format.format(); }
@Override public int hashCode() { int result = super.hashCode(); result = 31 * result + (formatter == null ? 0 : formatter.format().hashCode()); return result; } }
@Override protected int doHashCode() { String timeZoneId = timeZone == null ? null : timeZone.getID(); String formatString = format == null ? null : format.format(); return Objects.hash(fieldName, from, to, timeZoneId, includeLower, includeUpper, formatString); }
@Override public boolean equals(Object o) { if (!super.equals(o)) return false; DateFieldType that = (DateFieldType) o; return Objects.equals(dateTimeFormatter.format(), that.dateTimeFormatter.format()) && Objects.equals(dateTimeFormatter.locale(), that.dateTimeFormatter.locale()) && Objects.equals(timeUnit, that.timeUnit); }
@Override public boolean equals(Object o) { if (!super.equals(o)) return false; RangeFieldType that = (RangeFieldType) o; return Objects.equals(rangeType, that.rangeType) && (rangeType == RangeType.DATE) ? Objects.equals(dateTimeFormatter.format(), that.dateTimeFormatter.format()) && Objects.equals(dateTimeFormatter.locale(), that.dateTimeFormatter.locale()) : dateTimeFormatter == null && that.dateTimeFormatter == null; }
@Override public boolean equals(Object o) { if (!super.equals(o)) return false; RangeFieldType that = (RangeFieldType) o; return Objects.equals(rangeType, that.rangeType) && (rangeType == RangeType.DATE) ? Objects.equals(dateTimeFormatter.format(), that.dateTimeFormatter.format()) && Objects.equals(dateTimeFormatter.locale(), that.dateTimeFormatter.locale()) : dateTimeFormatter == null && that.dateTimeFormatter == null; }
@Override public int hashCode() { return (dateTimeFormatter == null) ? Objects.hash(super.hashCode(), rangeType) : Objects.hash(super.hashCode(), rangeType, dateTimeFormatter.format(), dateTimeFormatter.locale()); }
@Override public int hashCode() { return (dateTimeFormatter == null) ? Objects.hash(super.hashCode(), rangeType) : Objects.hash(super.hashCode(), rangeType, dateTimeFormatter.format(), dateTimeFormatter.locale()); }
@Override public void checkCompatibility(MappedFieldType fieldType, List<String> conflicts, boolean strict) { super.checkCompatibility(fieldType, conflicts, strict); DateFieldType other = (DateFieldType) fieldType; if (Objects.equals(dateTimeFormatter().format(), other.dateTimeFormatter().format()) == false) { conflicts.add("mapper [" + name() + "] has different [format] values"); } if (Objects.equals(dateTimeFormatter().locale(), other.dateTimeFormatter().locale()) == false) { conflicts.add("mapper [" + name() + "] has different [locale] values"); } }
@Override public void writeTo(StreamOutput out) throws IOException { out.writeString(formatter.format()); out.writeString(timeZone.getID()); }
@Override public void writeMinMax(StreamOutput out) throws IOException { out.writeString(formatter.format()); out.writeLong(minValue); out.writeLong(maxValue); }
@Override public void writeTo(StreamOutput out) throws IOException { out.writeString(formatter.format()); out.writeString(timeZone.getID()); }
@Override protected void setupFieldType(BuilderContext context) { super.setupFieldType(context); FormatDateTimeFormatter dateTimeFormatter = fieldType().dateTimeFormatter; if (!locale.equals(dateTimeFormatter.locale())) { fieldType().setDateTimeFormatter( new FormatDateTimeFormatter(dateTimeFormatter.format(), dateTimeFormatter.parser(), dateTimeFormatter.printer(), locale)); } }
@Override protected void setupFieldType(BuilderContext context) { super.setupFieldType(context); FormatDateTimeFormatter dateTimeFormatter = fieldType().dateTimeFormatter; if (!locale.equals(dateTimeFormatter.locale())) { fieldType().setDateTimeFormatter( new FormatDateTimeFormatter(dateTimeFormatter.format(), dateTimeFormatter.parser(), dateTimeFormatter.printer(), locale)); } }
@Override protected void setupFieldType(BuilderContext context) { FormatDateTimeFormatter dateTimeFormatter = fieldType().dateTimeFormatter; if (!locale.equals(dateTimeFormatter.locale())) { fieldType().setDateTimeFormatter(new FormatDateTimeFormatter(dateTimeFormatter.format(), dateTimeFormatter.parser(), dateTimeFormatter.printer(), locale)); } super.setupFieldType(context); }
public MappingMetaData(DocumentMapper docMapper) { this.type = docMapper.type(); this.source = docMapper.mappingSource(); this.routing = new Routing(docMapper.routingFieldMapper().required()); this.timestamp = new Timestamp(docMapper.timestampFieldMapper().enabled(), docMapper.timestampFieldMapper().fieldType().dateTimeFormatter().format(), docMapper.timestampFieldMapper().defaultTimestamp(), docMapper.timestampFieldMapper().ignoreMissing()); this.hasParentField = docMapper.parentFieldMapper().active(); }