# Class ModuleRequires

java.lang.Object
org.apache.bcel.classfile.ModuleRequires

All Implemented Interfaces:
  `Cloneable, Node`

public final class ModuleRequires extends Object implements Cloneable, Node
This class represents an entry in the requires table of the Module attribute. Each entry describes a module on which the parent module depends.

Since:
  6.4.0
See Also:
  - `Module`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `accept(Visitor v)`
  Called by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class.
  `ModuleRequires`
  `copy()`
  `void`
  `dump(DataOutputStream file)`
  Dump table entry to file stream in binary format.
  `String`
  `getModuleName(ConstantPool constantPool)`
  Gets the module name from the constant pool.
  `int`
  `getRequiresFlags()`
  Gets the flags for this ModuleRequires.
  `String`
  `getVersion(ConstantPool constantPool)`
  Gets the required version from the constant pool.
  `String`
  `toString()`
  `String`
  `toString(ConstantPool constantPool)`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Method Details

  - ### accept

    public void accept(Visitor v)
    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.
    Specified by:
      `accept` in interface `Node`
    Parameters:
      `v` - Visitor object

  - ### copy

    public ModuleRequires copy()
    Returns:
      deep copy of this object

  - ### dump

    public void dump(DataOutputStream file) throws IOException
    Dump table entry to file stream in binary format.
    Parameters:
      `file` - Output file stream
    Throws:
      `IOException` - if an I/O Exception occurs in writeShort

  - ### getModuleName

    public String getModuleName(ConstantPool constantPool)
    Gets the module name from the constant pool.
    Parameters:
      `constantPool` - Array of constants usually obtained from the ClassFile object
    Returns:
      module name
    Since:
      6.10.0

  - ### getRequiresFlags

    public int getRequiresFlags()
    Gets the flags for this ModuleRequires.
    Returns:
      the requiresFlags
    Since:
      6.10.0

  - ### getVersion

    public String getVersion(ConstantPool constantPool)
    Gets the required version from the constant pool.
    Parameters:
      `constantPool` - Array of constants usually obtained from the ClassFile object
    Returns:
      required version, "0" if version index is 0.
    Since:
      6.10.0

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`
    Returns:
      String representation

  - ### toString

    public String toString(ConstantPool constantPool)
    Returns:
      Resolved string representation