public SpanTree setSpanTree(SpanTree spanTree) {
        if (spanTrees == null) {
            spanTrees = new HashMap<>(1);
        }
        if (spanTrees.containsKey(spanTree.getName())) {
            throw new IllegalArgumentException("Span tree " + spanTree.getName() + " already exists.");
        }
        spanTrees.put(spanTree.getName(), spanTree);
        spanTree.setStringFieldValue(this);
        return spanTree;
    }
Sets the span tree with annotations over this String.

@param spanTree the span tree with annotations over this String
@return the input spanTree for chaining
@throws IllegalArgumentException if a span tree with the given name already exists.
document/src/main/java/com/yahoo/document/datatypes/StringFieldValue.java