public abstract class AbstractType extends Object implements Type
Modifier and Type | Method and Description |
---|---|
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.
|
List<FreeType> |
getFreeTypes()
Returns the list of free types as they appear in the type.
|
boolean |
hasFreeTypes() |
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.
|
Object |
performConversion(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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
accept, getJavaClass, getSupertype, hasIntersectionType
public boolean assignableTo(Type target)
Type
assignableTo
in interface Type
target
- type of the target variablepublic boolean matchesSupertype(Type other, TypeMapping mapping)
Type
mapping
. Returns true if
this type matches supertype of other
type.matchesSupertype
in interface Type
other
typepublic boolean matchesSubtype(Type other, TypeMapping mapping)
Type
mapping
. Returns true if
this type matches subtype of other
type.matchesSubtype
in interface Type
other
typepublic Type findCommonSupertype(Type other)
Type
other
.findCommonSupertype
in interface Type
public Type findCommonSubtype(Type other)
Type
other
.findCommonSubtype
in interface Type
public Object performConversion(Object object)
Type
performConversion
in interface Type
public final List<FreeType> getFreeTypes()
Type
getFreeTypes
in interface Type
public boolean hasFreeTypes()
hasFreeTypes
in interface Type
true
if the type contains a free typepublic Type substituteFreeTypes(FreeTypeMapping mapping)
Type
substituteFreeTypes
in interface Type
public boolean isCollection()
Type
isCollection
in interface Type
true
if the type is a collection, list or set typeCopyright © 2007-2020 Whitestein Technologies. All Rights Reserved.