Class TemplateType


public final class TemplateType extends ProxyObjectType
A placeholder type, used as keys in TemplateTypeMaps.
  • Method Details

    • getReferenceName

      public String getReferenceName()
      Description copied from class: ObjectType
      Gets the reference name for this object. This includes named types like constructors, prototypes, and enums. It notably does not include literal types like strings and booleans and structural types.

      Returning an empty string means something different than returning null. An empty string may indicate an anonymous constructor, which we treat differently than a literal type without a reference name. e.g. in InstanceObjectType.appendTo(TypeStringBuilder)

      Overrides:
      getReferenceName in class ProxyObjectType
      Returns:
      the object's name or null if this is an anonymous object
    • toMaybeTemplateType

      public TemplateType toMaybeTemplateType()
      Description copied from class: JSType
      Downcasts this to a TemplateType, or returns null if this is not a template type.
      Overrides:
      toMaybeTemplateType in class ProxyObjectType
    • hasAnyTemplateTypesInternal

      public boolean hasAnyTemplateTypesInternal()
      Overrides:
      hasAnyTemplateTypesInternal in class ProxyObjectType
    • visit

      public <T> T visit(Visitor<T> visitor)
      Description copied from class: JSType
      Visit this type with the given visitor.
      Overrides:
      visit in class ProxyObjectType
      Returns:
      the value returned by the visitor
      See Also:
    • isTypeTransformation

      public boolean isTypeTransformation()
    • getTypeTransformation

      public Node getTypeTransformation()
    • getBound

      public JSType getBound()
    • setBound

      public void setBound(JSType bound)
    • setValidator

      public boolean setValidator(com.google.common.base.Predicate<JSType> validator)
      Description copied from class: JSType
      Certain types have constraints on them at resolution-time. For example, a type in an @extends annotation must be an object. Clients should inject a validator that emits a warning if the type does not validate, and return false.
      Overrides:
      setValidator in class ProxyObjectType
    • containsCycle

      public boolean containsCycle()
      This function returns whether or not there is a cycle in the reference chain of this type.