Class TemplateType
- java.lang.Object
-
- com.google.javascript.rhino.jstype.JSType
-
- com.google.javascript.rhino.jstype.ObjectType
-
- com.google.javascript.rhino.jstype.ProxyObjectType
-
- com.google.javascript.rhino.jstype.TemplateType
-
- All Implemented Interfaces:
java.io.Serializable
public final class TemplateType extends ProxyObjectType
A placeholder type, used as keys inTemplateTypeMap
s.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.javascript.rhino.jstype.JSType
JSType.HasPropertyKind, JSType.Nullability, JSType.SubtypingMode, JSType.TypePair
-
-
Field Summary
-
Fields inherited from class com.google.javascript.rhino.jstype.JSType
templateTypeMap
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsCycle()
This function returns whether or not there is a cycle in the reference chain of this type.JSType
getBound()
java.lang.String
getReferenceName()
Gets the reference name for this object.Node
getTypeTransformation()
boolean
hasAnyTemplateTypesInternal()
boolean
isTypeTransformation()
void
setBound(JSType bound)
boolean
setValidator(com.google.common.base.Predicate<JSType> validator)
Certain types have constraints on them at resolution-time.TemplateType
toMaybeTemplateType()
Downcasts this to a TemplateType, or returns null if this is not a function.<T> T
visit(Visitor<T> visitor)
Visit this type with the given visitor.-
Methods inherited from class com.google.javascript.rhino.jstype.ProxyObjectType
canBeCalled, collapseUnion, findPropertyTypeWithoutConsideringTemplateTypes, getConstructor, getCtorExtendedInterfaces, getCtorImplementedInterfaces, getImplicitPrototype, getJSDocInfo, getOwnerFunction, getPropertyKind, getTemplateParamCount, getTemplateTypeMap, getTemplateTypes, getTypeOfThis, isAllType, isCheckedUnknownType, isConstructor, isDict, isInstanceType, isInterface, isNativeObjectType, isNominalType, isNoObjectType, isNoResolvedType, isNoType, isNullable, isOrdinaryFunction, isStruct, isStructuralType, isUnknownType, isVoidable, loosenTypecheckingDueToForwardReferencedSupertype, matchConstraint, matchesNumberContext, matchesObjectContext, matchesStringContext, matchesSymbolContext, removeProperty, setJSDocInfo, setPropertyJSDocInfo, testForEquality, toMaybeEnumElementType, toMaybeEnumType, toMaybeFunctionType, toMaybeRecordType, toMaybeTemplatizedType, toMaybeUnionType, visitReferenceType
-
Methods inherited from class com.google.javascript.rhino.jstype.ObjectType
cast, clearCachedValues, createDelegateSuffix, defineDeclaredProperty, defineInferredProperty, defineSynthesizedProperty, findClosestDefinition, getClosestDefiningType, getDisplayName, getEnumeratedTypeOfEnumObject, getImplicitPrototypeChain, getNormalizedReferenceName, getOwnPropertyDefSite, getOwnPropertyJSDocInfo, getOwnPropertyKind, getOwnPropertyNames, getOwnSlot, getPossibleToBooleanOutcomes, getPropertiesCount, getPropertyDefSite, getPropertyJSDocInfo, getPropertyNames, getPropertyNode, getPropertyType, getPropertyTypeMap, getRawType, getSlot, getSuperClassConstructor, getTopMostDefiningType, hasCachedValues, hasOwnProperty, hasReferenceName, isAmbiguousObject, isFunctionPrototypeType, isObject, isPropertyInExterns, isPropertyTypeDeclared, isPropertyTypeInferred, setPropertyNode
-
Methods inherited from class com.google.javascript.rhino.jstype.JSType
areIdentical, assertFunctionType, assertObjectType, autobox, autoboxesTo, canCastTo, canTestForEqualityWith, canTestForShallowEqualityWith, containsReferenceAncestor, dereference, differsFrom, equals, findPropertyType, getEnumeratedTypeOfEnumElement, getGreatestSubtype, getGreatestSubtypeWithProperty, getLeastSupertype, getPropertyKind, getRestrictedTypeGivenOutcome, getTypeParameters, getTypesUnderEquality, getTypesUnderInequality, getTypesUnderShallowEquality, getTypesUnderShallowInequality, getUnionMembers, hasAnyTemplateTypes, hasDisplayName, hashCode, hasProperty, isArrayType, isBigIntObjectType, isBigIntOrNumber, isBigIntValueType, isBooleanObjectType, isBooleanValueType, isBoxableScalar, isDateType, isEmptyType, isEnumElementType, isEnumType, isExplicitlyVoidable, isFunctionType, isGlobalThisType, isLiteralObject, isNamedType, isNominalConstructor, isNullType, isNumber, isNumberObjectType, isNumberValueType, isObjectType, isOnlyBigInt, isRawTypeOfTemplatizedType, isRecordType, isRegexpType, isResolved, isSomeUnknownType, isString, isStringObjectType, isStringValueType, isStructuralInterface, isSubtype, isSubtype, isSubtypeOf, isSubtypeOf, isSubtypeWithoutStructuralTyping, isSuccessfullyResolved, isSymbol, isSymbolObjectType, isSymbolValueType, isTemplateType, isTemplatizedType, isUnionType, isUnresolved, isUnresolvedOrResolvedUnknown, isUnsuccessfullyResolved, isVoidType, mergeSupertypeTemplateTypes, resolve, restrictByNotNull, restrictByNotNullOrUndefined, restrictByNotUndefined, toAnnotationString, toMaybeFunctionType, toMaybeNamedType, toMaybeObjectType, toObjectType, toString, unboxesTo
-
-
-
-
Method Detail
-
getReferenceName
public java.lang.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 classProxyObjectType
- 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 function.- Overrides:
toMaybeTemplateType
in classProxyObjectType
-
hasAnyTemplateTypesInternal
public boolean hasAnyTemplateTypesInternal()
- Overrides:
hasAnyTemplateTypesInternal
in classProxyObjectType
-
visit
public <T> T visit(Visitor<T> visitor)
Description copied from class:JSType
Visit this type with the given visitor.- Overrides:
visit
in classProxyObjectType
- Returns:
- the value returned by the visitor
- See Also:
Visitor
-
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 classProxyObjectType
-
containsCycle
public boolean containsCycle()
This function returns whether or not there is a cycle in the reference chain of this type.
-
-