public final class ClosureType extends AbstractType
Constructor and Description |
---|
ClosureType(Type returnType,
java.util.List<? extends Type> argTypes)
Constructor
|
ClosureType(Type returnType,
Type... argTypes)
Constructor
|
Modifier and Type | Method and Description |
---|---|
<T,E extends java.lang.Throwable> |
accept(TypeVisitor<T,E> visitor)
Accepts type visitor.
|
boolean |
assignableTo(Type target)
Returns information whether a value of this type can be assigned to a
variable of another type.
|
boolean |
equals(java.lang.Object obj) |
Type |
findCommonSubtype(Type other)
Returns the common subtype, i.e.
|
Type |
findCommonSupertype(Type other)
Returns the common supertype, i.e.
|
int |
getArgumentCount()
Returns the argument count.
|
java.lang.String |
getArgumentList()
Returns a argument list in parentheses e.g.
|
Type |
getArgumentType(int i)
Returns the i-th argument type
|
java.util.List<Type> |
getArgumentTypes()
Returns unmodifiable list of argument types.
|
java.lang.Class<?> |
getJavaClass()
Returns the Java class represented by this type.
|
Type |
getReturnType()
Returns the return type.
|
Type |
getSupertype()
Returns a direct supertype to this type (or null for "Object" type).
|
boolean |
hasFreeTypes() |
int |
hashCode() |
boolean |
hasIntersectionType() |
boolean |
matchesSubtype(Type other,
TypeMapping mapping)
Performs type matching on this type.
|
boolean |
matchesSupertype(Type other,
TypeMapping mapping)
Performs type matching on this type.
|
ClosureType |
substituteFreeTypes(FreeTypeMapping mapping)
Returns a type where free types are substituted by provided mapping.
|
java.lang.String |
toString()
Returns string representation of this closure type in the form
{#paramType #paramName? (, #paramType #paramName?)* : #returnType} . |
getFreeTypes, isCollection, performConversion
public ClosureType(Type returnType, Type... argTypes)
returnType
- argTypes
- public boolean hasFreeTypes()
hasFreeTypes
in interface Type
hasFreeTypes
in class AbstractType
true
if the type contains a free typepublic Type getReturnType()
public int getArgumentCount()
public Type getArgumentType(int i)
i
- public java.util.List<Type> getArgumentTypes()
public Type getSupertype()
Type
public boolean assignableTo(Type target)
Type
assignableTo
in interface Type
assignableTo
in class AbstractType
target
- type of the target variablepublic Type findCommonSupertype(Type other)
Type
other
.findCommonSupertype
in interface Type
findCommonSupertype
in class AbstractType
public Type findCommonSubtype(Type other)
Type
other
.findCommonSubtype
in interface Type
findCommonSubtype
in class AbstractType
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
{#paramType #paramName? (, #paramType #paramName?)* : #returnType}
.toString
in class java.lang.Object
Object.toString()
public java.lang.String getArgumentList()
(String, Integer)
public <T,E extends java.lang.Throwable> T accept(TypeVisitor<T,E> visitor) throws E extends java.lang.Throwable
Type
T
- visitor return typevisitor
- visitor to visitE
E extends java.lang.Throwable
public ClosureType substituteFreeTypes(FreeTypeMapping mapping)
Type
substituteFreeTypes
in interface Type
substituteFreeTypes
in class AbstractType
public java.lang.Class<?> getJavaClass()
Type
public boolean matchesSupertype(Type other, TypeMapping mapping)
Type
mapping
. Returns true if
this type matches supertype of other
type.matchesSupertype
in interface Type
matchesSupertype
in class AbstractType
other
typepublic boolean matchesSubtype(Type other, TypeMapping mapping)
Type
mapping
. Returns true if
this type matches subtype of other
type.matchesSubtype
in interface Type
matchesSubtype
in class AbstractType
other
typepublic boolean hasIntersectionType()
true
if the type contains an intersection typeCopyright © 2007-2020 Whitestein Technologies. All Rights Reserved.