summaryrefslogtreecommitdiffstats
path: root/document
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-10-11 12:35:13 +0200
committerGitHub <noreply@github.com>2023-10-11 12:35:13 +0200
commit9e5c9398c8141d59d3c07aba9198fa3dc43b56a0 (patch)
treef674f7ac06fca2bba8faebaa3cdf098e73fbc0c2 /document
parentc5415130877801316c9c380330c644f3b9f615c8 (diff)
parent9922b8c1681a817d9a9c84d3a967a5120e8c0599 (diff)
Merge pull request #28850 from vespa-engine/jonmv/concrete-document-field-validation
Jonmv/concrete document field validation
Diffstat (limited to 'document')
-rw-r--r--document/src/main/java/com/yahoo/document/annotation/ListAnnotationContainer.java6
-rw-r--r--document/src/main/java/com/yahoo/document/annotation/SpanNodeParent.java6
-rw-r--r--document/src/main/java/com/yahoo/document/annotation/SpanTree.java14
-rw-r--r--document/src/main/java/com/yahoo/document/datatypes/StringFieldValue.java2
-rwxr-xr-xdocument/src/test/java/com/yahoo/document/datatypes/ArrayTestCase.java10
5 files changed, 19 insertions, 19 deletions
diff --git a/document/src/main/java/com/yahoo/document/annotation/ListAnnotationContainer.java b/document/src/main/java/com/yahoo/document/annotation/ListAnnotationContainer.java
index 6ef36f0013a..c2c22558a32 100644
--- a/document/src/main/java/com/yahoo/document/annotation/ListAnnotationContainer.java
+++ b/document/src/main/java/com/yahoo/document/annotation/ListAnnotationContainer.java
@@ -10,10 +10,10 @@ import java.util.ListIterator;
import java.util.NoSuchElementException;
/**
- * @author <a href="mailto:einarmr@yahoo-inc.com">Einar M R Rosenvinge</a>
+ * @author Einar M R Rosenvinge
*/
public class ListAnnotationContainer extends IteratingAnnotationContainer {
- private final List<Annotation> annotations = new LinkedList<Annotation>();
+ private final List<Annotation> annotations = new LinkedList<>();
@Override
void annotateAll(Collection<Annotation> annotations) {
@@ -55,7 +55,7 @@ public class ListAnnotationContainer extends IteratingAnnotationContainer {
private boolean nextCalled = false;
AnnotationIterator(ListIterator<Annotation> baseIt, IdentityHashMap<SpanNode, SpanNode> nodes) {
- this.base = new PeekableListIterator<Annotation>(baseIt);
+ this.base = new PeekableListIterator(baseIt);
this.nodes = nodes;
}
diff --git a/document/src/main/java/com/yahoo/document/annotation/SpanNodeParent.java b/document/src/main/java/com/yahoo/document/annotation/SpanNodeParent.java
index 167ce4589da..a4d178e6925 100644
--- a/document/src/main/java/com/yahoo/document/annotation/SpanNodeParent.java
+++ b/document/src/main/java/com/yahoo/document/annotation/SpanNodeParent.java
@@ -6,7 +6,7 @@ import com.yahoo.document.datatypes.StringFieldValue;
/**
* An interface to be implemented by classes that can be parents of SpanNodes.
*
- * @author <a href="mailto:einarmr@yahoo-inc.com">Einar M R Rosenvinge</a>
+ * @author Einar M R Rosenvinge
* @see SpanNode#getParent()
*/
public interface SpanNodeParent {
@@ -15,12 +15,12 @@ public interface SpanNodeParent {
*
* @return the SpanTree of this, if it belongs to a SpanTree, otherwise null.
*/
- public SpanTree getSpanTree();
+ SpanTree getSpanTree();
/**
* Returns the StringFieldValue that this node belongs to, if any.
*
* @return the StringFieldValue that this node belongs to, if any, otherwise null.
*/
- public StringFieldValue getStringFieldValue();
+ StringFieldValue getStringFieldValue();
}
diff --git a/document/src/main/java/com/yahoo/document/annotation/SpanTree.java b/document/src/main/java/com/yahoo/document/annotation/SpanTree.java
index 3dc27171d8c..f785cf3b3ec 100644
--- a/document/src/main/java/com/yahoo/document/annotation/SpanTree.java
+++ b/document/src/main/java/com/yahoo/document/annotation/SpanTree.java
@@ -22,7 +22,7 @@ import java.util.Map;
/**
* A SpanTree holds a root node of a tree of SpanNodes, and a List of Annotations pointing to these nodes
- * or each other.&nbsp;It also has a name.
+ * or each other. It also has a name.
*
* @author Einar M R Rosenvinge
* @see com.yahoo.document.annotation.SpanNode
@@ -36,7 +36,7 @@ public class SpanTree implements Iterable<Annotation>, SpanNodeParent, Comparabl
private StringFieldValue stringFieldValue;
/**
- * WARNING!&nbsp;Only to be used by deserializers!&nbsp;Creates an empty SpanTree instance.
+ * WARNING! Only to be used by deserializers! Creates an empty SpanTree instance.
*/
public SpanTree() { }
@@ -65,8 +65,8 @@ public class SpanTree implements Iterable<Annotation>, SpanNodeParent, Comparabl
public SpanTree(SpanTree otherToCopy) {
name = otherToCopy.name;
setRoot(copySpan(otherToCopy.root));
- List<Annotation> annotationsToCopy = new ArrayList<Annotation>(otherToCopy.getAnnotations());
- List<Annotation> newAnnotations = new ArrayList<Annotation>(annotationsToCopy.size());
+ List<Annotation> annotationsToCopy = new ArrayList<>(otherToCopy.getAnnotations());
+ List<Annotation> newAnnotations = new ArrayList<>(annotationsToCopy.size());
for (Annotation otherAnnotationToCopy : annotationsToCopy) {
newAnnotations.add(new Annotation(otherAnnotationToCopy));
@@ -153,7 +153,7 @@ public class SpanTree implements Iterable<Annotation>, SpanNodeParent, Comparabl
}
private IdentityHashMap<Annotation, Integer> getAnnotations(List<Annotation> annotationsToCopy) {
- IdentityHashMap<Annotation, Integer> map = new IdentityHashMap<Annotation, Integer>();
+ IdentityHashMap<Annotation, Integer> map = new IdentityHashMap<>();
for (int i = 0; i < annotationsToCopy.size(); i++) {
map.put(annotationsToCopy.get(i), i);
}
@@ -162,7 +162,7 @@ public class SpanTree implements Iterable<Annotation>, SpanNodeParent, Comparabl
private List<SpanNode> getSpanNodes() {
- ArrayList<SpanNode> nodes = new ArrayList<SpanNode>();
+ ArrayList<SpanNode> nodes = new ArrayList<>();
nodes.add(root);
Iterator<SpanNode> it = root.childIteratorRecursive();
while (it.hasNext()) {
@@ -172,7 +172,7 @@ public class SpanTree implements Iterable<Annotation>, SpanNodeParent, Comparabl
}
private static IdentityHashMap<SpanNode, Integer> getSpanNodes(SpanTree otherToCopy) {
- IdentityHashMap<SpanNode, Integer> map = new IdentityHashMap<SpanNode, Integer>();
+ IdentityHashMap<SpanNode, Integer> map = new IdentityHashMap<>();
int spanNodeCounter = 0;
map.put(otherToCopy.getRoot(), spanNodeCounter++);
Iterator<SpanNode> it = otherToCopy.getRoot().childIteratorRecursive();
diff --git a/document/src/main/java/com/yahoo/document/datatypes/StringFieldValue.java b/document/src/main/java/com/yahoo/document/datatypes/StringFieldValue.java
index 797d89226f3..8b4b94f6bbf 100644
--- a/document/src/main/java/com/yahoo/document/datatypes/StringFieldValue.java
+++ b/document/src/main/java/com/yahoo/document/datatypes/StringFieldValue.java
@@ -106,7 +106,7 @@ public class StringFieldValue extends FieldValue {
}
/**
- * Sets a new value for this StringFieldValue.&nbsp;NOTE that doing so will clear all span trees from this value,
+ * Sets a new value for this StringFieldValue. NOTE that doing so will clear all span trees from this value,
* since they most certainly will not make sense for a new string value.
*
* @param o the new String to assign to this. An argument of null is equal to calling clear().
diff --git a/document/src/test/java/com/yahoo/document/datatypes/ArrayTestCase.java b/document/src/test/java/com/yahoo/document/datatypes/ArrayTestCase.java
index 0554b7349c2..7b1e161ef0e 100755
--- a/document/src/test/java/com/yahoo/document/datatypes/ArrayTestCase.java
+++ b/document/src/test/java/com/yahoo/document/datatypes/ArrayTestCase.java
@@ -77,7 +77,7 @@ public class ArrayTestCase {
@Test
public void testWrappedList() {
- Array<StringFieldValue> array = new Array<StringFieldValue>(DataType.getArray(DataType.STRING));
+ Array<StringFieldValue> array = new Array<>(DataType.getArray(DataType.STRING));
List<String> list = new ArrayList<>();
list.add("foo");
list.add("bar");
@@ -217,10 +217,10 @@ public class ArrayTestCase {
assertEquals(new StringFieldValue("apple"), subArray.get(1));
- assertEquals(false, array.containsAll(Arrays.<StringFieldValue>asList(new StringFieldValue("bob"))));
- assertEquals(true, array.containsAll(Arrays.<StringFieldValue>asList(new StringFieldValue("foo"), new StringFieldValue("boo"), new StringFieldValue("apple"))));
+ assertEquals(false, array.containsAll(List.of(new StringFieldValue("bob"))));
+ assertEquals(true, array.containsAll(List.of(new StringFieldValue("foo"), new StringFieldValue("boo"), new StringFieldValue("apple"))));
- array.removeAll(Arrays.<StringFieldValue>asList(new StringFieldValue("foo"), new StringFieldValue("boo")));
+ array.removeAll(List.of(new StringFieldValue("foo"), new StringFieldValue("boo")));
assertEquals(1, array.size());
assertEquals(1, list.size());
@@ -249,7 +249,7 @@ public class ArrayTestCase {
assertFalse(it.hasNext());
}
- array.addAll(Arrays.<StringFieldValue>asList(new StringFieldValue("microsoft"), new StringFieldValue("google")));
+ array.addAll(List.of(new StringFieldValue("microsoft"), new StringFieldValue("google")));
assertEquals(4, array.size());
assertEquals(4, list.size());