Package com.google.protobuf
Class TextFormatParseInfoTree
- java.lang.Object
-
- com.google.protobuf.TextFormatParseInfoTree
-
public class TextFormatParseInfoTree extends java.lang.ObjectData structure which is populated with the locations of each field value parsed from the text.The locations of primary fields values are retrieved by
getLocationorgetLocations. The locations of sub message values are within nestedTextFormatParseInfoTrees and are retrieve bygetNestedTreeorgetNestedTrees.The
TextFormatParseInfoTreeis created by a Builder.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTextFormatParseInfoTree.BuilderBuilder for aTextFormatParseInfoTree.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static TextFormatParseInfoTree.Builderbuilder()Create a builder for aParseInfoTree.TextFormatParseLocationgetLocation(Descriptors.FieldDescriptor fieldDescriptor, int index)Get the location in the source of a field's value.java.util.List<TextFormatParseLocation>getLocations(Descriptors.FieldDescriptor fieldDescriptor)Retrieve all the locations of a field.TextFormatParseInfoTreegetNestedTree(Descriptors.FieldDescriptor fieldDescriptor, int index)Returns the parse info tree for the given field, which must be a message type.java.util.List<TextFormatParseInfoTree>getNestedTrees(Descriptors.FieldDescriptor fieldDescriptor)Retrieve a list of all the location information trees for a sub message field.
-
-
-
Method Detail
-
getLocations
public java.util.List<TextFormatParseLocation> getLocations(Descriptors.FieldDescriptor fieldDescriptor)
Retrieve all the locations of a field.- Parameters:
fieldDescriptor- theDescriptors.FieldDescriptorof the desired field- Returns:
- 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.
-
getLocation
public TextFormatParseLocation getLocation(Descriptors.FieldDescriptor fieldDescriptor, int index)
Get the location in the source of a field's value.Returns the
TextFormatParseLocationfor index-th value of the field in the parsed text.- Parameters:
fieldDescriptor- theDescriptors.FieldDescriptorof the desired fieldindex- the index of the value.- Returns:
- the
TextFormatParseLocationof the value - Throws:
java.lang.IllegalArgumentException- index is out of range
-
getNestedTrees
public java.util.List<TextFormatParseInfoTree> getNestedTrees(Descriptors.FieldDescriptor fieldDescriptor)
Retrieve a list of all the location information trees for a sub message field.- Parameters:
fieldDescriptor- theDescriptors.FieldDescriptorof the desired field- Returns:
- A list of
TextFormatParseInfoTree
-
getNestedTree
public TextFormatParseInfoTree getNestedTree(Descriptors.FieldDescriptor fieldDescriptor, int index)
Returns the parse info tree for the given field, which must be a message type.- Parameters:
fieldDescriptor- theDescriptors.FieldDescriptorof the desired sub messageindex- the index of message value.- Returns:
- the
ParseInfoTreeof the message value.nullis returned if the field doesn't exist or the index is out of range. - Throws:
java.lang.IllegalArgumentException- if index is out of range
-
builder
public static TextFormatParseInfoTree.Builder builder()
Create a builder for aParseInfoTree.- Returns:
- the builder
-
-