/** * @return true if this is an inner class (call {@link #isAnonymousInnerClass()} to test if this is an anonymous * inner class). If true, the containing class can be determined by calling {@link #getOuterClasses()}. */ public boolean isInnerClass() { return !getOuterClasses().isEmpty(); }
/** * @return true if this class contains inner classes. If true, the inner classes can be determined by calling * {@link #getInnerClasses()}. */ public boolean isOuterClass() { return !getInnerClasses().isEmpty(); }
/** * Convert this list of {@link ClassInfo} objects to a list of {@code Class<?>} objects. Causes the classloader * to load the class named by each {@link ClassInfo} object, if it is not already loaded. * * @param ignoreExceptions * If true, ignore any exceptions or errors thrown during classloading. If an exception or error is * thrown during classloading, no {@code Class<?>} reference is added to the output class for the * corresponding {@link ClassInfo} object, so the returned list may contain fewer items than this * input list. If false, {@link IllegalArgumentException} is thrown if the class could not be loaded. * @throws IllegalArgumentException * if ignoreExceptions is false and an exception or error was thrown while trying to load any of the * classes. * @return The loaded {@code Class<?>} objects corresponding to each {@link ClassInfo} object in this list. */ public List<Class<?>> loadClasses(final boolean ignoreExceptions) { if (this.isEmpty()) { return Collections.emptyList(); } else { final List<Class<?>> classRefs = new ArrayList<>(); // Try loading each class for (final ClassInfo classInfo : this) { final Class<?> classRef = classInfo.loadClass(ignoreExceptions); if (classRef != null) { classRefs.add(classRef); } } return classRefs.isEmpty() ? Collections.<Class<?>> emptyList() : classRefs; } }
if (this.isEmpty()) { return Collections.emptyList(); } else {
/** * Generate a .dot file which can be fed into GraphViz for layout and visualization of the class graph. The * returned graph shows inter-class dependencies only. The sizeX and sizeY parameters are the image output size * to use (in inches) when GraphViz is asked to render the .dot file. You must have called * {@link ClassGraph#enableInterClassDependencies()} before scanning to use this method. * * <p> * Equivalent to calling {@link #generateGraphVizDotFileFromInterClassDependencies(float, float, boolean)} with * parameters of (10.5f, 8f, scanSpec.enableExternalClasses), where scanSpec.enableExternalClasses is true if * {@link ClassGraph#enableExternalClasses()} was called before scanning. * * @throws IllegalArgumentException * if this {@link ClassInfoList} is empty or {@link ClassGraph#enableInterClassDependencies()} was * not called before scanning (since there would be nothing to graph). * @return the GraphViz file contents. */ public String generateGraphVizDotFileFromClassDependencies() { if (isEmpty()) { throw new IllegalArgumentException("List is empty"); } final ScanSpec scanSpec = get(0).scanResult.scanSpec; if (!scanSpec.enableInterClassDependencies) { throw new IllegalArgumentException( "Please call ClassGraph#enableInterClassDependencies() before #scan()"); } return GraphvizDotfileGenerator.generateGraphVizDotFileFromInterClassDependencies(this, 10.5f, 8.0f, scanSpec.enableExternalClasses); }
if (isEmpty()) { throw new IllegalArgumentException("List is empty");
ClassInfoList annotationHandlers = scanResult.getClassesImplementing(REWRITE_ANNOTATION_HANDLER); if (annotationHandlers.isEmpty()) { return;
final boolean showFieldTypeDependencyEdges, final boolean showMethods, final boolean showMethodTypeDependencyEdges, final boolean showAnnotations) { if (isEmpty()) { throw new IllegalArgumentException("List is empty");