@Singleton public final class SoyTypeRegistry extends Object
Important: Do not use outside of Soy code (treat as superpackage-private).
| 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() |
SoyTypeRegistry(Set<SoyTypeProvider> typeProviders) |
| Modifier and Type | Method and Description |
|---|---|
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 |
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
@Inject public SoyTypeRegistry(Set<SoyTypeProvider> typeProviders)
public SoyTypeRegistry()
public SoyType getType(String typeName)
typeName - The fully-qualified name of the type.null.public ListType getOrCreateListType(SoyType elementType)
elementType - The element type of the list.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.