public final class SoyProtoTypeImpl extends Object implements SoyObjectType, SoyProtoType
SoyType subclass which describes a protocol buffer type.| Modifier and Type | Class and Description |
|---|---|
static interface |
SoyProtoTypeImpl.Value
Interface used to indicate that a value is a proto.
|
SoyType.Kind| Constructor and Description |
|---|
SoyProtoTypeImpl(SoyTypeRegistry typeRegistry,
com.google.protobuf.Descriptors.Descriptor descriptor,
Set<com.google.protobuf.Descriptors.FieldDescriptor> extensions) |
| Modifier and Type | Method and Description |
|---|---|
String |
getDescriptorExpression()
For ParseInfo generation, return a string that represents the Java
source expression for the static descriptor constant.
|
String |
getFieldAccessExpr(String fieldContainerExpr,
String fieldName,
SoyBackendKind backend)
Return the expression used to access the value of the field, for a given output context.
|
com.google.common.collect.ImmutableSet<String> |
getFieldAccessImports(String fieldName,
SoyBackendKind backend)
In some cases,
accessing a field requires importing
symbols into the generated code (example being protobuf extension fields which
require importing the extension type). |
com.google.protobuf.Descriptors.FieldDescriptor |
getFieldDescriptor(String fieldName) |
com.google.common.collect.ImmutableSet<String> |
getFieldNames()
Returns all the field names of this proto.
|
SoyType |
getFieldType(String fieldName)
Return the data type of the field with the given name; If there's no such
field, then return
null. |
SoyType.Kind |
getKind()
Returns what kind of type this is.
|
String |
getName()
Return the fully-qualified name of this object type.
|
String |
getNameForBackend(SoyBackendKind backend)
Return the fully-qualified name of this type for a given output context.
|
boolean |
isAssignableFrom(SoyType fromType)
Returns true if a parameter or field of this type can be assigned from
a value of
srcType. |
boolean |
isInstance(SoyValue value)
Returns true if the given value is an instance of this type.
|
Class<? extends SoyValue> |
javaType()
Returns the java class for the the SoyValue subclass that is used to represent this type.
|
String |
toString() |
public SoyProtoTypeImpl(SoyTypeRegistry typeRegistry, com.google.protobuf.Descriptors.Descriptor descriptor, Set<com.google.protobuf.Descriptors.FieldDescriptor> extensions)
public SoyType.Kind getKind()
SoyTypepublic boolean isAssignableFrom(SoyType fromType)
SoyTypesrcType.isAssignableFrom in interface SoyTypefromType - The type of the incoming value.public boolean isInstance(SoyValue value)
SoyTypeisInstance in interface SoyTypevalue - The value to test.public Class<? extends SoyValue> javaType()
SoyTypepublic String getName()
SoyObjectTypegetName in interface SoyObjectTypepublic SoyType getFieldType(String fieldName)
SoyObjectTypenull.getFieldType in interface SoyObjectTypefieldName - The name of the field.public String getNameForBackend(SoyBackendKind backend)
SoyObjectTypegetNameForBackend in interface SoyObjectTypebackend - Which backend we're generating code for.public String getFieldAccessExpr(String fieldContainerExpr, String fieldName, SoyBackendKind backend)
SoyObjectTypegetFieldAccessExpr in interface SoyObjectTypefieldContainerExpr - An expression that evaluates to the container of the named field.
This expression may have any operator precedence that binds more tightly than unary
operators.fieldName - Name of the field.backend - Which backend we're generating code for.public com.google.protobuf.Descriptors.FieldDescriptor getFieldDescriptor(String fieldName)
public com.google.common.collect.ImmutableSet<String> getFieldAccessImports(String fieldName, SoyBackendKind backend)
SoyObjectTypeaccessing a field requires importing
symbols into the generated code (example being protobuf extension fields which
require importing the extension type). If this field requires imports, then this
method will return the strings representing the symbol needed to import.
Otherwise, returns the empty set.getFieldAccessImports in interface SoyObjectTypefieldName - The name of the field being accessed.backend - Which backend we're generating code for.public String getDescriptorExpression()
SoyProtoTypegetDescriptorExpression in interface SoyProtoTypepublic com.google.common.collect.ImmutableSet<String> getFieldNames()
getFieldNames in interface SoyObjectType