Type.ArrayTypeArrayJavaType, ClassJavaType, DeferredType, IntersectionType, JavaType, MethodJavaType, ParametrizedTypeJavaType, TypeVariableJavaType, UnknownType, WildCardTypepublic interface Type
| Modifier and Type | Interface | Description |
|---|---|---|
static interface |
Type.ArrayType |
Type for arrays.
|
static class |
Type.Primitives |
Primitive java types.
|
| Modifier and Type | Method | Description |
|---|---|---|
Type |
erasure() |
Erasure of this type.
|
String |
fullyQualifiedName() |
Fully qualified name of the type.
|
boolean |
is(String fullyQualifiedName) |
Check whether a type is the one designed by the fully qualified name.
|
boolean |
isArray() |
Check if this type is an array.
|
boolean |
isClass() |
Check if this type is a class, an enum, an interface or an annotation.
|
boolean |
isNumerical() |
Check if this type is a primitive numerical type.
|
boolean |
isPrimitive() |
Check if this type is a primitive.
|
boolean |
isPrimitive(Type.Primitives primitive) |
Check if this type is the given primitive.
|
boolean |
isSubtypeOf(String fullyQualifiedName) |
Check whether a type is a subtype of the one designed by the fully qualified name.
|
boolean |
isSubtypeOf(Type superType) |
Check whether a type is a subtype of another.
|
boolean |
isUnknown() |
Check if this type has been resolved.
|
boolean |
isVoid() |
Check if type is Void type.
|
String |
name() |
simple name of the type.
|
Symbol.TypeSymbol |
symbol() |
Symbol of this type.
|
boolean is(String fullyQualifiedName)
Type type;
type.is("int");
type.is("int[]");
type.is("java.lang.String[]");
type.is("java.lang.Object");
fullyQualifiedName - fully qualified name to check. Use "[]" for arrays and the simple name for primitive type ("int", "byte"...).boolean isSubtypeOf(String fullyQualifiedName)
This method will consider implemented interfaces as well as superclasses.
Type type;
type.isSubtypeOf("Object[]");
type.isSubtypeOf("org.mypackage.MyClass");
type.isSubtypeOf("org.mypackage.MyInterface");
type.isSubtypeOf("java.lang.Object");
fullyQualifiedName - fully qualified name to check in the type hierarchy. Use "[]" for arrays.boolean isSubtypeOf(Type superType)
This method will consider implemented interfaces as well as superclasses.
Type type, myOtherType;
type.isSubtypeOf(myOtherType);
superType - instance of a potential superType.boolean isArray()
boolean isClass()
boolean isVoid()
boolean isPrimitive()
boolean isPrimitive(Type.Primitives primitive)
Type type;
type.isPrimitive(Primitives.INT);
primitive - primitive type to be checked with.boolean isUnknown()
boolean isNumerical()
String fullyQualifiedName()
String name()
Symbol.TypeSymbol symbol()
Type erasure()
Copyright © 2012–2018 SonarSource. All rights reserved.