Class TemplateTypeMap
- java.lang.Object
-
- com.google.javascript.rhino.jstype.TemplateTypeMap
-
public class TemplateTypeMap extends java.lang.Object
Manages a mapping from TemplateType to its resolved JSType. Provides utility methods for cloning/extending the map.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 bykeys
andvalues
respectively.TemplateTypeMap
copyWithExtension(TemplateTypeMap extension)
Create a new map in which the keys and values have been extended byextension
.JSType
getResolvedTemplateType(TemplateType key)
Returns the JSType value associated with the specified template key.com.google.common.collect.ImmutableList<TemplateType>
getTemplateKeys()
Returns a list of all template keys.TemplateType
getTemplateTypeKeyByName(java.lang.String keyName)
com.google.common.collect.ImmutableList<JSType>
getTemplateValues()
boolean
hasTemplateKey(TemplateType templateKey)
Returns true if this map contains the specified template key, false otherwise.boolean
hasTemplateType(TemplateType key)
Returns true if there is a JSType value associated with the specified template key; false otherwise.boolean
isEmpty()
Returns true if the map is empty; false otherwise.int
size()
java.lang.String
toString()
-
-
-
Method Detail
-
copyWithExtension
public TemplateTypeMap copyWithExtension(TemplateTypeMap extension)
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 bykeys
andvalues
respectively.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
public com.google.common.collect.ImmutableList<TemplateType> getTemplateKeys()
Returns a list of all template keys.
-
getTemplateValues
public com.google.common.collect.ImmutableList<JSType> getTemplateValues()
-
hasTemplateKey
public boolean hasTemplateKey(TemplateType templateKey)
Returns true if this map contains the specified template key, false otherwise.
-
hasTemplateType
public boolean hasTemplateType(TemplateType key)
Returns true if there is a JSType value associated with the specified template key; false otherwise.
-
getTemplateTypeKeyByName
public TemplateType getTemplateTypeKeyByName(java.lang.String keyName)
-
getResolvedTemplateType
public JSType getResolvedTemplateType(TemplateType key)
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
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-