Top Description Inners Fields Constructors Methods
com.google.protobuf

public Class TextFormatParseInfoTree

extends Object
Class Inheritance
Imports
com.google.protobuf.Descriptors.FieldDescriptor, java.util.ArrayList, .Collections, .HashMap, .List, .Map, .Map.Entry

Data 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.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private Map<Descriptors.FieldDescriptor, List<TextFormatParseLocation>>
pack-priv Map<Descriptors.FieldDescriptor, List<TextFormatParseInfoTree>>

Constructor Summary

AccessConstructor and Description
private
TextFormatParseInfoTree(Map<Descriptors.FieldDescriptor, List<TextFormatParseLocation>>
a map of fields to location in the source code
locationsFromField
,
Map<Descriptors.FieldDescriptor, List<TextFormatParseInfoTree.Builder>>
a map of fields to parse tree location information builders
subtreeBuildersFromField
)

Construct a TextFormatParseInfoTree.

Method Summary

Modifier and TypeMethod and Description
public static TextFormatParseInfoTree.Builder

Returns:

the builder
builder
()

Create a builder for a ParseInfoTree.

private static <T> T
getFromList(List<T> list, int index, Descriptors.FieldDescriptor fieldDescriptor)

public TextFormatParseLocation

Returns:

the TextFormatParseLocation of the value
getLocation
(final Descriptors.FieldDescriptor
the @{link FieldDescriptor} of the desired field
fieldDescriptor
,
int
the index of the value.
index
)

Get the location in the source of a field's value.

public List<TextFormatParseLocation>

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.
getLocations
(final Descriptors.FieldDescriptor
the @{link FieldDescriptor} of the desired field
fieldDescriptor
)

Retrieve all the locations of a field.

public TextFormatParseInfoTree

Returns:

the ParseInfoTree of the message value. null is returned if the field doesn't exist or the index is out of range.
getNestedTree
(final Descriptors.FieldDescriptor
the @{link FieldDescriptor} of the desired sub message
fieldDescriptor
,
int
the index of message value.
index
)

Returns the parse info tree for the given field, which must be a message type.

public List<TextFormatParseInfoTree>

Returns:

A list of TextFormatParseInfoTree
getNestedTrees
(final Descriptors.FieldDescriptor
the @{link FieldDescriptor} of the desired field
fieldDescriptor
)

Retrieve a list of all the location information trees for a sub message field.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

locationsFromFieldback to summary
private Map<Descriptors.FieldDescriptor, List<TextFormatParseLocation>> locationsFromField
subtreesFromFieldback to summary
pack-priv Map<Descriptors.FieldDescriptor, List<TextFormatParseInfoTree>> subtreesFromField

Constructor Detail

TextFormatParseInfoTreeback to summary
private TextFormatParseInfoTree(Map<Descriptors.FieldDescriptor, List<TextFormatParseLocation>> locationsFromField, Map<Descriptors.FieldDescriptor, List<TextFormatParseInfoTree.Builder>> subtreeBuildersFromField)

Construct a TextFormatParseInfoTree.

Parameters
locationsFromField:Map<Descriptors.FieldDescriptor, List<TextFormatParseLocation>>

a map of fields to location in the source code

subtreeBuildersFromField:Map<Descriptors.FieldDescriptor, List<TextFormatParseInfoTree.Builder>>

a map of fields to parse tree location information builders

Method Detail

builderback to summary
public static TextFormatParseInfoTree.Builder builder()

Create a builder for a ParseInfoTree.

Returns:TextFormatParseInfoTree.Builder

the builder

