1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.index;
20
21 import java.util.ArrayList;
22 import java.util.Collection;
23 import java.util.Collections;
24 import java.util.List;
25
26 public class Field {
27 public static final String NOT_PRESENT = "N/P";
28
29 private final Field parent;
30
31 private final String namespace;
32
33 private final String fieldName;
34
35 private final String description;
36
37 private final List<IndexerField> indexerFields;
38
39 public Field(final Field parent, final String namespace, final String name, final String description) {
40 this.parent = parent;
41
42 this.namespace = namespace;
43
44 this.fieldName = name;
45
46 this.description = description;
47
48 this.indexerFields = new ArrayList<>();
49 }
50
51 public Field getParent() {
52 return parent;
53 }
54
55 public String getNamespace() {
56 return namespace;
57 }
58
59 public String getFieldName() {
60 return fieldName;
61 }
62
63 public String getDescription() {
64 return description;
65 }
66
67 public Collection<IndexerField> getIndexerFields() {
68 return Collections.unmodifiableList(indexerFields);
69 }
70
71 public boolean addIndexerField(IndexerField field) {
72 return indexerFields.add(field);
73 }
74
75 public boolean removeIndexerField(IndexerField field) {
76 return indexerFields.remove(field);
77 }
78
79 public String getFQN() {
80 return getNamespace() + getFieldName();
81 }
82
83 public String toString() {
84 return getFQN() + " (with " + getIndexerFields().size() + " registered index fields)";
85 }
86 }