/** * Checks if the given {@link ImmutableClassType} or any of it's super classes have an * annotation that matches given annotation pattern. * * @param classType * Type to check. * @param annotationPattern * Pattern to test annotation FQNs with. * @return <code>true</code> if class or any super-classes have annotation that matches the * pattern. */ private boolean checkClassAndSuperClassForAnnotation(ImmutableClassType classType, IMatchPattern annotationPattern) { if (checkAnnotations(classType.getImmutableAnnotations(), annotationPattern)) { return true; } for (ImmutableClassType superClassType : classType.getImmutableSuperClasses()) { if (checkClassAndSuperClassForAnnotation(superClassType, annotationPattern)) { return true; } } return false; }
/** * Checks if the given {@link ImmutableInterfaceType} or any of it's super interfaces have an * annotation that matches given annotation pattern. * * @param interfaceType * Type to check. * @param annotationPattern * Pattern to test annotation FQNs with. * @return <code>true</code> if interface or any super-interfaces have annotation that matches * the pattern. */ private boolean checkInterfaceAndSuperInterfaceForAnnotation(ImmutableInterfaceType interfaceType, IMatchPattern annotationPattern) { if (checkAnnotations(interfaceType.getImmutableAnnotations(), annotationPattern)) { return true; } for (ImmutableInterfaceType superInterfaceType : interfaceType.getImmutableSuperInterfaces()) { if (checkInterfaceAndSuperInterfaceForAnnotation(superInterfaceType, annotationPattern)) { return true; } } return false; }