public class SoyTypeRegistry extends Object
Important: Do not use outside of Soy code (treat as superpackage-private).
| Modifier and Type | Class and Description |
|---|---|
static class |
SoyTypeRegistry.Builder
Helper class that assists in the construction of SoyTypeProviders.
|
| Modifier and Type | Field and Description |
|---|---|
static SoyTypeRegistry |
DEFAULT_UNKNOWN
A type registry that defaults all unknown types to the 'unknown' type.
|
| Constructor and Description |
|---|
SoyTypeRegistry() |
| Modifier and Type | Method and Description |
|---|---|
String |
findTypeWithMatchingNamespace(String prefix)
Finds a type whose top-level namespace is a specified prefix, or null if there are none.
|
LegacyObjectMapType |
getOrCreateLegacyObjectMapType(SoyType keyType,
SoyType valueType)
Factory function which creates a legacy object map type, given a key and value type.
|
ListType |
getOrCreateListType(SoyType elementType)
Factory function which creates a list type, given an element type.
|
MapType |
getOrCreateMapType(SoyType keyType,
SoyType valueType)
Factory function which creates a map type, given a key and value type.
|
RecordType |
getOrCreateRecordType(Map<String,SoyType> fields)
Factory function which creates a record type, given a map of fields.
|
SoyType |
getOrCreateType(TypeNode node,
ErrorReporter errorReporter)
Converts a TypeNode into a SoyType.
|
SoyType |
getOrCreateUnionType(Collection<SoyType> members)
Factory function which creates a union type, given the member types.
|
SoyType |
getOrCreateUnionType(SoyType... members)
Factory function which creates a union type, given the member types.
|
SoyType |
getType(String typeName)
Look up a type by name.
|
public static final SoyTypeRegistry DEFAULT_UNKNOWN
@Nullable public SoyType getType(String typeName)
typeName - The fully-qualified name of the type.null.public String findTypeWithMatchingNamespace(String prefix)
public ListType getOrCreateListType(SoyType elementType)
elementType - The element type of the list.public LegacyObjectMapType getOrCreateLegacyObjectMapType(SoyType keyType, SoyType valueType)
keyType - The key type of the map.valueType - The value type of the map.public MapType getOrCreateMapType(SoyType keyType, SoyType valueType)
keyType - The key type of the map.valueType - The value type of the map.public SoyType getOrCreateUnionType(Collection<SoyType> members)
members - The members of the union.public SoyType getOrCreateUnionType(SoyType... members)
members - The members of the union.public RecordType getOrCreateRecordType(Map<String,SoyType> fields)
fields - The map containing field names and types.public SoyType getOrCreateType(@Nullable TypeNode node, ErrorReporter errorReporter)
If any errors are encountered they are reported to the error reporter.