public final class TypeUtils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
fullyQualifiedNameDiff(java.lang.String left,
java.lang.String right) |
static TypeParamDef |
getParameterDefinition(TypeRef typeRef,
java.util.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)
Checks if a
TypeRef is a Boolean or boolean. |
static boolean |
isCollection(TypeRef type)
Checks if a
TypeRef is a Collection. |
static boolean |
isInstanceOf(TypeRef type,
TypeDef targetType,
Function<TypeRef,java.lang.Boolean> function)
|
static boolean |
isList(TypeRef type)
Checks if a
TypeRef is a List. |
static boolean |
isMap(TypeRef type)
Checks if a
TypeRef is a Map. |
static boolean |
isOptional(TypeRef type)
Checks if a
TypeRef is a Optional. |
static boolean |
isOptionalDouble(TypeRef type)
Checks if a
TypeRef is a OptionalDouble. |
static boolean |
isOptionalInt(TypeRef type)
Checks if a
TypeRef is a OptionalInt. |
static boolean |
isOptionalLong(TypeRef type)
Checks if a
TypeRef is a OptionalLong. |
static boolean |
isPrimitive(TypeRef type)
Checks if a
TypeRef is a primitive type. |
static boolean |
isSet(TypeRef type)
Checks if a
TypeRef is a Set. |
static int |
modifiersToInt(java.util.Collection<javax.lang.model.element.Modifier> modifiers) |
static int |
modifiersToInt(javax.lang.model.element.Modifier... modifiers) |
static TypeParamDef |
newTypeParamDef(java.lang.String letter)
Creates a new TypeParamDef.
|
static TypeParamRef |
newTypeParamRef(java.lang.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.
|
static void |
visitParents(TypeDef type,
java.util.List<TypeDef> types) |
static void |
visitParents(TypeDef type,
java.util.List<TypeDef> types,
java.util.List<TypeDef> visited) |
public static boolean isInstanceOf(TypeRef type, TypeDef targetType, Function<TypeRef,java.lang.Boolean> function)
type - The type to compare.targetType - The target type.function - public static TypeParamDef getParameterDefinition(TypeRef typeRef, java.util.Collection<TypeParamDef> parameters)
public static TypeParamRef newTypeParamRef(java.lang.String letter)
letter - The letter of the type.public static TypeParamDef newTypeParamDef(java.lang.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(javax.lang.model.element.Modifier... modifiers)
public static int modifiersToInt(java.util.Collection<javax.lang.model.element.Modifier> modifiers)
public static java.lang.String fullyQualifiedNameDiff(java.lang.String left,
java.lang.String right)
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)
TypeRef is a Map.type - The type to check.public static boolean isList(TypeRef type)
TypeRef is a List.type - The type to check.public static boolean isSet(TypeRef type)
TypeRef is a Set.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)
TypeRef is a Boolean or boolean.type - The type to check.Boolean or boolean.public static boolean isArray(TypeRef type)
TypeRef is an array.type - The type to check.public static boolean isOptional(TypeRef type)
TypeRef is a Optional.type - The type to check.Optional.public static boolean isOptionalInt(TypeRef type)
TypeRef is a OptionalInt.type - The type to check.OptionalInt.public static boolean isOptionalDouble(TypeRef type)
TypeRef is a OptionalDouble.type - The type to check.OptionalDouble.public static boolean isOptionalLong(TypeRef type)
TypeRef is a OptionalLong.type - The type to check.OptionalLong.Copyright © 2018. All Rights Reserved.