public class TypeUtil extends Object
| Constructor and Description |
|---|
TypeUtil() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
canConvert(int ordinal,
Type fromType,
int to,
List<Resolver.Conversion> conversions)
Returns whether we can convert an argument of a given category to a
given parameter category.
|
static boolean |
canEvaluate(Type type)
Returns whether a value of a given type can be evaluated to a scalar
value.
|
static Type |
computeCommonType(boolean allowConversions,
Type... types)
Returns a type sufficiently broad to hold any value of several types,
but as narrow as possible.
|
static boolean |
couldBeMember(Type type) |
static List<Hierarchy> |
getHierarchies(Type type)
Returns the hierarchies in a set, member, or tuple type.
|
static boolean |
isSet(Type type)
Returns whether a type is a set type.
|
static boolean |
isUnionCompatible(Type type1,
Type type2)
Returns whether this type is union-compatible with another.
|
static Type |
stripSetType(Type type)
Given a set type, returns the element type.
|
static Type |
toMemberOrTupleType(Type type)
Converts a type to a member or tuple type.
|
static MemberType |
toMemberType(Type type)
Converts a type to a member type.
|
static int |
typeToCategory(Type type)
|
public static Type stripSetType(Type type)
type - Typepublic static Type toMemberOrTupleType(Type type)
type - Typepublic static MemberType toMemberType(Type type)
type - Typepublic static boolean isUnionCompatible(Type type1, Type type2)
type1 - First typetype2 - Second typepublic static boolean canEvaluate(Type type)
The rules are as follows:
type - Typepublic static boolean isSet(Type type)
type - Typepublic static boolean couldBeMember(Type type)
public static int typeToCategory(Type type)
type - Typepublic static Type computeCommonType(boolean allowConversions, Type... types)
The result is equivalent to calling
Type.computeCommonType(Type, int[]) pairwise.
allowConversions - Whether to allow implicit conversionstypes - Array of typespublic static boolean canConvert(int ordinal,
Type fromType,
int to,
List<Resolver.Conversion> conversions)
ordinal - argument ordinalfromType - actual argument typeto - formal parameter categoryconversions - list of implicit conversions required (out)Copyright © 2021 Hitachi Vantara. All rights reserved.