Qwylt

java.lang.module
Class Module

java.lang.Object
  extended by java.lang.module.ResourceSpace
      extended by java.lang.module.ClassSpace
          extended by java.lang.module.Module
All Implemented Interfaces:
java.lang.reflect.AnnotatedElement

public abstract class Module
extends ClassSpace
implements java.lang.reflect.AnnotatedElement

This ClassSpace represents a fully initialized module that can load classes and resources.

Since:
Dec 13, 2008
Author:
Bryan Atsatt

Constructor Summary
Module()
           
 
Method Summary
<T extends java.lang.annotation.Annotation>
T
getAnnotation(java.lang.Class<T> annotationClass)
          Returns this element's annotation for the specified type if such an annotation is present, else null.
 java.lang.annotation.Annotation[] getAnnotations()
          Returns all annotations present on this element.
abstract  ModuleArchive getArchive()
          Returns the archive from which this instance was created.
abstract  java.lang.ClassLoader getClassLoader()
          Returns the ClassLoader of this instance.
 java.util.List<? extends ModuleArchive> getCompositeMembers()
          Returns the ModuleArchive instances from which this instance was composed, or null if not a composite.
 java.lang.annotation.Annotation[] getDeclaredAnnotations()
          Returns all annotations that are directly present on this element.
 ModuleIdentity getIdentity()
          Returns the identity of this module.
 ModuleSystem getModuleSystem()
          Returns the ModuleSystem of this instance.
 java.lang.String getName()
          Returns the name of this module.
 ModuleRepository getRepository()
          Returns the repository from which this instance was created.
static Module getRootModule()
          Returns the root Module, which is the sole exporter of packages with the "java." prefix.
abstract  ServiceSpace getServiceSpace()
          Returns the ServiceSpace for this instance.
 Version getVersion()
          Returns the version of this module.
 boolean hasModuleAccess(Module module)
          Returns true iff the specified module has module (a.k.a.
 boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
          Returns true if an annotation for the specified type is present on this element, else false.
 boolean isComposite()
          Returns whether or not this instance was composed from multiple ModuleArchive instances.
 java.lang.String toString()
          Returns a string representation of this instance.
 
Methods inherited from class java.lang.module.ClassSpace
getPackageName, getPackageProvider, getServiceProviders, loadClass, loadLocalClass
 
Methods inherited from class java.lang.module.ResourceSpace
equals, getExportedPackages, getImportedPackages, getResource, getResourceData, getResourcePackageName, getResources, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Module

public Module()
Method Detail

getRootModule

public static Module getRootModule()
Returns the root Module, which is the sole exporter of packages with the "java." prefix.

Returns:
The root Module.

getName

public java.lang.String getName()
Returns the name of this module.

Specified by:
getName in class ResourceSpace
Returns:
The name.

getVersion

public Version getVersion()
Returns the version of this module.

Specified by:
getVersion in class ResourceSpace
Returns:
The version.

getIdentity

public ModuleIdentity getIdentity()
Returns the identity of this module.

Returns:
The ModuleIdentity.

getRepository

public ModuleRepository getRepository()
Returns the repository from which this instance was created.

Returns:
The archive.

getArchive

public abstract ModuleArchive getArchive()
Returns the archive from which this instance was created.

Returns:
The archive.

getModuleSystem

public ModuleSystem getModuleSystem()
Returns the ModuleSystem of this instance.

Returns:
The ModuleSystem.

hasModuleAccess

public boolean hasModuleAccess(Module module)
Returns true iff the specified module has module (a.k.a. "module-private") access to members of this module.

Parameters:
module - The module.
Returns:
true if the specified module has module-private access to this instance; otherwise, returns false.

isComposite

public boolean isComposite()
Returns whether or not this instance was composed from multiple ModuleArchive instances.

Returns:
true if this instance was composed from multiple ModuleArchive instances.

getCompositeMembers

public java.util.List<? extends ModuleArchive> getCompositeMembers()
Returns the ModuleArchive instances from which this instance was composed, or null if not a composite.

Returns:
The ModuleArchive instances from which this instance was composed, or null if not a composite..

getServiceSpace

public abstract ServiceSpace getServiceSpace()
Returns the ServiceSpace for this instance.

Returns:
The service space or null if none.

getClassLoader

public abstract java.lang.ClassLoader getClassLoader()
Returns the ClassLoader of this instance.

Returns:
The loader.

toString

public java.lang.String toString()
Returns a string representation of this instance.

Overrides:
toString in class ResourceSpace
Returns:
The string.

isAnnotationPresent

public boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Returns true if an annotation for the specified type is present on this element, else false. This method is designed primarily for convenient access to marker annotations.

Specified by:
isAnnotationPresent in interface java.lang.reflect.AnnotatedElement
Parameters:
annotationClass - the Class object corresponding to the annotation type
Returns:
true if an annotation for the specified annotation type is present on this element, else false
Throws:
java.lang.NullPointerException - if the given annotation class is null
Since:
1.5

getAnnotation

public <T extends java.lang.annotation.Annotation> T getAnnotation(java.lang.Class<T> annotationClass)
Returns this element's annotation for the specified type if such an annotation is present, else null.

Specified by:
getAnnotation in interface java.lang.reflect.AnnotatedElement
Parameters:
annotationClass - the Class object corresponding to the annotation type
Returns:
this element's annotation for the specified annotation type if present on this element, else null
Throws:
java.lang.NullPointerException - if the given annotation class is null
Since:
1.5

getAnnotations

public java.lang.annotation.Annotation[] getAnnotations()
Returns all annotations present on this element. (Returns an array of length zero if this element has no annotations.) The caller of this method is free to modify the returned array; it will have no effect on the arrays returned to other callers.

Specified by:
getAnnotations in interface java.lang.reflect.AnnotatedElement
Returns:
all annotations present on this element
Since:
1.5

getDeclaredAnnotations

public java.lang.annotation.Annotation[] getDeclaredAnnotations()
Returns all annotations that are directly present on this element. Unlike the other methods in this interface, this method ignores inherited annotations. (Returns an array of length zero if no annotations are directly present on this element.) The caller of this method is free to modify the returned array; it will have no effect on the arrays returned to other callers.

Specified by:
getDeclaredAnnotations in interface java.lang.reflect.AnnotatedElement
Returns:
All annotations directly present on this element
Since:
1.5

Qwylt

Send comments or questions to Bryan Atsatt