Example usage for java.lang Module getDescriptor

List of usage examples for java.lang Module getDescriptor

Introduction

In this page you can find the example usage for java.lang Module getDescriptor.

Prototype

public ModuleDescriptor getDescriptor() 

Source Link

Document

Returns the module descriptor for this module or null if this module is an unnamed module.

Usage

From source file:org.apache.commons.rng.examples.jpms.app.DiceGameApplication.java

/**
 * Display JPMS information.//  w  w w .ja  va 2s .com
 */
private void displayModuleInfo() {
    final StringBuilder str = new StringBuilder();

    for (Module mod : new Module[] { DiceGame.class.getModule(), DiceGameApplication.class.getModule() }) {
        System.out.println("--- " + mod + " ---");
        final ModuleDescriptor desc = mod.getDescriptor();

        for (ModuleDescriptor.Requires r : desc.requires()) {
            System.out.println(mod.getName() + " requires " + r.name());
        }

        System.out.println();
    }
}