Java SE API
Module.getDescriptor
Read metadata for a named module, or null for an unnamed module.
Formal Syntax & Structure
java syntaxjava
module.getDescriptor()Working Example
Example Snippetjava
public class Main {
public static void main(String[] args) throws Exception { var descriptor = java.sql.Connection.class.getModule().getDescriptor(); System.out.println(descriptor.name()); System.out.println(descriptor.requires().stream().anyMatch(r -> r.name().equals("java.base"))); }}