| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
See also the ClassGraph API overview.
💡 Methods whose name begins with getAll... return the whole transitive closure of a relationship (all subclasses, all superinterfaces, all annotations including meta-annotations, and so on). The corresponding getDirect... methods return only what is one step away -- what the class itself names in its extends or implements clause, or what is written on it directly.
Holds information about a class. Obtained by calling ScanResult#getAllClasses() and related methods.
⚠️ Do not compare the returned value against a hardcoded integer. Use the named accessors below (.isPublic(), .isStatic(), etc.), or test individual bits with the java.lang.reflect.Modifier predicates, rather than comparing the whole value.
🛑 ClassGraph makes no attempt to resolve type variables in the types of superclasses or interfaces, or their fields or methods, by substituting type arguments for type parameters. If you need concrete types for a specific type context, you will need to do the type substitution yourself.
⚠️ The queries below never return an external class unless ClassGraph#enableExternalClasses() was called. This applies to the queries that look upwards -- .getSuperclass(), .getAllSuperclasses(), .getAllSuperinterfaces(), .getDirectSuperinterfaces(), .getAllAnnotations(), .getDirectAnnotations(), .getFieldAnnotations(), .getMethodAnnotations(), .getOuterClasses() and .getInnerClasses() -- just as it does to the downward queries such as .getAllSubclasses(). The class graph is still completed through the external classes, so an accepted class that can only be reached by passing through an external class is still found; the external class itself is just left out of the answer. The predicates that report the class hierarchy as the JVM sees it -- .extendsSuperclass(), .implementsInterface(), .hasAnnotation(), .isInnerClass() and .isOuterClass() -- are not affected, and neither are the type signatures, the method override order, or the inheritance of @Inherited annotations.
Standard classes:
Enums:
Interfaces:
Annotations: (N.B. call .enableAnnotationInfo() before .scan() to enable annotation scanning, and call .ignoreClassVisibility() if you want to scan non-public annotations.)
💡 ClassGraph handles meta-annotations transitively. For example, in this class graph, the class A has annotation @F, B has annotations @F and @E, and C has annotation @G. The annotation classes F and E are both meta-annotated with @J, and E is also meta-annotated with @I, etc. This means that the list of all annotations on A is [J, F], and the list of all annotations on B is [D, K, H, L, J, I, E].
Methods: (N.B. call .enableMethodInfo() before .scan() to enable method scanning, and call .ignoreMethodVisibility() to scan non-public methods.)
💡 The .getDeclared...() and .hasDeclared...() versions of the following methods only apply to methods defined in the base class, i.e. they exclude default methods defined in any interfaces implemented by the class, and methods inherited from the class' superclasses. See also this note on the effect of .ignoreMethodVisibility().
Fields: (N.B. call .enableFieldInfo() before .scan() to enable field scanning, and call .ignoreFieldVisibility() to scan non-public fields.)
💡 The .getDeclared...() and .hasDeclared...() versions of the following methods only apply to fields defined in the base class, i.e. they exclude fields inherited from the class' superclasses. See also this note on the effect of .ignoreFieldVisibility().
Inner classes:
Location:
Finding class dependencies:
💡 Call ClassGraph#enableInterClassDependencies() before #scan() to enable the following method; you can also call ClassGraph#enableExternalClasses() if you want non-accepted classes in the result.
💡 See also ScanResult#getClassDependencyMap(), ScanResult#getReverseClassDependencyMap(), and GraphVizDotFile#writeFromInterClassDependencies() for rendering the dependency graph.
ArrayClassInfo is a subclass of ClassInfo that is used to hold metadata about an array class, e.g. int[][].class.
An ArrayClassInfo reference is obtained from an ArrayTypeSignature by calling ArrayTypeSignature#getArrayClassInfo().
The property method ClassInfo#isArrayClass() returns true if a ClassInfo object is an ArrayClassInfo.
ArrayClassInfo is assignable to ClassInfo for convenience, but most of the ClassInfo methods return empty or default values, e.g. ArrayClassInfo#getMethodInfo() and ArrayClassInfo#getFieldInfo() both return empty lists.
However, ArrayClassInfo extends ClassInfo with the following additional methods for dealing with arrays:
💡 These methods apply to the innermost element type, e.g. for an array type of int[][], the innermost element type is int (and not int[], which is the element type of the toplevel array type).
A list of ClassInfo objects. The list is deduplicated (a ClassInfoList is produced from Set<ClassInfo> internally), and the ClassInfo objects in the list are sorted in order of class name, with three exceptions: ClassInfo#getAllSuperclasses() returns classes sorted in ascending order of inheritance hierarchy, ClassInfo#getOuterClasses() returns containing classes from innermost to outermost, and ClassInfo#getAllSuperinterfaces() preserves declaration order, since the order in which interfaces are declared is significant for inheritance.
ClassInfoList extends ArrayList<ClassInfo> with the following convenience methods:
A ClassInfoList can be rendered as a GraphViz .dot file by the separate classgraph-viz library -- see the GraphViz API.
| Back | FazBrowse Home | New Git URL |