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