public class StringFieldValue extends FieldValue
Document
s and
other FieldValue
s.
String fields can only contain text characters, as defined by Text.isTextCharacter(int)
Modifier and Type | Class and Description |
---|---|
private static class |
StringFieldValue.Factory |
FieldValue.RecursiveIteratorHandler
Modifier and Type | Field and Description |
---|---|
static int |
classId |
private Map<String,SpanTree> |
spanTrees |
private String |
value |
Constructor and Description |
---|
StringFieldValue()
Creates a new StringFieldValue holding an empty String.
|
StringFieldValue(String value)
Creates a new StringFieldValue with the given value.
|
Modifier and Type | Method and Description |
---|---|
void |
assign(Object o)
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.
|
void |
clear()
Sets the wrapped String to be an empty String, and clears all span trees.
|
StringFieldValue |
clone()
Clones this StringFieldValue and its span trees.
|
int |
compareTo(FieldValue fieldValue) |
void |
deserialize(Field field,
FieldReader reader)
Read a field value from the specified reader
|
boolean |
equals(Object o) |
DataType |
getDataType()
Returns
DataType .STRING. |
static PrimitiveDataType.Factory |
getFactory() |
SpanTree |
getSpanTree(String name)
Returns the span tree associated with the given name, or null if this does not exist.
|
Map<String,SpanTree> |
getSpanTreeMap() |
Collection<SpanTree> |
getSpanTrees()
Returns an unmodifiable Collection of the span trees with annotations over this String, if any.
|
String |
getString()
Returns the String value wrapped by this StringFieldValue.
|
Object |
getWrappedValue()
Returns the String value wrapped by this StringFieldValue.
|
int |
hashCode() |
void |
printXml(XmlStream xml)
Prints XML in Vespa Document XML format for this StringFieldValue.
|
SpanTree |
removeSpanTree(String name)
Removes the span tree associated with the given name.
|
void |
serialize(Field field,
FieldWriter writer)
Write out field value to the specified writer
|
SpanTree |
setSpanTree(SpanTree spanTree)
Sets the span tree with annotations over this String.
|
void |
setUnChecked(String s)
Only for use by deserializer to avoid the cost of verifying input.
|
private void |
setValue(String value) |
String |
toString()
Returns the String value wrapped by this StringFieldValue.
|
private static void |
validateTextString(String value) |
checkAssign, create, deserialize, getRecursiveValue, getRecursiveValue, iterateNested, onDeserialize, onSerialize, serialize, toXml
public static final int classId
private String value
public StringFieldValue()
public StringFieldValue(String value)
value
- the value to wrap.IllegalArgumentException
- if the string contains non-text characters as defined by
Text.isTextCharacter(int)
public static PrimitiveDataType.Factory getFactory()
private static void validateTextString(String value)
private void setValue(String value)
public DataType getDataType()
DataType
.STRING.getDataType
in class FieldValue
DataType
public StringFieldValue clone()
clone
in class FieldValue
public void clear()
clear
in class FieldValue
public void assign(Object o)
assign
in class FieldValue
o
- the new String to assign to this. An argument of null is equal to calling clear().IllegalArgumentException
- if the given argument is a string containing non-text characters as defined by
Text.isTextCharacter(int)
public Collection<SpanTree> getSpanTrees()
public final Map<String,SpanTree> getSpanTreeMap()
public SpanTree getSpanTree(String name)
name
- the name of the span tree to returnpublic SpanTree setSpanTree(SpanTree spanTree)
spanTree
- the span tree with annotations over this StringIllegalArgumentException
- if a span tree with the given name already exists.public SpanTree removeSpanTree(String name)
name
- the name of the span tree to removepublic String getString()
public Object getWrappedValue()
getWrappedValue
in class FieldValue
public void printXml(XmlStream xml)
printXml
in class FieldValue
xml
- the stream to print to.public String toString()
toString
in class com.yahoo.vespa.objects.Identifiable
public boolean equals(Object o)
equals
in class com.yahoo.vespa.objects.Identifiable
public int hashCode()
hashCode
in class com.yahoo.vespa.objects.Identifiable
public void serialize(Field field, FieldWriter writer)
FieldValue
serialize
in class FieldValue
public void deserialize(Field field, FieldReader reader)
FieldValue
deserialize
in class FieldValue
public int compareTo(FieldValue fieldValue)
compareTo
in interface Comparable<FieldValue>
compareTo
in class FieldValue
public void setUnChecked(String s)
Copyright © 2018. All rights reserved.