Class TemplateTypeMap
java.lang.Object
com.google.javascript.rhino.jstype.TemplateTypeMap
Manages a mapping from TemplateType to its resolved JSType. Provides utility methods for
cloning/extending the map.
-
Method Summary
Modifier and TypeMethodDescriptioncopyWithExtension(com.google.common.collect.ImmutableList<TemplateType> keys, com.google.common.collect.ImmutableList<JSType> values) Create a new map in which the keys and values have been extended bykeysandvaluesrespectively.copyWithExtension(TemplateTypeMap extension) Create a new map in which the keys and values have been extended byextension.com.google.common.collect.ImmutableList<Integer> @Nullable TemplateTypegetLastTemplateTypeKeyByName(String keyName) Returns the final template key matching this name in the ordered list of template keysReturns the JSType value associated with the specified template key.com.google.common.collect.ImmutableList<TemplateType> Returns a list of all template keys.com.google.common.collect.ImmutableList<JSType> booleanhasTemplateKey(TemplateType templateKey) Returns true if this map contains the specified template key, false otherwise.booleanReturns true if there is a JSType value associated with the specified template key; false otherwise.booleanisEmpty()Returns true if the map is empty; false otherwise.intsize()toString()
-
Method Details
-
copyWithExtension
Create a new map in which the keys and values have been extended byextension.Before extension, any unfilled values in the initial map will be filled with `?`.
-
copyWithExtension
public TemplateTypeMap copyWithExtension(com.google.common.collect.ImmutableList<TemplateType> keys, com.google.common.collect.ImmutableList<JSType> values) Create a new map in which the keys and values have been extended bykeysandvaluesrespectively.Before extension, any unfilled values in the initial map will be filled with `?`.
-
size
public int size() -
isEmpty
public boolean isEmpty()Returns true if the map is empty; false otherwise. -
getTemplateKeys
Returns a list of all template keys. -
getTemplateValues
-
hasTemplateKey
Returns true if this map contains the specified template key, false otherwise. -
hasTemplateType
Returns true if there is a JSType value associated with the specified template key; false otherwise. -
getLastTemplateTypeKeyByName
Returns the final template key matching this name in the ordered list of template keysCaution: there may be multiple template keys with the same name. Before using this method, consider whether you really want reference name string equality over TemplateType identity- based equality.
-
getResolvedTemplateType
Returns the JSType value associated with the specified template key. If no JSType value is associated, returns the upper bound for generic, UNKNOWN_TYPE if unspecified. -
toString
-
getIndicesOfSubmapsForTesting
-