getFromListback to summary
private static <T> T getFromList(List<T> list, int index, Descriptors.FieldDescriptor fieldDescriptor)
getLocationback to summary
public TextFormatParseLocation getLocation(final 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
fieldDescriptor:Descriptors.FieldDescriptor

the @{link FieldDescriptor} of the desired field

index:int

the index of the value.

Returns:TextFormatParseLocation

the TextFormatParseLocation of the value

Exceptions
IllegalArgumentException:
index is out of range
getLocationsback to summary
public List<TextFormatParseLocation> getLocations(final Descriptors.FieldDescriptor fieldDescriptor)

Retrieve all the locations of a field.

Parameters
fieldDescriptor:Descriptors.FieldDescriptor

the @{link FieldDescriptor} of the desired field

Returns: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.

getNestedTreeback to summary
public TextFormatParseInfoTree getNestedTree(final Descriptors.FieldDescriptor fieldDescriptor, int index)

Returns the parse info tree for the given field, which must be a message type.

Parameters
fieldDescriptor:Descriptors.FieldDescriptor

the @{link FieldDescriptor} of the desired sub message

index:int

the index of message value.

Returns:TextFormatParseInfoTree

the ParseInfoTree of the message value. null is returned if the field doesn't exist or the index is out of range.

Exceptions
IllegalArgumentException:
if index is out of range
getNestedTreesback to summary
public List<TextFormatParseInfoTree> getNestedTrees(final Descriptors.FieldDescriptor fieldDescriptor)

Retrieve a list of all the location information trees for a sub message field.

Parameters
fieldDescriptor:Descriptors.FieldDescriptor

the @{link FieldDescriptor} of the desired field

Returns:List<TextFormatParseInfoTree>

A list of TextFormatParseInfoTree

com.google.protobuf back to summary

public Class TextFormatParseInfoTree.Builder

extends Object
Class Inheritance

Builder for a TextFormatParseInfoTree.

Field Summary

Modifier and TypeField and Description
private Map<Descriptors.FieldDescriptor, List<TextFormatParseLocation>>
private Map<Descriptors.FieldDescriptor, List<TextFormatParseInfoTree.Builder>>

Constructor Summary

AccessConstructor and Description
private
Builder()

Create a root level {@ParseInfoTree } builder.

Method Summary

Modifier and TypeMethod and Description
public TextFormatParseInfoTree

Returns:

the TextFormatParseInfoTree
build
()

Build the TextFormatParseInfoTree.

public TextFormatParseInfoTree.Builder

Returns:

a new Builder for the sub message
getBuilderForSubMessageField
(final Descriptors.FieldDescriptor
the field whose value is the submessage
fieldDescriptor
)

Set for a sub message.

public TextFormatParseInfoTree.Builder
setLocation(final Descriptors.FieldDescriptor
the field
fieldDescriptor
,
TextFormatParseLocation
source code location information
location
)

Record the starting location of a single value for a field.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

locationsFromFieldback to summary
private Map<Descriptors.FieldDescriptor, List<TextFormatParseLocation>> locationsFromField
subtreeBuildersFromFieldback to summary
private Map<Descriptors.FieldDescriptor, List<TextFormatParseInfoTree.Builder>> subtreeBuildersFromField

Constructor Detail

Builderback to summary
private Builder()

Create a root level {@ParseInfoTree } builder.

Method Detail

buildback to summary
public TextFormatParseInfoTree build()

Build the TextFormatParseInfoTree.

Returns:TextFormatParseInfoTree

the TextFormatParseInfoTree

getBuilderForSubMessageFieldback to summary
public TextFormatParseInfoTree.Builder getBuilderForSubMessageField(final Descriptors.FieldDescriptor fieldDescriptor)

Set for a sub message.

A new builder is created for a sub message. The builder that is returned is a new builder. The return is not the invoked builder.getBuilderForSubMessageField.

Parameters
fieldDescriptor:Descriptors.FieldDescriptor

the field whose value is the submessage

Returns:TextFormatParseInfoTree.Builder

a new Builder for the sub message

setLocationback to summary
public TextFormatParseInfoTree.Builder setLocation(final Descriptors.FieldDescriptor fieldDescriptor, TextFormatParseLocation location)

Record the starting location of a single value for a field.

Parameters
fieldDescriptor:Descriptors.FieldDescriptor

the field

location:TextFormatParseLocation

source code location information