Class TypeHelper


  • public final class TypeHelper
    extends java.lang.Object
    • Method Detail

      • isA

        public static boolean isA​(TypeNode n,
                                  java.lang.String clazzName)
        Checks whether the resolved type of the given TypeNode n 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 check
        clazzName - the class name to compare to
        Returns:
        true if 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 given TypeNode n is exactly of the type given by the clazzName.
        Parameters:
        n - the type node to check
        clazzName - the class name to compare to
        Returns:
        true if type node n is exactly of type clazzName.
      • 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)
      • subclasses

        public static boolean subclasses​(TypeNode n,
                                         java.lang.Class<?> clazz)