Class ReflectionTypeSolver
- java.lang.Object
-
- com.github.javaparser.symbolsolver.resolution.typesolvers.ClassLoaderTypeSolver
-
- com.github.javaparser.symbolsolver.resolution.typesolvers.ReflectionTypeSolver
-
- All Implemented Interfaces:
TypeSolver
public class ReflectionTypeSolver extends ClassLoaderTypeSolver
Uses reflection to resolve types. Classes on the classpath used to run your application will be found. No source code is available for the resolved types.
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.function.Predicate<java.lang.String>ALL_CLASSESClass name filter matching all classes.private java.util.function.Predicate<java.lang.String>classFilterstatic java.util.function.Predicate<java.lang.String>JCL_ONLYClass name filter matching classes in the Java Class Library.static java.util.function.Predicate<java.lang.String>JRE_ONLYClass name filter matching classes in the core Java standard library.-
Fields inherited from interface com.github.javaparser.resolution.TypeSolver
JAVA_LANG_OBJECT, JAVA_LANG_RECORD
-
-
Constructor Summary
Constructors Constructor Description ReflectionTypeSolver()Resolves classes from the JRE that is currently running.ReflectionTypeSolver(boolean jreOnly)ReflectionTypeSolver(java.util.function.Predicate<java.lang.String> classFilter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanfilterName(java.lang.String name)-
Methods inherited from class com.github.javaparser.symbolsolver.resolution.typesolvers.ClassLoaderTypeSolver
getParent, setModulePackagesFromLayers, setParent, tryToSolveType, tryToSolveTypeInModule
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.github.javaparser.resolution.TypeSolver
getRoot, getSolvedJavaLangObject, getSolvedJavaLangRecord, hasType, solveType, solveTypeInModule
-
-
-
-
Field Detail
-
classFilter
private final java.util.function.Predicate<java.lang.String> classFilter
-
ALL_CLASSES
public static final java.util.function.Predicate<java.lang.String> ALL_CLASSES
Class name filter matching all classes.
-
JRE_ONLY
public static final java.util.function.Predicate<java.lang.String> JRE_ONLY
Class name filter matching classes in the core Java standard library. This includes everything underjava.andjavax..
-
JCL_ONLY
public static final java.util.function.Predicate<java.lang.String> JCL_ONLY
Class name filter matching classes in the Java Class Library. The Java Class Library is the Java standard library; this filter includes all packages listed in thejava.semodule of Java 21, as well asjava.corbaas of Java 9. In this way, it encompasses the JCL of all Java version from Java 8 to 21.
-
-
Constructor Detail
-
ReflectionTypeSolver
public ReflectionTypeSolver(java.util.function.Predicate<java.lang.String> classFilter)
- Parameters:
classFilter- a name-based filter indicating which types to resolve. Similarily toReflectionTypeSolver(boolean), this allows you to specify "I need to resolve certain classes (like the Java standard library), and whatever is available on the classpath is fine.".- See Also:
ALL_CLASSES,JRE_ONLY,JCL_ONLY
-
ReflectionTypeSolver
public ReflectionTypeSolver(boolean jreOnly)
- Parameters:
jreOnly- if true, will only resolve types from the java or javax packages. This is an easy way to say "I need a JRE to solve classes, and the one that is currently running is fine." If false, will resolve any kind of type.
-
ReflectionTypeSolver
public ReflectionTypeSolver()
Resolves classes from the JRE that is currently running. (It calls the other constructor with "true".)
-
-
Method Detail
-
filterName
protected boolean filterName(java.lang.String name)
- Overrides:
filterNamein classClassLoaderTypeSolver
-
-