Class TypeHelper
- java.lang.Object
-
- net.sourceforge.pmd.lang.java.typeresolution.TypeHelper
-
public final class TypeHelper extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static booleanisA(TypeNode n, java.lang.Class<?> clazz)static booleanisA(TypeNode n, java.lang.String clazzName)Checks whether the resolved type of the givenTypeNoden is of the type given by the clazzName.static booleanisA(TypedNameDeclaration vnd, java.lang.Class<?> clazz)Deprecated.static booleanisA(TypedNameDeclaration vnd, java.lang.String className)static booleanisEither(TypeNode n, java.lang.Class<?> class1, java.lang.Class<?> class2)static booleanisEither(TypedNameDeclaration vnd, java.lang.Class<?> class1, java.lang.Class<?> class2)Deprecated.static booleanisExactlyA(TypeNode n, java.lang.String clazzName)Checks whether the resolved type of the givenTypeNoden is exactly of the type given by the clazzName.static booleanisExactlyAny(TypedNameDeclaration vnd, java.lang.Class<?>... clazzes)static booleanisExactlyNone(TypedNameDeclaration vnd, java.lang.Class<?>... clazzes)static booleanisNeither(TypedNameDeclaration vnd, java.lang.Class<?> class1, java.lang.Class<?> class2)Deprecated.static booleansubclasses(TypeNode n, java.lang.Class<?> clazz)
-
-
-
Method Detail
-
isA
public static boolean isA(TypeNode n, java.lang.String clazzName)
Checks whether the resolved type of the givenTypeNoden is of the type given by the clazzName. If the clazzName is on the auxclasspath, then also subclasses are considered.If clazzName is not on the auxclasspath (so it can't be resolved), then a string comparison of the class names are performed. This might result in comparing only the simple name of the classes.
- Parameters:
n- the type node to checkclazzName- the class name to compare to- Returns:
trueif type node n is of type clazzName or a subtype of clazzName
-
isExactlyA
public static boolean isExactlyA(TypeNode n, java.lang.String clazzName)
Checks whether the resolved type of the givenTypeNoden is exactly of the type given by the clazzName.- Parameters:
n- the type node to checkclazzName- the class name to compare to- Returns:
trueif type node n is exactly of type clazzName.
-
isA
public static boolean isA(TypeNode n, java.lang.Class<?> clazz)
- See Also:
isA(TypeNode, String)
-
isEither
public static boolean isEither(TypeNode n, java.lang.Class<?> class1, java.lang.Class<?> class2)
-
isExactlyAny
public static boolean isExactlyAny(TypedNameDeclaration vnd, java.lang.Class<?>... clazzes)
-
isExactlyNone
public static boolean isExactlyNone(TypedNameDeclaration vnd, java.lang.Class<?>... clazzes)
-
isA
@Deprecated public static boolean isA(TypedNameDeclaration vnd, java.lang.Class<?> clazz)
Deprecated.
-
isEither
@Deprecated public static boolean isEither(TypedNameDeclaration vnd, java.lang.Class<?> class1, java.lang.Class<?> class2)
Deprecated.
-
isNeither
@Deprecated public static boolean isNeither(TypedNameDeclaration vnd, java.lang.Class<?> class1, java.lang.Class<?> class2)
Deprecated.
-
subclasses
public static boolean subclasses(TypeNode n, java.lang.Class<?> clazz)
-
isA
public static boolean isA(TypedNameDeclaration vnd, java.lang.String className)
-
-