コード例 #1
0
 @Override
 public Mapper.Builder parse(String name, Map<String, Object> node, ParserContext parserContext)
     throws MapperParsingException {
   RoutingFieldMapper.Builder builder = routing();
   parseField(builder, builder.name, node, parserContext);
   for (Map.Entry<String, Object> entry : node.entrySet()) {
     String fieldName = Strings.toUnderscoreCase(entry.getKey());
     Object fieldNode = entry.getValue();
     if (fieldName.equals("required")) {
       builder.required(nodeBooleanValue(fieldNode));
     } else if (fieldName.equals("path")) {
       builder.path(fieldNode.toString());
     }
   }
   return builder;
 }
コード例 #2
0
 @Override
 public Mapper.Builder parse(String name, Map<String, Object> node, ParserContext parserContext)
     throws MapperParsingException {
   RoutingFieldMapper.Builder builder = routing();
   if (parserContext.indexVersionCreated().before(Version.V_2_0_0)) {
     parseField(builder, builder.name, node, parserContext);
   }
   for (Iterator<Map.Entry<String, Object>> iterator = node.entrySet().iterator();
       iterator.hasNext(); ) {
     Map.Entry<String, Object> entry = iterator.next();
     String fieldName = Strings.toUnderscoreCase(entry.getKey());
     Object fieldNode = entry.getValue();
     if (fieldName.equals("required")) {
       builder.required(nodeBooleanValue(fieldNode));
       iterator.remove();
     } else if (fieldName.equals("path")
         && parserContext.indexVersionCreated().before(Version.V_2_0_0)) {
       builder.path(fieldNode.toString());
       iterator.remove();
     }
   }
   return builder;
 }