@Immutable
public class SymbolTable
extends java.lang.Object
Resolved.| Constructor and Description |
|---|
SymbolTable(java.util.Map<java.lang.String,Interface> interfaceByName,
java.util.Map<java.lang.String,TypeRef> typeByName,
java.util.Set<java.lang.String> fieldNames,
java.util.Map<java.lang.String,? extends java.util.List<Method>> methodsBySimpleName) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsFieldName(java.lang.String fieldName) |
com.google.common.collect.ImmutableCollection<TypeRef> |
getDeclaredTypes()
Get all declared types in the symbol table.
|
com.google.common.collect.ImmutableCollection<Interface> |
getInterfaces()
Get all interfaces in the symbol table.
|
static java.lang.String |
getTypeNameInSymbolTable(java.lang.String fullName)
Returns the type name used to store in symbol table.
|
Interface |
lookupInterface(java.lang.String fullName)
Get the interface by its full name.
|
java.util.List<TypeRef> |
lookupMatchingTypes(java.lang.String typeNamePattern,
com.google.protobuf.DescriptorProtos.FieldDescriptorProto.Type kind)
Get the list of types that match the typeNamePattern and the kind.
|
java.util.List<Method> |
lookupMethodSimpleName(java.lang.String methodName) |
TypeRef |
lookupType(java.lang.String fullName)
Get the type by its full name.
|
static java.lang.Iterable<java.lang.String> |
nameCandidates(java.lang.String inContainer,
java.lang.String name)
Returns the candidates for name resolution of a name within a container(e.g.
|
ProtoElement |
resolve(java.lang.String id)
Attempts to resolve the given id into a protocol element, applying certain heuristics.
|
Interface |
resolveInterface(java.lang.String inPackage,
java.lang.String name)
Resolves a interface by a partial name within a given package context, following PB (== C++)
conventions.
|
TypeRef |
resolveType(java.lang.String inPackage,
java.lang.String name)
Resolves a type by its partial name within a given package context, following PB (== C++)
conventions.
|
@Nullable public Interface lookupInterface(java.lang.String fullName)
@Nullable public Interface resolveInterface(java.lang.String inPackage, java.lang.String name)
@Nullable public TypeRef lookupType(java.lang.String fullName)
public java.util.List<TypeRef> lookupMatchingTypes(java.lang.String typeNamePattern, com.google.protobuf.DescriptorProtos.FieldDescriptorProto.Type kind)
foo.bar.* to match any name which starts with the prefix foo.bar, or a fixed
name.public static java.lang.String getTypeNameInSymbolTable(java.lang.String fullName)
Message fullname starts with a '.' if no package is specified in the proto file. Remove the preceding '.' to make it consistent with other types.
@Nullable public TypeRef resolveType(java.lang.String inPackage, java.lang.String name)
public com.google.common.collect.ImmutableCollection<Interface> getInterfaces()
public com.google.common.collect.ImmutableCollection<TypeRef> getDeclaredTypes()
public static java.lang.Iterable<java.lang.String> nameCandidates(java.lang.String inContainer,
java.lang.String name)
a.b.c.M.N and a type name R.s, this will deliver in order
a.b.c.M.N.R.s, a.b.c.M.R.s, a.b.c.R.s, a.b.R.s, a.R.s, R.s.@Nullable public ProtoElement resolve(java.lang.String id)
First the name is attempted to interpret as a type or as an interface, in that order. If that succeeds, the associated proto element is returned.
If resolution does not succeed, the last component of the name is chopped of, and resolution is attempted recursively on the parent name. On success, the chopped name is looked up in the parent depending on its type.
public boolean containsFieldName(java.lang.String fieldName)
@Nullable public java.util.List<Method> lookupMethodSimpleName(java.lang.String methodName)