public class FunctionType extends AbstractType implements IFunctionType, IGenericMethodInfo
| Modifier and Type | Field and Description |
|---|---|
protected Set<IType> |
_allTypesInHierarchy |
EMPTY_ARRAY, EMPTY_TYPE_ARRAY, EMPTY_TYPE_LIST| Modifier | Constructor and Description |
|---|---|
|
FunctionType(FunctionType source,
IType gsClass) |
protected |
FunctionType(FunctionType source,
IType returnType,
IType[] paramTypes) |
protected |
FunctionType(FunctionType source,
TypeVarToTypeMap actualParamByVarName,
boolean bKeepTypeVars) |
|
FunctionType(IMethodInfo mi) |
|
FunctionType(IMethodInfo mi,
boolean lazyTypes) |
|
FunctionType(String strFunctionName,
IType retType,
IType[] paramTypes)
Construct a FunctionType with the specified return type and parameter types array.
|
|
FunctionType(String strFunctionName,
IType retType,
IType[] paramTypes,
IGenericTypeVariable[] typeVars)
Construct a generic FunctionType with the specified return type, parameter
types, and generic type variables.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
areEnclosingTypesEqual(FunctionType funcType) |
boolean |
areParamsCompatible(IFunctionType rhsFunctionType) |
static boolean |
areParamsCompatible(IFunctionType lhsType,
IFunctionType rhsType) |
protected boolean |
areReturnTypesAssignable(FunctionType that) |
protected boolean |
areSameTypes(IType t1,
IType t2) |
protected void |
copyFields(FunctionType source) |
boolean |
equals(Object o) |
static IType[] |
findContravariantParams(IType[] lhsParams,
IType[] rhsParams) |
Set<IType> |
getAllTypesInHierarchy()
Returns a Set of all IIntrinsicTypes that this class is assignable from,
including this class.
|
Object |
getArrayComponent(Object array,
int iIndex)
Returns the value of the indexed component in the specified
array object.
|
int |
getArrayLength(Object array)
Returns the length of the specified array object.
|
IType |
getArrayType()
Make an array type from this type.
|
IType |
getComponentType()
If this is an array type, a type representing the component type of the
array.
|
Set<IType> |
getCompoundTypeComponents() |
IExpression[] |
getDefaultValueExpressions() |
String |
getDisplayName()
The display name of this intrinsic type.
|
IType |
getEnclosingType()
Returns the type immediately enclosing this type.
|
IType |
getGenericType()
If this is a parameterized type, returns the generic type this type
parameterizes.
|
IGenericTypeVariable[] |
getGenericTypeVariables()
Returns an array of GenericTypeVariables declared with this Generic Type.
|
IType[] |
getInterfaces() |
IType |
getIntrinsicType() |
IMethodInfo |
getMethodInfo()
An associated IMethodInfo.
|
IFeatureInfo |
getMethodOrConstructorInfo() |
int |
getModifiers()
Returns the modifiers for this type, encoded in an integer.
|
String |
getName()
The fully qualified name of this intrinsic type.
|
String |
getNamespace()
The namespace for this class.
|
IType |
getOwningParameterizedType() |
IType[] |
getParameterizedParameterTypes(IType... typeParams) |
IType[] |
getParameterizedParameterTypes2(IType ownersType,
IType... typeParams) |
IType |
getParameterizedReturnType(IType... typeParams) |
ParameterizedFunctionType |
getParameterizedType(IType... typeParams)
Assuming this intrinsic type is a Generic type, return the parameterized
type associated with the given list of type parameters.
|
String[] |
getParameterNames() |
IType[] |
getParameterTypes() |
String |
getParamSignature()
Formatted signature of the form "
|
String |
getParamSignatureForCurrentModule() |
static String |
getParamTypeNameFromJavaBackedType(IType paramType) |
String |
getRelativeName()
The relative or unqualified name.
|
IType |
getReturnType() |
FunctionType |
getRuntimeType() |
IScriptPartId |
getScriptPart() |
IType |
getSupertype()
Returns the type representing the supertype of this type.
|
ITypeInfo |
getTypeInfo()
Get the type information for this intrinsic type.
|
ITypeLoader |
getTypeLoader()
Returns the type loader responsible for loading this intrinsic type.
|
IType[] |
getTypeParameters()
If this is a parameterized type, returns the specific types used to create
this type, null otherwies.
|
IGenericTypeVariable[] |
getTypeVariables() |
int |
hashCode() |
boolean |
hasOptionalParams() |
IFunctionType |
inferParameterizedTypeFromArgTypesAndContextType(IType[] argTypes,
IType ctxType) |
TypeVarToTypeMap |
inferTypeParametersFromArgumentTypes(IType... argTypes) |
TypeVarToTypeMap |
inferTypeParametersFromArgumentTypes2(IType owningParameterizedType,
IType... argTypes) |
boolean |
isAbstract() |
boolean |
isArray()
True if this is an array.
|
boolean |
isAssignableFrom(IType type)
Determines if the type represented by this intrinsic type is either the
same as, or is a super-type of the type represented by the specified type
parameter.
|
boolean |
isAssignableFrom(IType type,
boolean bContravariant) |
boolean |
isCompoundType() |
boolean |
isDiscarded()
True if this type has been replaced with a newer version of the same name in the type system.
|
boolean |
isEnum()
Returns true if this type is an enumeration.
|
boolean |
isFinal()
True if this type cannot be extended.
|
boolean |
isGenericType()
Returns true if this ia a Generic Type.
|
boolean |
isInterface()
Returns true if this type is an interface.
|
boolean |
isMutable()
Are intances of this type mutable? Note sometimes it's difficult to
determine.
|
boolean |
isParameterizedType()
Returns true if this ia a Parameterized Type.
|
boolean |
isPrimitive()
True if this type represents a primitive type e.g., Java int, char, etc.
|
boolean |
isValid()
Defines this type if it is not yet fully defined.
|
Object |
makeArrayInstance(int iLength)
Construct an array instance of specified length.
|
IType |
newInstance(IType[] paramTypes,
IType returnType) |
FunctionType |
parameterize(FunctionType source,
TypeVarToTypeMap actualParamByVarName,
boolean bKeepTypeVars)
Create a new FunctionType based on the type parameters assigned to the type
vars in actualParamByVarName.
|
Object |
readResolve()
IType requires this method be implemented to ensure IType
instances can be centrally defined and cached.
|
void |
setArgumentTypes(IType[] paramTypes) |
void |
setArrayComponent(Object array,
int iIndex,
Object value)
Sets the value of the indexed component in the specified array object.
|
void |
setDiscarded(boolean bDiscarded) |
void |
setModifiers(int iModifiers) |
void |
setRetType(IType retType) |
void |
setScriptPart(IScriptPartId scriptPart) |
String |
toString() |
void |
unloadTypeInfo()
Unload or nullify any references to this IType's ITypeInfo.
|
getLiteralMetaType, getMetaType, getTheRefclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetLiteralMetaType, getMetaTypepublic FunctionType(String strFunctionName, IType retType, IType[] paramTypes)
strFunctionName - The name of the functionretType - The return type of the function.paramTypes - The parameter types. Can be null if no params.public FunctionType(String strFunctionName, IType retType, IType[] paramTypes, IGenericTypeVariable[] typeVars)
strFunctionName - The name of the functionretType - The return type of the function.paramTypes - The parameter types. Can be null if no params.typeVars - The generic type variables. If null, does not create a
generic function type.public FunctionType(IMethodInfo mi)
public FunctionType(IMethodInfo mi, boolean lazyTypes)
public FunctionType(FunctionType source, IType gsClass)
protected FunctionType(FunctionType source, IType returnType, IType[] paramTypes)
protected FunctionType(FunctionType source, TypeVarToTypeMap actualParamByVarName, boolean bKeepTypeVars)
protected void copyFields(FunctionType source)
public FunctionType parameterize(FunctionType source, TypeVarToTypeMap actualParamByVarName, boolean bKeepTypeVars)
It is important to note that this form of parameterization is different from calling getParameterizedType(). The latter creates a parameterization of a generic function e.g., function foo<T>() where T is a type var on the function.
This here method is for parameterizing a function type that has references to external type vars e.g., class Fred<T> { function foo( t : T ){} } where T is a type var on the containing class.
source - The raw form of a FunctionType having possible references to
type vars defined in its containing class.actualParamByVarName - A map of concrete types by type var name
e.g., "T" -> StringbKeepTypeVars - Indicates whether or not a type var referenced in the
source FunctionType that cannot be resolved via the actualParamByVarName
map should remain as a TypeVariableType or should be converted to its
bounding type.public IType getIntrinsicType()
public IType getReturnType()
getReturnType in interface IFunctionTypepublic void setRetType(IType retType)
public IType[] getParameterTypes()
getParameterTypes in interface IFunctionTypegetParameterTypes in interface IInvocableTypepublic void setArgumentTypes(IType[] paramTypes)
public IMethodInfo getMethodInfo()
IFunctionTypegetMethodInfo in interface IFunctionTypepublic IFeatureInfo getMethodOrConstructorInfo()
getMethodOrConstructorInfo in interface IFunctionTypepublic String getParamSignature()
IFunctionTypegetParamSignature in interface IFunctionTypegetParamSignature in interface IInvocableTypepublic String getParamSignatureForCurrentModule()
getParamSignatureForCurrentModule in interface IFunctionTypepublic static String getParamTypeNameFromJavaBackedType(IType paramType)
public String getName()
ITypepublic String getDisplayName()
ITypeIType.getName(), but in some cases a type may want to modify it's name
for presentation to the user.getDisplayName in interface ITypepublic String getRelativeName()
ITypegetRelativeName in interface ITypepublic String getNamespace()
ITypegetNamespace in interface ITypepublic ITypeLoader getTypeLoader()
ITypegetTypeLoader in interface ITypepublic boolean isInterface()
ITypeisInterface in interface ITypepublic IType[] getInterfaces()
getInterfaces in interface ITypepublic boolean isEnum()
ITypepublic IType getSupertype()
ITypegetSupertype in interface ITypepublic IType getEnclosingType()
ITypegetEnclosingType in interface ITypepublic IType getGenericType()
ITypegetGenericType in interface ITypepublic boolean isFinal()
ITypepublic boolean isParameterizedType()
ITypeisParameterizedType in interface ITypepublic boolean isGenericType()
ITypeisGenericType in interface ITypeIType.isParameterizedType()public IGenericTypeVariable[] getGenericTypeVariables()
ITypegetGenericTypeVariables in interface ITypepublic ParameterizedFunctionType getParameterizedType(IType... typeParams)
ITypegetParameterizedType in interface ITypetypeParams - The type parameters.public IFunctionType inferParameterizedTypeFromArgTypesAndContextType(IType[] argTypes, IType ctxType)
inferParameterizedTypeFromArgTypesAndContextType in interface IFunctionTypepublic IType[] getTypeParameters()
ITypegetTypeParameters in interface ITypepublic Set<IType> getAllTypesInHierarchy()
ITypegetAllTypesInHierarchy in interface ITypepublic boolean isArray()
ITypepublic boolean isPrimitive()
ITypeisPrimitive in interface ITypepublic IType getArrayType()
ITypegetArrayType in interface ITypepublic Object makeArrayInstance(int iLength)
ITypemakeArrayInstance in interface ITypepublic Object getArrayComponent(Object array, int iIndex) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
ITypegetArrayComponent in interface ITypearray - An array instance of this intrinsic type.iIndex - The index of the component to get.IllegalArgumentException - If the specified object is not an array.ArrayIndexOutOfBoundsException - If the specified index argument
is negative, or if it is greater than or equal to the length of the
specified arraypublic void setArrayComponent(Object array, int iIndex, Object value) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
ITypesetArrayComponent in interface ITypearray - An array instance of this intrinsic type.iIndex - The index of the component to set.value - The new value of the indexed component.IllegalArgumentException - If the specified object is not an array.ArrayIndexOutOfBoundsException - If the specified index argument
is negative, or if it is greater than or equal to the length of the
specified arraypublic int getArrayLength(Object array) throws IllegalArgumentException
ITypegetArrayLength in interface ITypearray - An array instance of this intrinsic type.IllegalArgumentException - If the object argument is not an array.public IType getComponentType()
ITypegetComponentType in interface ITypepublic boolean isAssignableFrom(IType type)
ITypeisAssignableFrom in interface ITypepublic boolean isAssignableFrom(IType type, boolean bContravariant)
isAssignableFrom in interface IFunctionTypeprotected boolean areReturnTypesAssignable(FunctionType that)
public boolean areParamsCompatible(IFunctionType rhsFunctionType)
areParamsCompatible in interface IFunctionTypepublic static boolean areParamsCompatible(IFunctionType lhsType, IFunctionType rhsType)
public static IType[] findContravariantParams(IType[] lhsParams, IType[] rhsParams)
public boolean isMutable()
ITypepublic ITypeInfo getTypeInfo()
ITypegetTypeInfo in interface ITypeITypeInfopublic void unloadTypeInfo()
ITypeunloadTypeInfo in interface ITypepublic Object readResolve() throws ObjectStreamException
ITypereadResolve in interface ITypeObjectStreamExceptionpublic boolean isValid()
ITypepublic int getModifiers()
ITypepublic, protected,
private, final, static,
abstract they should be decoded
using the methods of class Modifier.getModifiers in interface ITypeModifierpublic void setModifiers(int iModifiers)
public boolean isAbstract()
isAbstract in interface ITypepublic IScriptPartId getScriptPart()
getScriptPart in interface IFunctionTypepublic IType newInstance(IType[] paramTypes, IType returnType)
newInstance in interface IFunctionTypepublic void setScriptPart(IScriptPartId scriptPart)
protected boolean areEnclosingTypesEqual(FunctionType funcType)
public TypeVarToTypeMap inferTypeParametersFromArgumentTypes2(IType owningParameterizedType, IType... argTypes)
inferTypeParametersFromArgumentTypes2 in interface IGenericMethodInfopublic TypeVarToTypeMap inferTypeParametersFromArgumentTypes(IType... argTypes)
inferTypeParametersFromArgumentTypes in interface IGenericMethodInfoargTypes - The argument types from a generic method call.public IGenericTypeVariable[] getTypeVariables()
getTypeVariables in interface IGenericMethodInfopublic IType getParameterizedReturnType(IType... typeParams)
getParameterizedReturnType in interface IGenericMethodInfopublic IType[] getParameterizedParameterTypes(IType... typeParams)
getParameterizedParameterTypes in interface IGenericMethodInfopublic IType[] getParameterizedParameterTypes2(IType ownersType, IType... typeParams)
getParameterizedParameterTypes2 in interface IGenericMethodInfopublic FunctionType getRuntimeType()
public boolean isDiscarded()
ITypeisDiscarded in interface ITypepublic void setDiscarded(boolean bDiscarded)
setDiscarded in interface ITypepublic boolean isCompoundType()
isCompoundType in interface ITypepublic Set<IType> getCompoundTypeComponents()
getCompoundTypeComponents in interface ITypepublic IExpression[] getDefaultValueExpressions()
getDefaultValueExpressions in interface IInvocableTypepublic boolean hasOptionalParams()
hasOptionalParams in interface IInvocableTypepublic String[] getParameterNames()
getParameterNames in interface IInvocableTypepublic IType getOwningParameterizedType()
Copyright © 2015. All rights reserved.