public final class Types extends Object
| Modifier and Type | Method and Description |
|---|---|
static List<Property> |
allProperties(TypeDef typeDef)
All properties (including inherited).
|
static TypeRef |
box(TypeRef ref) |
static String |
fullyQualifiedNameDiff(String left,
String right) |
static TypeParamDef |
getParameterDefinition(TypeRef typeRef,
Collection<TypeParamDef> parameters) |
static boolean |
hasMethod(TypeDef typeDef,
String method)
Check if method exists on the specified type.
|
static boolean |
hasProperty(TypeDef typeDef,
String property)
Checks if property exists on the specified type.
|
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 |
isConcrete(TypeRef typeRef)
Checks if
TypeRef is of an concrete |
static boolean |
isEnum(TypeRef typeRef)
Checks a
TypeRef is an enum. |
static boolean |
isInstanceOf(TypeRef type,
TypeDef targetType,
Function<TypeRef,Boolean> function)
|
static boolean |
isJdkType(TypeRef type)
Check if type is an internal JDK type.
|
static boolean |
isList(TypeRef type)
|
static boolean |
isMap(TypeRef type)
|
static boolean |
isOptional(TypeRef type)
|
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)
|
static TypeParamDef |
newTypeParamDef(String letter)
Creates a new TypeParamDef.
|
static TypeParamRef |
newTypeParamRef(String letter)
Creates a new generic TypeParamRef.
|
static String |
parseFullyQualifiedName(String content) |
static Optional<String> |
parseName(String content) |
static Optional<String> |
parsePackage(String content) |
static String |
toClassName(Object o)
A utility that tries to get a fully qualified class name from an unknown object.
|
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 Set<TypeDef> |
unrollHierarchy(TypeDef typeDef)
Unrolls the hierararchy of a specified type.
|
static TypeDef |
unwrapGeneric(TypeDef base)
Removes parameters from a TypeDef.
|
static void |
visitParents(TypeDef type,
List<TypeDef> types) |
static void |
visitParents(TypeDef type,
List<TypeDef> types,
List<TypeDef> visited) |
public static final String PACKAGE
public static final String CLASS_NAME
public static final TypeParamDef F
public static final TypeParamDef I
public static final TypeParamDef O
public static final TypeParamDef B
public static final TypeParamDef T
public static final TypeParamRef T_REF
public static final TypeParamDef N
public static final TypeParamRef N_REF
public static final TypeParamDef V
public static final VoidRef VOID
public static final WildcardRef Q
public static final TypeDef TYPE
public static final TypeDef CLASS
public static final ClassRef CLASS_REF_NO_ARG
public static final TypeDef ARRAY
public static final TypeDef TYPE_VARIABLE
public static final TypeDef GENERIC_ARRAY_TYPE
public static final TypeDef PARAMETERIZED_TYPE
public static final TypeDef OBJECT
public static final TypeRef OBJECT_REF
public static final TypeDef STRING
public static final TypeRef STRING_REF
public static final TypeDef BOOLEAN
public static final TypeRef BOOLEAN_REF
public static final TypeDef BYTE
public static final TypeRef BYTE_REF
public static final TypeDef CHARACTER
public static final TypeRef CHARACTER_REF
public static final TypeDef SHORT
public static final TypeRef SHORT_REF
public static final TypeDef INT
public static final TypeRef INT_REF
public static final TypeDef LONG
public static final TypeRef LONG_REF
public static final TypeDef DOUBLE
public static final TypeRef DOUBLE_REF
public static final TypeDef FLOAT
public static final TypeRef FLOAT_REF
public static final TypeDef OPTIONAL
public TypeRef OPTIONAL_REF
public static final PrimitiveRef PRIMITIVE_BOOLEAN_REF
public static final PrimitiveRef PRIMITIVE_BYTE_REF
public static final PrimitiveRef PRIMITIVE_CHAR_REF
public static final PrimitiveRef PRIMITIVE_SHORT_REF
public static final PrimitiveRef PRIMITIVE_INT_REF
public static final PrimitiveRef PRIMITIVE_LONG_REF
public static final PrimitiveRef PRIMITIVE_DOUBLE_REF
public static final PrimitiveRef PRIMITIVE_FLOAT_REF
public static TypeRef[] PRIMITIVE_TYPES
public static TypeRef[] BOXED_PRIMITIVE_TYPES
public static String[] BOXED_PARSE_METHOD
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 boolean isEnum(TypeRef typeRef)
TypeRef is an enum.typeRef - The type to check.public static boolean isAbstract(TypeRef typeRef)
TypeRef is of an abstract type.typeRef - The type to check.public static boolean isConcrete(TypeRef typeRef)
TypeRef is of an concretetypeRef - 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.public static boolean isArray(TypeRef type)
TypeRef is an array.type - The type to check.public static boolean isOptional(TypeRef type)
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.public static boolean isJdkType(TypeRef type)
public static boolean hasMethod(TypeDef typeDef, String method)
typeDef - The type.method - The method name.public static boolean hasProperty(TypeDef typeDef, String property)
typeDef - The type.property - The property name.public static List<Property> allProperties(TypeDef typeDef)
typeDef - The type.public static Set<TypeDef> unrollHierarchy(TypeDef typeDef)
typeDef - The specified type.public static String toClassName(Object o)
o - The object.public static void visitParents(TypeDef type, List<TypeDef> types, List<TypeDef> visited)
Copyright © 2023. All rights reserved.