public ObjectMapper putMapper(Mapper mapper) {
   if (mapper instanceof AllFieldMapper.IncludeInAll) {
     ((AllFieldMapper.IncludeInAll) mapper).includeInAllIfNotSet(includeInAll);
   }
   synchronized (mutex) {
     mappers = mappers.copyAndPut(mapper.name(), mapper);
   }
   return this;
 }
 /** Return a new instance that contains the union of this and of the provided analyzers. */
 public FieldNameAnalyzer copyAndAddAll(
     Collection<? extends Map.Entry<String, Analyzer>> mappers) {
   CopyOnWriteHashMap<String, Analyzer> analyzers = this.analyzers;
   for (Map.Entry<String, Analyzer> entry : mappers) {
     Analyzer analyzer = entry.getValue();
     if (analyzer == null) {
       analyzer = defaultAnalyzer;
     }
     analyzers = analyzers.copyAndPut(entry.getKey(), analyzer);
   }
   return new FieldNameAnalyzer(analyzers, defaultAnalyzer);
 }
Esempio n. 3
0
 /**
  * Put a new mapper. NOTE: this method must be called under the current {@link DocumentMapper}
  * lock if concurrent updates are expected.
  */
 public void putMapper(Mapper mapper) {
   if (mapper instanceof AllFieldMapper.IncludeInAll) {
     ((AllFieldMapper.IncludeInAll) mapper).includeInAllIfNotSet(includeInAll);
   }
   mappers = mappers.copyAndPut(mapper.simpleName(), mapper);
 }