APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.bcel.internal.classfile

public final Class Module

extends Attribute
Class Inheritance
Imports
java.io.DataInput, .DataOutputStream, .IOException, java.util.Arrays, com.sun.org.apache.bcel.internal.Const

This class is derived from Attribute and represents the list of modules required, exported, opened or provided by a module. There may be at most one Module attribute in a ClassFile structure.
Since
6.4.0
See Also
Attribute

Field Summary

Modifier and TypeField and Description
private ModuleExports[]
public static final String
EXTENSION

The module file name extension.

private final int
private final int
private final int
private ModuleOpens[]
private ModuleProvides[]
private ModuleRequires[]
private final int
private final int[]
Inherited from com.sun.org.apache.bcel.internal.classfile.Attribute:
constant_poolEMPTY_ARRAYlengthname_indextag

Constructor Summary

AccessConstructor and Description
pack-priv
Module(final int
Index in constant pool
nameIndex
,
final int
Content length in bytes
length
,
final DataInput
Input stream
input
,
final ConstantPool
Array of constants
constantPool
)

Constructs object from input stream.

Method Summary

Modifier and TypeMethod and Description
public void
accept(final Visitor
Visitor object
v
)

Implements abstract com.sun.org.apache.bcel.internal.classfile.Attribute.accept.

Implements com.sun.org.apache.bcel.internal.classfile.Node.accept.

Called by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class.

public Attribute
copy(final ConstantPool constantPool)

Implements abstract com.sun.org.apache.bcel.internal.classfile.Attribute.copy.

Returns: deep copy of this attribute

public void
dump(final DataOutputStream
Output file stream
file
)

Overrides com.sun.org.apache.bcel.internal.classfile.Attribute.dump.

Dump Module attribute to file stream in binary format.

private static String
getClassNameAtIndex(final ConstantPool cp, final int index, final boolean compactClassName)

public ModuleExports[]
getExportsTable()

Returns: table of exported interfaces

public int

Returns:

module flags
getModuleFlags
()

Gets flags for this module.

public String

Returns:

module name
getModuleName
(final ConstantPool
Array of constants
cp
)

Gets module name.

public ModuleOpens[]
getOpensTable()

Returns: table of provided interfaces

public ModuleProvides[]
getProvidesTable()

Returns: table of provided interfaces

public ModuleRequires[]
getRequiresTable()

Returns: table of required modules

public String[]

Returns:

array of used class names
getUsedClassNames
(final ConstantPool
Array of constants usually obtained from the ClassFile object
constantPool
,
final boolean
false for original constant pool value, true to replace '/' with '.'
compactClassName
)

Gets the array of class names for this module's uses.

public String

Returns:

version from constant pool, "0" if version index is 0
getVersion
(final ConstantPool
Array of constants
cp
)

Gets version for this module.

public String

Returns:

String representation, i.e., a list of packages.
toString
()

Overrides com.sun.org.apache.bcel.internal.classfile.Attribute.toString.

Returns a string representation of the object.

Inherited from com.sun.org.apache.bcel.internal.classfile.Attribute:
addAttributeReaderclonegetConstantPoolgetLengthgetNamegetNameIndexgetTagprintlnreadAttributereadAttributeremoveAttributeReadersetConstantPoolsetLengthsetNameIndex

Field Detail

exportsTableback to summary
private ModuleExports[] exportsTable
EXTENSIONback to summary
public static final String EXTENSION

The module file name extension.

Since
6.7.0
moduleFlagsback to summary
private final int moduleFlags
moduleNameIndexback to summary
private final int moduleNameIndex
moduleVersionIndexback to summary
private final int moduleVersionIndex
opensTableback to summary
private ModuleOpens[] opensTable
providesTableback to summary
private ModuleProvides[] providesTable
requiresTableback to summary
private ModuleRequires[] requiresTable
usesCountback to summary
private final int usesCount
usesIndexback to summary
private final int[] usesIndex

Constructor Detail

Moduleback to summary
pack-priv Module(final int nameIndex, final int length, final DataInput input, final ConstantPool constantPool) throws IOException

Constructs object from input stream.

Parameters
nameIndex:int

Index in constant pool

length:int

Content length in bytes

input:DataInput

Input stream

constantPool:ConstantPool

Array of constants

Exceptions
IOException:
if an I/O error occurs.

Method Detail

acceptback to summary
public void accept(final Visitor v)

Implements abstract com.sun.org.apache.bcel.internal.classfile.Attribute.accept.

Implements com.sun.org.apache.bcel.internal.classfile.Node.accept.

Called by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class. I.e., the hierarchy of methods, fields, attributes, etc. spawns a tree of objects.

Parameters
v:Visitor

Visitor object

Annotations
@Override
copyback to summary
public Attribute copy(final ConstantPool constantPool)

Implements abstract com.sun.org.apache.bcel.internal.classfile.Attribute.copy.

Returns:Attribute

deep copy of this attribute

Annotations
@Override
dumpback to summary
public void dump(final DataOutputStream file) throws IOException

Overrides com.sun.org.apache.bcel.internal.classfile.Attribute.dump.

Dump Module attribute to file stream in binary format.

Parameters
file:DataOutputStream

Output file stream

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
getClassNameAtIndexback to summary
private static String getClassNameAtIndex(final ConstantPool cp, final int index, final boolean compactClassName)
getExportsTableback to summary
public ModuleExports[] getExportsTable()
Returns:ModuleExports[]

table of exported interfaces

See Also
ModuleExports
getModuleFlagsback to summary
public int getModuleFlags()

Gets flags for this module.

Returns:int

module flags

Since
6.10.0
getModuleNameback to summary
public String getModuleName(final ConstantPool cp)

Gets module name.

Parameters
cp:ConstantPool

Array of constants

Returns:String

module name

Since
6.10.0
getOpensTableback to summary
public ModuleOpens[] getOpensTable()
Returns:ModuleOpens[]

table of provided interfaces

See Also
ModuleOpens
getProvidesTableback to summary
public ModuleProvides[] getProvidesTable()
Returns:ModuleProvides[]

table of provided interfaces

See Also
ModuleProvides
getRequiresTableback to summary
public ModuleRequires[] getRequiresTable()
Returns:ModuleRequires[]

table of required modules

See Also
ModuleRequires
getUsedClassNamesback to summary
public String[] getUsedClassNames(final ConstantPool constantPool, final boolean compactClassName)

Gets the array of class names for this module's uses.

Parameters
constantPool:ConstantPool

Array of constants usually obtained from the ClassFile object

compactClassName:boolean

false for original constant pool value, true to replace '/' with '.'

Returns:String[]

array of used class names

Since
6.10.0
getVersionback to summary
public String getVersion(final ConstantPool cp)

Gets version for this module.

Parameters
cp:ConstantPool

Array of constants

Returns:String

version from constant pool, "0" if version index is 0

Since
6.10.0
toStringback to summary
public String toString()

Overrides com.sun.org.apache.bcel.internal.classfile.Attribute.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

String representation, i.e., a list of packages.

Annotations
@Override