public class ApiSurface extends Object
For the purposes of calculating the public API surface, exposure includes any public or protected occurrence of:
Exposure is a transitive property. The resulting map excludes primitives and array classes themselves.
It is prudent (though not required) to prune prefixes like "java" via the builder
method pruningPrefix(java.lang.String) to halt the traversal so it does not uselessly catalog references
that are not interesting.
| Modifier and Type | Method and Description |
|---|---|
static ApiSurface |
empty()
Returns an empty
ApiSurface. |
List<Class<?>> |
getAnyExposurePath(Class<?> exposedClass)
Returns a path from an exposed class to a root class.
|
Set<Class<?>> |
getExposedClasses()
Returns exposed types in this set, including arrays and primitives as
specified.
|
Set<Class<?>> |
getRootClasses()
Returns all public classes originally belonging to the package
in the
ApiSurface. |
static ApiSurface |
getSdkApiSurface() |
ApiSurface |
includingClass(Class<?> clazz)
Returns an
ApiSurface like this one, but also including the given class. |
ApiSurface |
includingPackage(String packageName)
Returns an
ApiSurface like this one, but also including the named
package and all of its subpackages. |
static void |
main(String[] args) |
static ApiSurface |
ofClass(Class<?> clazz)
Returns an
ApiSurface object representing just the surface of the given class. |
static ApiSurface |
ofPackage(String packageName)
Returns an
ApiSurface object representing the given package and all subpackages. |
ApiSurface |
pruningClass(Class<?> clazz)
Returns an
ApiSurface like this one, but pruning references from the
provided class. |
ApiSurface |
pruningClassName(String className)
Returns an
ApiSurface like this one, but pruning references from the named
class. |
ApiSurface |
pruningPattern(Pattern pattern)
Returns an
ApiSurface like this one, but pruning transitive
references from classes whose full name (including package) begins with the provided prefix. |
ApiSurface |
pruningPattern(String patternString)
See {@link #pruningPattern(Pattern).
|
ApiSurface |
pruningPrefix(String prefix)
Returns an
ApiSurface like this one, but pruning transitive
references from classes whose full name (including package) begins with the provided prefix. |
public static ApiSurface empty()
ApiSurface.public static ApiSurface ofPackage(String packageName) throws IOException
ApiSurface object representing the given package and all subpackages.IOExceptionpublic static ApiSurface ofClass(Class<?> clazz)
ApiSurface object representing just the surface of the given class.public ApiSurface includingPackage(String packageName) throws IOException
ApiSurface like this one, but also including the named
package and all of its subpackages.IOExceptionpublic ApiSurface includingClass(Class<?> clazz)
ApiSurface like this one, but also including the given class.public ApiSurface pruningPrefix(String prefix)
ApiSurface like this one, but pruning transitive
references from classes whose full name (including package) begins with the provided prefix.public ApiSurface pruningClassName(String className)
ApiSurface like this one, but pruning references from the named
class.public ApiSurface pruningClass(Class<?> clazz)
ApiSurface like this one, but pruning references from the
provided class.public ApiSurface pruningPattern(Pattern pattern)
ApiSurface like this one, but pruning transitive
references from classes whose full name (including package) begins with the provided prefix.public ApiSurface pruningPattern(String patternString)
public Set<Class<?>> getRootClasses()
ApiSurface.public Set<Class<?>> getExposedClasses()
public List<Class<?>> getAnyExposurePath(Class<?> exposedClass)
If there are only cycles, with no path back to a root class, throws IllegalStateException.
public static ApiSurface getSdkApiSurface() throws IOException
IOException