private static void parseCopyFields(ParseContext context,FieldMapper fieldMapper,List<String> copyToFields) throws IOException {
  if (!context.isWithinCopyTo() && copyToFields.isEmpty() == false) {
    context=context.createCopyToContext();
    for (    String field : copyToFields) {
      ParseContext.Document targetDoc=null;
      for (ParseContext.Document doc=context.doc(); doc != null; doc=doc.getParent()) {
        if (field.startsWith(doc.getPrefix())) {
          targetDoc=doc;
          break;
        }
      }
      assert targetDoc != null;
      final ParseContext copyToContext;
      if (targetDoc == context.doc()) {
        copyToContext=context;
      }
 else {
        copyToContext=context.switchDoc(targetDoc);
      }
      parseCopy(field,copyToContext);
    }
  }
}

private static void parseCopyFields ( ParseContext context , FieldMapper fieldMapper , List < String > copyToFields ) throws IOException { if ( ! context . isWithinCopyTo ( ) && copyToFields . isEmpty ( ) == false ) { context = context . createCopyToContext ( ) ; for ( String field : copyToFields ) { ParseContext . Document targetDoc = null ; for ( ParseContext . Document doc = context . doc ( ) ; doc != null ; doc = doc . getParent ( ) ) { if ( field . startsWith ( doc . getPrefix ( ) ) ) { targetDoc = doc ; break ; } } assert targetDoc != null ; final ParseContext copyToContext ; if ( targetDoc == context . doc ( ) ) { copyToContext = context ; } else { copyToContext = context . switchDoc ( targetDoc ) ; } parseCopy ( field , copyToContext ) ; } } }
creates instances of the fields that the current field should be copied to
