1 package org.apache.lucene.store.instantiated;
3 import java.util.HashMap;
5 import java.util.Collection;
6 import java.io.Serializable;
9 * Licensed to the Apache Software Foundation (ASF) under one or more
10 * contributor license agreements. See the NOTICE file distributed with
11 * this work for additional information regarding copyright ownership.
12 * The ASF licenses this file to You under the Apache License, Version 2.0
13 * (the "License"); you may not use this file except in compliance with
14 * the License. You may obtain a copy of the License at
16 * http://www.apache.org/licenses/LICENSE-2.0
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
26 * Essentially a Map<FieldName, {@link org.apache.lucene.store.instantiated.FieldSetting}>
28 class FieldSettings implements Serializable {
34 private Map</** field name */String, FieldSetting> fieldSettings = new HashMap<String, FieldSetting>();
36 synchronized FieldSetting merge(FieldSetting fieldSetting) {
37 FieldSetting setting = fieldSettings.get(fieldSetting.fieldName);
39 if (setting == null) {
40 setting = new FieldSetting(fieldSetting.fieldName);
41 fieldSettings.put(fieldSetting.fieldName, setting);
44 if (fieldSetting.stored) {
45 setting.stored = true;
48 if ("b3".equals(fieldSetting.fieldName)) {
49 System.currentTimeMillis();
51 if (fieldSetting.indexed) {
52 setting.indexed = true;
54 if (fieldSetting.tokenized) {
55 setting.tokenized = true;
58 if (fieldSetting.storeTermVector) {
59 setting.storeTermVector = true;
61 if (fieldSetting.storeOffsetWithTermVector) {
62 setting.storeOffsetWithTermVector = true;
64 if (fieldSetting.storePositionWithTermVector) {
65 setting.storePositionWithTermVector = true;
68 if (fieldSetting.storePayloads) {
69 setting.storePayloads = true;
76 FieldSetting get(String name) {
77 return fieldSettings.get(name);
80 FieldSetting get(String name, boolean create) {
81 FieldSetting fieldSetting = fieldSettings.get(name);
82 if (create && fieldSetting == null) {
83 fieldSetting = new FieldSetting(name);
84 fieldSettings.put(name, fieldSetting);
89 Collection<FieldSetting> values() {
90 return fieldSettings.values();