Package io.sundr.model.utils
Class Types
java.lang.Object
io.sundr.model.utils.Types
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TypeDefstatic final TypeParamDefstatic final TypeDefstatic final TypeRefstatic String[]static TypeRef[]static final TypeDefstatic final ClassRefstatic final TypeDefstatic final ClassRefstatic final TypeDefstatic final Stringstatic final ClassRefstatic final TypeDefstatic final ClassRefstatic final TypeParamDefstatic final TypeDefstatic final ClassRefstatic final TypeDefstatic final TypeParamDefstatic final TypeDefstatic final ClassRefstatic final TypeDefstatic final ClassRefstatic final TypeParamDefstatic final TypeParamRefstatic final TypeParamDefstatic final TypeDefstatic final ClassRefstatic final TypeDefstatic final Stringstatic final TypeDefstatic final PrimitiveRefstatic final PrimitiveRefstatic final PrimitiveRefstatic final PrimitiveRefstatic final PrimitiveRefstatic final PrimitiveRefstatic final PrimitiveRefstatic final PrimitiveRefstatic TypeRef[]static final WildcardRefstatic final TypeDefstatic final ClassRefstatic final TypeDefstatic final ClassRefstatic final TypeParamDefstatic final TypeParamRefstatic final TypeDefstatic final TypeDefstatic final TypeParamDefstatic final VoidRef -
Method Summary
Modifier and TypeMethodDescriptionallProperties(TypeDef typeDef) All properties (including inherited).static TypeRefstatic StringfullyQualifiedNameDiff(String left, String right) static TypeParamDefgetParameterDefinition(TypeRef typeRef, Collection<TypeParamDef> parameters) static booleanCheck if method exists on the specified type.static booleanhasProperty(TypeDef typeDef, String property) Checks if property exists on the specified type.static booleanisAbstract(TypeRef typeRef) Checks aTypeRefis of an abstract type.static booleanChecks if aTypeRefis an array.static booleanstatic booleanisCollection(TypeRef type) Checks if aTypeRefis aCollection.static booleanisConcrete(TypeRef typeRef) Checks ifTypeRefis of an concretestatic booleanChecks aTypeRefis an enum.static booleanstatic booleanCheck if type is an internal JDK type.static booleanstatic booleanstatic booleanisOptional(TypeRef type) static booleanisOptionalDouble(TypeRef type) Checks if aTypeRefis aOptionalDouble.static booleanisOptionalInt(TypeRef type) Checks if aTypeRefis aOptionalInt.static booleanisOptionalLong(TypeRef type) Checks if aTypeRefis aOptionalLong.static booleanisPrimitive(TypeRef type) Checks if aTypeRefis a primitive type.static booleanstatic TypeParamDefnewTypeParamDef(String letter) Creates a new TypeParamDef.static TypeParamRefnewTypeParamRef(String letter) Creates a new generic TypeParamRef.static StringparseFullyQualifiedName(String content) parsePackage(String content) static StringA utility that tries to get a fully qualified class name from an unknown object.static TypeDeftypeExtends(TypeDef base, ClassRef superClass) Sets oneTypeDefas a super class of an other.static TypeDeftypeGenericOf(TypeDef base, TypeParamDef... parameters) Sets oneTypeDefas a generic of an other.static TypeDeftypeImplements(TypeDef base, ClassRef... superClass) Sets oneTypeDefas an interface of an other.unrollHierarchy(TypeDef typeDef) Unrolls the hierararchy of a specified type.static TypeDefunwrapGeneric(TypeDef base) Removes parameters from a TypeDef.static voidvisitParents(TypeDef type, List<TypeDef> types) static void
-
Field Details
-
PACKAGE
- See Also:
-
CLASS_NAME
- See Also:
-
F
-
I
-
O
-
B
-
T
-
T_REF
-
N
-
N_REF
-
V
-
VOID
-
Q
-
TYPE
-
CLASS
-
CLASS_REF_NO_ARG
-
ARRAY
-
TYPE_VARIABLE
-
GENERIC_ARRAY_TYPE
-
PARAMETERIZED_TYPE
-
OBJECT
-
OBJECT_REF
-
STRING
-
STRING_REF
-
BOOLEAN
-
BOOLEAN_REF
-
BYTE
-
BYTE_REF
-
CHARACTER
-
CHARACTER_REF
-
SHORT
-
SHORT_REF
-
INT
-
INT_REF
-
LONG
-
LONG_REF
-
DOUBLE
-
DOUBLE_REF
-
FLOAT
-
FLOAT_REF
-
OPTIONAL
-
OPTIONAL_REF
-
PRIMITIVE_BOOLEAN_REF
-
PRIMITIVE_BYTE_REF
-
PRIMITIVE_CHAR_REF
-
PRIMITIVE_SHORT_REF
-
PRIMITIVE_INT_REF
-
PRIMITIVE_LONG_REF
-
PRIMITIVE_DOUBLE_REF
-
PRIMITIVE_FLOAT_REF
-
PRIMITIVE_TYPES
-
BOXED_PRIMITIVE_TYPES
-
BOXED_PARSE_METHOD
-
-
Method Details
-
box
-
isInstanceOf
public static boolean isInstanceOf(TypeRef type, TypeDef targetType, Function<TypeRef, Boolean> function) - Parameters:
type- The type to compare.targetType- The target type.function-- Returns:
- true if match, false otherwise.
-
getParameterDefinition
public static TypeParamDef getParameterDefinition(TypeRef typeRef, Collection<TypeParamDef> parameters) -
newTypeParamRef
Creates a new generic TypeParamRef.- Parameters:
letter- The letter of the type.- Returns:
- The param reference.
-
newTypeParamDef
Creates a new TypeParamDef.- Parameters:
letter- The letter of the type.- Returns:
- The param definition.
-
unwrapGeneric
Removes parameters from a TypeDef.- Parameters:
base- The base type.- Returns:
- The unwraped TypeDef.
-
typeGenericOf
Sets oneTypeDefas a generic of an other.- Parameters:
base- The base type.parameters- The parameter types.- Returns:
- The generic type.
-
typeExtends
Sets oneTypeDefas a super class of an other.- Parameters:
base- The base type.superClass- The super type.- Returns:
- The updated type definition.
-
typeImplements
Sets oneTypeDefas an interface of an other.- Parameters:
base- The base type.superClass- The super type.- Returns:
- The updated type definition.
-
fullyQualifiedNameDiff
-
isEnum
Checks aTypeRefis an enum.- Parameters:
typeRef- The type to check.- Returns:
- True if its an enum type.
-
isAbstract
Checks aTypeRefis of an abstract type.- Parameters:
typeRef- The type to check.- Returns:
- True if its an abstract type.
-
isConcrete
Checks ifTypeRefis of an concrete- Parameters:
typeRef- The type to check.- Returns:
- True if its an concrete type.
-
isPrimitive
Checks if aTypeRefis a primitive type.- Parameters:
type- The type to check.- Returns:
- True if its a primitive type.
-
isMap
- Parameters:
type- The type to check.- Returns:
- True if its a Map.
-
isList
- Parameters:
type- The type to check.- Returns:
- True if its a List.
-
isSet
- Parameters:
type- The type to check.- Returns:
- True if its a Set.
-
isCollection
Checks if aTypeRefis aCollection.- Parameters:
type- The type to check.- Returns:
- True if its a Collection.
-
isBoolean
- Parameters:
type- The type to check.- Returns:
- True if its a
Booleanor boolean.
-
isArray
Checks if aTypeRefis an array.- Parameters:
type- The type to check.- Returns:
- True if its an array.B
-
isOptional
- Parameters:
type- The type to check.- Returns:
- True if its a
Optional.
-
isOptionalInt
Checks if aTypeRefis aOptionalInt.- Parameters:
type- The type to check.- Returns:
- True if its a
OptionalInt.
-
isOptionalDouble
Checks if aTypeRefis aOptionalDouble.- Parameters:
type- The type to check.- Returns:
- True if its a
OptionalDouble.
-
isOptionalLong
Checks if aTypeRefis aOptionalLong.- Parameters:
type- The type to check.- Returns:
- True if its a
OptionalLong.
-
isJdkType
Check if type is an internal JDK type.- Returns:
- true if jdk type, false otherwise.
-
hasMethod
Check if method exists on the specified type.- Parameters:
typeDef- The type.method- The method name.- Returns:
- True if method is found, false otherwise.
-
hasProperty
Checks if property exists on the specified type.- Parameters:
typeDef- The type.property- The property name.- Returns:
- True if method is found, false otherwise.
-
allProperties
All properties (including inherited).- Parameters:
typeDef- The type.- Returns:
- A list with all properties.
-
unrollHierarchy
Unrolls the hierararchy of a specified type.- Parameters:
typeDef- The specified type.- Returns:
- A set that contains all the hierarching (including the specified type).
-
toClassName
A utility that tries to get a fully qualified class name from an unknown object.- Parameters:
o- The object.- Returns:
- The classname if found or the string representation of the object.
-
visitParents
-
visitParents
-
parsePackage
-
parseName
-
parseFullyQualifiedName
-