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
-
public final class TemplateType extends ProxyObjectType
A placeholder type, used as keys inTemplateTypeMaps.
-
-
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 booleancontainsCycle()This function returns whether or not there is a cycle in the reference chain of this type.JSTypegetBound()java.lang.StringgetReferenceName()Gets the reference name for this object.NodegetTypeTransformation()booleanhasAnyTemplateTypesInternal()booleanisTypeTransformation()voidsetBound(JSType bound)booleansetValidator(com.google.common.base.Predicate<JSType> validator)Certain types have constraints on them at resolution-time.TemplateTypetoMaybeTemplateType()Downcasts this to a TemplateType, or returns null if this is not a template type.<T> Tvisit(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, hasCachedValues, hasOwnProperty, hasReferenceName, isFunctionPrototypeType, isObject, isPropertyInExterns, isPropertyTypeDeclared, isPropertyTypeInferred, setPropertyNode
-
Methods inherited from class com.google.javascript.rhino.jstype.JSType
areIdentical, areSimilar, assertFunctionType, assertObjectType, autobox, autoboxesTo, canCastTo, canTestForEqualityWith, canTestForShallowEqualityWith, containsReferenceAncestor, dereference, differsFrom, equals, findPropertyType, getEnumeratedTypeOfEnumElement, getGreatestSubtype, 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, isNominalConstructorOrInterface, 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
-
-
-
-
Method Detail
-
getReferenceName
public java.lang.String getReferenceName()
Description copied from class:ObjectTypeGets 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:
getReferenceNamein classProxyObjectType- Returns:
- the object's name or
nullif this is an anonymous object
-
toMaybeTemplateType
public TemplateType toMaybeTemplateType()
Description copied from class:JSTypeDowncasts this to a TemplateType, or returns null if this is not a template type.- Overrides:
toMaybeTemplateTypein classProxyObjectType
-
hasAnyTemplateTypesInternal
public boolean hasAnyTemplateTypesInternal()
- Overrides:
hasAnyTemplateTypesInternalin classProxyObjectType
-
visit
public <T> T visit(Visitor<T> visitor)
Description copied from class:JSTypeVisit this type with the given visitor.- Overrides:
visitin 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:JSTypeCertain types have constraints on them at resolution-time. For example, a type in an@extendsannotation must be an object. Clients should inject a validator that emits a warning if the type does not validate, and return false.- Overrides:
setValidatorin classProxyObjectType
-
containsCycle
public boolean containsCycle()
This function returns whether or not there is a cycle in the reference chain of this type.
-
-