public class TextFormatParseInfoTreeData structure which is populated with the locations of each field value parsed from the text.
The locations of primary fields values are retrieved by getLocation or
getLocations. The locations of sub message values are within nested
TextFormatParseInfoTrees and are retrieve by getNestedTree or getNestedTrees.
The TextFormatParseInfoTree is created by a Builder.
Static Methods
builder()
public static TextFormatParseInfoTree.Builder builder()Create a builder for a ParseInfoTree.
| Returns | |
|---|---|
| Type | Description |
TextFormatParseInfoTree.Builder |
the builder |
Methods
getLocation(Descriptors.FieldDescriptor fieldDescriptor, int index)
public TextFormatParseLocation getLocation(Descriptors.FieldDescriptor fieldDescriptor, int index)Get the location in the source of a field's value.
Returns the TextFormatParseLocation for index-th value of the field in the parsed text.
| Parameters | |
|---|---|
| Name | Description |
fieldDescriptor |
Descriptors.FieldDescriptorthe FieldDescriptor of the desired field |
index |
intthe index of the value. |
| Returns | |
|---|---|
| Type | Description |
TextFormatParseLocation |
the TextFormatParseLocation of the value |
getLocations(Descriptors.FieldDescriptor fieldDescriptor)
public List<TextFormatParseLocation> getLocations(Descriptors.FieldDescriptor fieldDescriptor)Retrieve all the locations of a field.
| Parameter | |
|---|---|
| Name | Description |
fieldDescriptor |
Descriptors.FieldDescriptorthe FieldDescriptor of the desired field |
| Returns | |
|---|---|
| Type | Description |
List<TextFormatParseLocation> |
a list of the locations of values of the field. If there are not values or the field doesn't exist, an empty list is returned. |
getNestedTree(Descriptors.FieldDescriptor fieldDescriptor, int index)
public TextFormatParseInfoTree getNestedTree(Descriptors.FieldDescriptor fieldDescriptor, int index)Returns the parse info tree for the given field, which must be a message type.
| Parameters | |
|---|---|
| Name | Description |
fieldDescriptor |
Descriptors.FieldDescriptorthe FieldDescriptor of the desired sub message |
index |
intthe index of message value. |
| Returns | |
|---|---|
| Type | Description |
TextFormatParseInfoTree |
the |
getNestedTrees(Descriptors.FieldDescriptor fieldDescriptor)
public List<TextFormatParseInfoTree> getNestedTrees(Descriptors.FieldDescriptor fieldDescriptor)Retrieve a list of all the location information trees for a sub message field.
| Parameter | |
|---|---|
| Name | Description |
fieldDescriptor |
Descriptors.FieldDescriptorthe FieldDescriptor of the desired field |
| Returns | |
|---|---|
| Type | Description |
List<TextFormatParseInfoTree> |
A list of TextFormatParseInfoTree |