public interface ObjectTypeI extends TypeI
TypeI.Nullability, TypeI.TypeInference| Modifier and Type | Method and Description |
|---|---|
FunctionTypeI |
getConstructor()
Gets this object's constructor, or null if it is a native
object (constructed natively vs.
|
TypeI |
getEnumeratedTypeOfEnumObject()
If this type is an enum object, returns the declared type of the elements.
|
TypeI |
getInstantiatedTypeArgument(TypeI supertype)
Given an generic supertype of this,
returns the type argument as instantiated by this type.
|
TypeI |
getLegacyResolvedType()
Only called on instances of NamedType.
|
FunctionTypeI |
getOwnerFunction()
If this type represents the object in a function's prototype property, return that function.
|
Node |
getOwnPropertyDefSite(java.lang.String propertyName) |
JSDocInfo |
getOwnPropertyJSDocInfo(java.lang.String propertyName)
TODO(dimvar): rename methods in this file that use the phrase OwnProp to NonInheritedProp,
to avoid ambiguity with the built-in methods such as hasOwnProperty, which have
different semantics.
|
java.lang.Iterable<java.lang.String> |
getOwnPropertyNames()
Return the names of all non-inherited properties of this type, including prototype properties.
|
Node |
getPropertyDefSite(java.lang.String propertyName) |
JSDocInfo |
getPropertyJSDocInfo(java.lang.String propertyName) |
java.util.Set<java.lang.String> |
getPropertyNames()
Returns a set of properties defined or inferred on this type or any of its supertypes.
|
TypeI |
getPropertyType(java.lang.String propName)
Returns the type of property propName on this object, or null if the property doesn't exist.
|
ObjectTypeI |
getPrototypeObject()
Returns the __proto__ object of this object type, NOT the ".prototype" property.
|
ObjectTypeI |
getRawType()
If this type is not generic, return as is.
|
FunctionTypeI |
getSuperClassConstructor() |
com.google.common.collect.ImmutableList<? extends TypeI> |
getTemplateTypes()
For an instantiated generic type, return the types that the type variables are mapped to.
|
ObjectTypeI |
getTopDefiningInterface(java.lang.String propName)
Given an interface and a property, finds a top-most super interface
that has the property defined (including this interface).
|
boolean |
hasOwnProperty(java.lang.String propertyName) |
boolean |
hasProperty(java.lang.String propertyName) |
ObjectTypeI |
instantiateGenericsWithUnknown()
When this type represents an instance of a generic class/interface Foo, return an instance
of Foo with type parameters mapped to the unknown type.
|
boolean |
isAmbiguousObject()
Returns true if this object is an anonymous object or function type (i.e.
|
boolean |
isInstanceType()
Whether this type is an instance object of some constructor.
|
boolean |
isLegacyNamedType()
The old type checker uses NamedType to wrap types (e.g., defined by typedefs), and to represent
unresolved forward declares.
|
ObjectTypeI |
normalizeObjectForCheckAccessControls()
Works around the OTI distinction between prototype-object types and other objects.
|
ObjectTypeI |
withoutStrayProperties()
Remove any properties that exist only on this specific instance: stray properties,
or properties whose type has been specialized.
|
autobox, autoboxAndGetObject, containsArray, getDisplayName, getEnumeratedTypeOfEnumElement, getGreatestSubtypeWithProperty, getJSDocInfo, getTypeParameters, getUnionMembers, isBooleanValueType, isBottom, isBoxableScalar, isConstructor, isEnumElement, isEnumObject, isEquivalentTo, isFullyInstantiated, isFunctionType, isGenericObjectType, isInstanceofObject, isInterface, isLiteralObject, isNullable, isNullType, isNumberValueType, isObjectType, isPartiallyInstantiated, isPrototypeObject, isRecordType, isSomeUnknownType, isStringValueType, isStructuralInterface, isSubtypeOf, isSubtypeWithoutStructuralTyping, isTop, isTypeVariable, isUnionType, isUnknownType, isUnresolved, isUnresolvedOrResolvedUnknown, isVoidable, isVoidType, meetWith, restrictByNotNullOrUndefined, toAnnotationString, toMaybeFunctionType, toMaybeObjectType, typeInferenceFunctionTypeI getConstructor()
FunctionTypeI getSuperClassConstructor()
ObjectTypeI getPrototypeObject()
JSDocInfo getOwnPropertyJSDocInfo(java.lang.String propertyName)
JSDocInfo getPropertyJSDocInfo(java.lang.String propertyName)
Node getOwnPropertyDefSite(java.lang.String propertyName)
Node getPropertyDefSite(java.lang.String propertyName)
boolean isInstanceType()
ObjectTypeI getRawType()
com.google.common.collect.ImmutableList<? extends TypeI> getTemplateTypes()
ObjectTypeI instantiateGenericsWithUnknown()
boolean hasProperty(java.lang.String propertyName)
boolean hasOwnProperty(java.lang.String propertyName)
java.lang.Iterable<java.lang.String> getOwnPropertyNames()
ObjectTypeI normalizeObjectForCheckAccessControls()
boolean isAmbiguousObject()
boolean isLegacyNamedType()
TypeI getLegacyResolvedType()
ObjectTypeI getTopDefiningInterface(java.lang.String propName)
FunctionTypeI getOwnerFunction()
TypeI getPropertyType(java.lang.String propName)
TypeI getEnumeratedTypeOfEnumObject()
TypeI getInstantiatedTypeArgument(TypeI supertype)
(Iterable<Foo>).getInstantiatedTypeArgument(Iterable<?>) returns Foo,
and
/** {@literal @}template A * /
class Foo {}
/**
* {@literal @}template B
* {@literal @}extends {Foo<Array<B>>}
* /
class Bar {}
(Bar<string>).getInstantiatedTypeArguments(Bar<?>) returns string
(Bar<string>).getInstantiatedTypeArguments(Foo<?>) returns Array<string>
This is used, for example, in type-checking for-of and yield.java.util.Set<java.lang.String> getPropertyNames()
ObjectTypeI withoutStrayProperties()
Copyright © 2009-2018 Google. All Rights Reserved.