allow for _ separator on top of camel case for mapping definitions
This commit is contained in:
parent
962ce9a7e6
commit
15bdba30e5
|
@ -103,7 +103,7 @@ public class JsonBooleanFieldMapper extends JsonFieldMapper<Boolean> {
|
|||
Map.Entry<String, JsonNode> entry = propsIt.next();
|
||||
String propName = entry.getKey();
|
||||
JsonNode propNode = entry.getValue();
|
||||
if (propName.equals("nullValue")) {
|
||||
if (propName.equals("nullValue") || propName.equals("null_value")) {
|
||||
builder.nullValue(nodeBooleanValue(propNode));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ public class JsonDateFieldMapper extends JsonNumberFieldMapper<Long> {
|
|||
Map.Entry<String, JsonNode> entry = propsIt.next();
|
||||
String propName = entry.getKey();
|
||||
JsonNode propNode = entry.getValue();
|
||||
if (propName.equals("nullValue")) {
|
||||
if (propName.equals("nullValue") || propName.equals("null_value")) {
|
||||
builder.nullValue(propNode.getValueAsText());
|
||||
} else if (propName.equals("format")) {
|
||||
builder.dateTimeFormatter(parseDateTimeFormatter(propName, propNode));
|
||||
|
|
|
@ -82,7 +82,7 @@ public class JsonDoubleFieldMapper extends JsonNumberFieldMapper<Double> {
|
|||
Map.Entry<String, JsonNode> entry = propsIt.next();
|
||||
String propName = entry.getKey();
|
||||
JsonNode propNode = entry.getValue();
|
||||
if (propName.equals("nullValue")) {
|
||||
if (propName.equals("nullValue") || propName.equals("null_value")) {
|
||||
builder.nullValue(nodeDoubleValue(propNode));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ public class JsonFloatFieldMapper extends JsonNumberFieldMapper<Float> {
|
|||
Map.Entry<String, JsonNode> entry = propsIt.next();
|
||||
String propName = entry.getKey();
|
||||
JsonNode propNode = entry.getValue();
|
||||
if (propName.equals("nullValue")) {
|
||||
if (propName.equals("nullValue") || propName.equals("null_value")) {
|
||||
builder.nullValue(nodeFloatValue(propNode));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -169,7 +169,7 @@ public class JsonObjectMapper implements JsonMapper, JsonIncludeInAllMapper {
|
|||
if (!type.equals("object")) {
|
||||
throw new MapperParsingException("Trying to parse an object but has a different type [" + type + "] for [" + name + "]");
|
||||
}
|
||||
} else if (fieldName.equals("dateFormats")) {
|
||||
} else if (fieldName.equals("dateFormats") || fieldName.equals("date_formats")) {
|
||||
List<FormatDateTimeFormatter> dateTimeFormatters = newArrayList();
|
||||
if (fieldNode.isArray()) {
|
||||
for (JsonNode node1 : (ArrayNode) fieldNode) {
|
||||
|
@ -187,11 +187,11 @@ public class JsonObjectMapper implements JsonMapper, JsonIncludeInAllMapper {
|
|||
}
|
||||
} else if (fieldName.equals("enabled")) {
|
||||
builder.enabled(nodeBooleanValue(fieldNode));
|
||||
} else if (fieldName.equals("pathType")) {
|
||||
} else if (fieldName.equals("pathType") || fieldName.equals("path_type")) {
|
||||
builder.pathType(parsePathType(name, fieldNode.getValueAsText()));
|
||||
} else if (fieldName.equals("properties")) {
|
||||
parseProperties(builder, (ObjectNode) fieldNode, parserContext);
|
||||
} else if (fieldName.equals("includeInAll")) {
|
||||
} else if (fieldName.equals("includeInAll") || fieldName.equals("include_in_all")) {
|
||||
builder.includeInAll(nodeBooleanValue(fieldNode));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ public class JsonShortFieldMapper extends JsonNumberFieldMapper<Short> {
|
|||
Map.Entry<String, JsonNode> entry = propsIt.next();
|
||||
String propName = entry.getKey();
|
||||
JsonNode propNode = entry.getValue();
|
||||
if (propName.equals("nullValue")) {
|
||||
if (propName.equals("nullValue") || propName.equals("null_value")) {
|
||||
builder.nullValue(nodeShortValue(propNode));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public class JsonTypeParsers {
|
|||
Map.Entry<String, JsonNode> entry = propsIt.next();
|
||||
String propName = entry.getKey();
|
||||
JsonNode propNode = entry.getValue();
|
||||
if (propName.equals("precisionStep")) {
|
||||
if (propName.equals("precisionStep") || propName.equals("precision_step")) {
|
||||
builder.precisionStep(nodeIntegerValue(propNode));
|
||||
}
|
||||
}
|
||||
|
@ -53,28 +53,28 @@ public class JsonTypeParsers {
|
|||
Map.Entry<String, JsonNode> entry = propsIt.next();
|
||||
String propName = entry.getKey();
|
||||
JsonNode propNode = entry.getValue();
|
||||
if (propName.equals("indexName")) {
|
||||
if (propName.equals("indexName") || propName.equals("index_name")) {
|
||||
builder.indexName(propNode.getTextValue());
|
||||
} else if (propName.equals("store")) {
|
||||
builder.store(parseStore(name, propNode.getTextValue()));
|
||||
} else if (propName.equals("index")) {
|
||||
builder.index(parseIndex(name, propNode.getTextValue()));
|
||||
} else if (propName.equals("termVector")) {
|
||||
} else if (propName.equals("termVector") || propName.equals("term_vector")) {
|
||||
builder.termVector(parseTermVector(name, propNode.getTextValue()));
|
||||
} else if (propName.equals("boost")) {
|
||||
builder.boost(nodeFloatValue(propNode));
|
||||
} else if (propName.equals("omitNorms")) {
|
||||
} else if (propName.equals("omitNorms") || propName.equals("omit_norms")) {
|
||||
builder.omitNorms(nodeBooleanValue(propNode));
|
||||
} else if (propName.equals("omitTermFreqAndPositions")) {
|
||||
} else if (propName.equals("omitTermFreqAndPositions") || propName.equals("omit_termFreq_and_positions")) {
|
||||
builder.omitTermFreqAndPositions(nodeBooleanValue(propNode));
|
||||
} else if (propName.equals("indexAnalyzer")) {
|
||||
} else if (propName.equals("indexAnalyzer") || propName.equals("index_analyzer")) {
|
||||
builder.indexAnalyzer(parserContext.analysisService().analyzer(propNode.getTextValue()));
|
||||
} else if (propName.equals("searchAnalyzer")) {
|
||||
} else if (propName.equals("searchAnalyzer") || propName.equals("search_analyzer")) {
|
||||
builder.searchAnalyzer(parserContext.analysisService().analyzer(propNode.getTextValue()));
|
||||
} else if (propName.equals("analyzer")) {
|
||||
builder.indexAnalyzer(parserContext.analysisService().analyzer(propNode.getTextValue()));
|
||||
builder.searchAnalyzer(parserContext.analysisService().analyzer(propNode.getTextValue()));
|
||||
} else if (propName.equals("includeInAll")) {
|
||||
} else if (propName.equals("includeInAll") || propName.equals("include_in_all")) {
|
||||
builder.includeInAll(nodeBooleanValue(propNode));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue