public final class TypeUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
fullyQualifiedNameDiff(String left,
String right) |
static TypeParamDef |
getParameterDefinition(TypeRef typeRef,
Collection<TypeParamDef> parameters) |
static boolean |
isAbstract(TypeRef typeRef)
Checks a
TypeRef is of an abstract type. |
static boolean |
isArray(TypeRef type)
Checks if a
TypeRef is an array. |
static boolean |
isBoolean(TypeRef type)
|
static boolean |
isCollection(TypeRef type)
Checks if a
TypeRef is a Collection. |
static boolean |
isInstanceOf(TypeRef type,
TypeDef targetType,
Function<TypeRef,Boolean> function)
|
static boolean |
isList(TypeRef type)
|
static boolean |
isMap(TypeRef type)
|
static boolean |
isPrimitive(TypeRef type)
Checks if a
TypeRef is a primitive type. |
static boolean |
isSet(TypeRef type)
|
static int |
modifiersToInt(Collection<Modifier> modifiers) |
static int |
modifiersToInt(Modifier... modifiers) |
static TypeParamDef |
newTypeParamDef(String letter)
Creates a new TypeParamDef.
|
static TypeParamRef |
newTypeParamRef(String letter)
Creates a new generic TypeParamRef.
|
static TypeDef |
typeExtends(TypeDef base,
ClassRef superClass)
Sets one
TypeDef as a super class of an other. |
static TypeDef |
typeGenericOf(TypeDef base,
TypeParamDef... parameters)
Sets one
TypeDef as a generic of an other. |
static TypeDef |
typeImplements(TypeDef base,
ClassRef... superClass)
Sets one
TypeDef as an interface of an other. |
static TypeDef |
unwrapGeneric(TypeDef base)
Removes parameters from a TypeDef.
|
public static boolean isInstanceOf(TypeRef type, TypeDef targetType, Function<TypeRef,Boolean> function)
type - The type to compare.targetType - The target type.function - public static TypeParamDef getParameterDefinition(TypeRef typeRef, Collection<TypeParamDef> parameters)
public static TypeParamRef newTypeParamRef(String letter)
letter - The letter of the type.public static TypeParamDef newTypeParamDef(String letter)
letter - The letter of the type.public static TypeDef unwrapGeneric(TypeDef base)
base - The base type.public static TypeDef typeGenericOf(TypeDef base, TypeParamDef... parameters)
TypeDef as a generic of an other.base - The base type.parameters - The parameter types.public static TypeDef typeExtends(TypeDef base, ClassRef superClass)
TypeDef as a super class of an other.base - The base type.superClass - The super type.public static TypeDef typeImplements(TypeDef base, ClassRef... superClass)
TypeDef as an interface of an other.base - The base type.superClass - The super type.public static int modifiersToInt(Modifier... modifiers)
public static int modifiersToInt(Collection<Modifier> modifiers)
public static boolean isAbstract(TypeRef typeRef)
TypeRef is of an abstract type.typeRef - The type to check.public static boolean isPrimitive(TypeRef type)
TypeRef is a primitive type.type - The type to check.public static boolean isMap(TypeRef type)
type - The type to check.public static boolean isList(TypeRef type)
type - The type to check.public static boolean isSet(TypeRef type)
type - The type to check.public static boolean isCollection(TypeRef type)
TypeRef is a Collection.type - The type to check.public static boolean isBoolean(TypeRef type)
type - The type to check.Boolean or boolean.Copyright © 2016. All Rights Reserved.