public final class RecordType extends Object implements SoyObjectType
Important: Do not use outside of Soy code (treat as superpackage-private).
SoyType.Kind| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object other) |
String |
getFieldAccessExpr(String fieldContainerExpr,
String fieldName,
SoyBackendKind backendKind)
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.common.collect.ImmutableSet<String> |
getFieldNames()
Return all the possible field names that can be referenced from this ObjectType.
|
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.
|
com.google.common.collect.ImmutableSortedMap<String,SoyType> |
getMembers()
Return the members of this record type.
|
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.
|
int |
hashCode() |
boolean |
isAssignableFrom(SoyType srcType)
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.
|
static RecordType |
of(Map<String,? extends SoyType> members) |
String |
toString() |
public static RecordType of(Map<String,? extends SoyType> members)
public SoyType.Kind getKind()
SoyTypepublic boolean isAssignableFrom(SoyType srcType)
SoyTypesrcType.isAssignableFrom in interface SoyTypesrcType - 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 com.google.common.collect.ImmutableSortedMap<String,SoyType> getMembers()
public String getNameForBackend(SoyBackendKind backend)
SoyObjectTypegetNameForBackend in interface SoyObjectTypebackend - Which backend we're generating code for.public SoyType getFieldType(String fieldName)
SoyObjectTypenull.getFieldType in interface SoyObjectTypefieldName - The name of the field.public com.google.common.collect.ImmutableSet<String> getFieldNames()
SoyObjectTypegetFieldNames in interface SoyObjectTypepublic String getFieldAccessExpr(String fieldContainerExpr, String fieldName, SoyBackendKind backendKind)
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.backendKind - Which backend we're generating code for.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.