Skip to content

Commit 6b76857

Browse files
committed
Improved projects' addon README
1 parent 48d0f58 commit 6b76857

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

projects/README.asciidoc

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,4 +305,18 @@ Project temp = factory.createTempProject();
305305

306306

307307
Consistent programming experience::
308-
Because the Project API provides an abstract model for interacting with existing and creating new projects, it is used in a number of addons and should be considered the standard approach for project manipulation.
308+
Because the Project API provides an abstract model for interacting with existing and creating new projects, it is used in a number of addons and should be considered the standard approach for project manipulation.
309+
310+
ClassLoaderFacet::
311+
This addon introduces a ClassLoaderFacet that provides a URLClassLoader from the project dependencies.
312+
+
313+
[source,java]
314+
----
315+
ClassLoaderFacet facet = project.getFacet(ClassLoaderFacet.class);
316+
// This classloader contains all the project classes and their dependencies
317+
try (URLClassLoader classLoader = facet.getClassLoader()) {
318+
// Load classes and use the reflection API to introspect classes
319+
Class<?> clazz = classLoader.loadClass("com.example.Foo");
320+
321+
----
322+

0 commit comments

Comments
 (0)