public interface Type
extends java.io.Serializable
This interface is not intended to be implemented by clients.
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.
|
Type |
findCommonSubtype(Type other)
Returns the common subtype, i.e.
|
Type |
findCommonSupertype(Type other)
Returns the common supertype, i.e.
|
java.util.List<FreeType> |
getFreeTypes()
Returns the list of free types as they appear in the type.
|
java.lang.Class<?> |
getJavaClass()
Returns the Java class represented by this type.
|
Type |
getSupertype()
Returns a direct supertype to this type (or null for "Object" type).
|
boolean |
hasFreeTypes() |
boolean |
hasIntersectionType() |
boolean |
isCollection()
|
boolean |
matchesSubtype(Type other,
TypeMapping mapping)
Performs type matching on this type.
|
boolean |
matchesSupertype(Type other,
TypeMapping mapping)
Performs type matching on this type.
|
java.lang.Object |
performConversion(java.lang.Object object)
Performs a type conversion that should be performed when an object is
assigned to a variable of this type (possibly none).
|
Type |
substituteFreeTypes(FreeTypeMapping mapping)
Returns a type where free types are substituted by provided mapping.
|
boolean assignableTo(Type target)
target
- type of the target variableType getSupertype()
boolean matchesSupertype(Type other, TypeMapping mapping)
mapping
. Returns true if
this type matches supertype of other
type.other
- mapping
- other
typeboolean matchesSubtype(Type other, TypeMapping mapping)
mapping
. Returns true if
this type matches subtype of other
type.other
- mapping
- other
typeType substituteFreeTypes(FreeTypeMapping mapping)
mapping
- <T,E extends java.lang.Throwable> T accept(TypeVisitor<T,E> visitor) throws E extends java.lang.Throwable
T
- visitor return typeE
- visitor
- visitor to visitE
E extends java.lang.Throwable
java.lang.Class<?> getJavaClass()
boolean hasFreeTypes()
true
if the type contains a free typeboolean hasIntersectionType()
true
if the type contains an intersection typeType findCommonSupertype(Type other)
other
.other
- Type findCommonSubtype(Type other)
other
.other
- java.lang.Object performConversion(java.lang.Object object)
object
- java.util.List<FreeType> getFreeTypes()
boolean isCollection()
true
if the type is a collection, list or set typeCopyright © 2007-2020 Whitestein Technologies. All Rights Reserved.