java.module
Class Module

java.lang.Object
  extended by java.module.Module

public abstract class Module
extends Object

This class represents the reified module instance in the module system.

Since:
1.7.0
Author:
Stanley M. Ho
See Also:
ClassLoader, ModuleDefinition, ModuleSystemPermission

Constructor Summary
protected Module()
          Creates a new Module instance.
 
Method Summary
abstract  void deepValidate()
          Perform deep validation on the module instance.
 boolean equals(Object obj)
          Compares the specified object with this Module for equality.
abstract  ClassLoader getClassLoader()
          Returns the classloader associated with the module instance.
abstract  List<Module> getImportedModules()
          Returns an unmodifiable list of imported module instances.
abstract  ModuleDefinition getModuleDefinition()
          Returns the ModuleDefinition of the module instance.
 int hashCode()
          Returns a hash code for this Module.
abstract  boolean supportsDeepValidation()
          Check if deep validation is supported.
 String toString()
          Returns a String object representing this Module.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Module

protected Module()
Creates a new Module instance.

Method Detail

getModuleDefinition

public abstract ModuleDefinition getModuleDefinition()
Returns the ModuleDefinition of the module instance.

Returns:
the ModuleDefinition object.

getClassLoader

public abstract ClassLoader getClassLoader()
Returns the classloader associated with the module instance.

If a security manager is present, and the caller's class loader is not null and the caller's class loader is not the same as or an ancestor of the class loader for the module instance whose class loader is requested, then this method calls the security manager's checkPermission method with a RuntimePermission("getClassLoader") permission to ensure it's ok to access the class loader for the module instance.

Returns:
the classloader object of the module.
Throws:
SecurityException - if a security manager exists and its checkPermission method denies access to the class loader for the module instance.

getImportedModules

public abstract List<Module> getImportedModules()
Returns an unmodifiable list of imported module instances.

Returns:
an unmodifiable list of imported module instances.

supportsDeepValidation

public abstract boolean supportsDeepValidation()
Check if deep validation is supported.

Returns:
true if deep validation is supported.

deepValidate

public abstract void deepValidate()
                           throws ModuleInitializationException
Perform deep validation on the module instance.

Throws:
ModuleInitializationException - if deep validation fails.

equals

public final boolean equals(Object obj)
Compares the specified object with this Module for equality. Returns true if and only if obj is the same object as this object.

Overrides:
equals in class Object
Parameters:
obj - the object to be compared for equality with this module.
Returns:
true if the specified object is equal to this module

hashCode

public final int hashCode()
Returns a hash code for this Module.

Overrides:
hashCode in class Object
Returns:
a hash code value for this object.

toString

public String toString()
Returns a String object representing this Module.

Overrides:
toString in class Object
Returns:
a string representation of the Module object.