Skip to content

Commit

Permalink
Add getPackages method to JavaModule.
Browse files Browse the repository at this point in the history
  • Loading branch information
raphw committed May 31, 2023
1 parent 2d77fd5 commit 54d0537
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions byte-buddy-dep/src/main/java/net/bytebuddy/utility/JavaModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.io.InputStream;
import java.lang.reflect.AnnotatedElement;
import java.security.PrivilegedAction;
import java.util.Set;

/**
* Type-safe representation of a {@code java.lang.Module}. On platforms that do not support the module API, modules are represented by {@code null}.
Expand Down Expand Up @@ -128,6 +129,15 @@ public String getActualName() {
return MODULE.getName(module);
}

/**
* Returns the packages of this module.
*
* @return A set of the names of the packages that are defined by this module.
*/
public Set<String> getPackages() {
return MODULE.getPackages(module);
}

/**
* Returns a resource stream for this module for a resource of the given name or {@code null} if such a resource does not exist.
*
Expand Down Expand Up @@ -271,6 +281,14 @@ protected interface Module {
*/
String getName(Object value);

/**
* Returns the module's exported packages.
*
* @param value The {@code java.lang.Module} to check for its packages.
* @return The module's packages.
*/
Set<String> getPackages(Object value);

/**
* Returns the class loader of a module.
*
Expand Down

0 comments on commit 54d0537

Please sign in to comment.