# Class Record

java.lang.Object
org.apache.bcel.classfile.Attribute
org.apache.bcel.classfile.Record

All Implemented Interfaces:
  `Cloneable, Node`

public final class Record extends Attribute
Extends `Attribute` and records the classes and interfaces that are authorized to claim membership in the nest hosted by the current class or interface. There may be at most one Record attribute in a ClassFile structure.

Since:
  6.9.0
See Also:
  - `Attribute`

- ## Field Summary

  ### Fields inherited from class Attribute

  `constant_pool, EMPTY_ARRAY, length, name_index, tag`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Record(int nameIndex, int length, RecordComponentInfo[] classes, ConstantPool constantPool)`
  Constructs a new instance using components.

- ## 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.
  `Attribute`
  `copy(ConstantPool constantPool)`
  Copies this instance and its components.
  `void`
  `dump(DataOutputStream file)`
  Dumps this instance into a file stream in binary format.
  `RecordComponentInfo[]`
  `getComponents()`
  Gets all the record components.
  `String`
  `toString()`
  Converts this instance to a String suitable for debugging.

  ### Methods inherited from class Attribute

  `addAttributeReader, addAttributeReader, clone, getConstantPool, getLength, getName, getNameIndex, getTag, println, readAttribute, readAttribute, removeAttributeReader, setConstantPool, setLength, setNameIndex`

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### Record

    public Record(int nameIndex, int length, RecordComponentInfo[] classes, ConstantPool constantPool)
    Constructs a new instance using components.
    Parameters:
      `nameIndex` - Index in constant pool
      `length` - Content length in bytes
      `classes` - Array of Record Component Info elements
      `constantPool` - Array of constants

- ## 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. For example, the hierarchy of methods, fields, attributes, etc. spawns a tree of objects.
    Specified by:
      `accept` in interface `Node`
    Specified by:
      `accept` in class `Attribute`
    Parameters:
      `v` - Visitor object

  - ### copy

    public Attribute copy(ConstantPool constantPool)
    Copies this instance and its components.
    Specified by:
      `copy` in class `Attribute`
    Parameters:
      `constantPool` - constant pool to save.
    Returns:
      a deep copy of this instance and its components.

  - ### dump

    public void dump(DataOutputStream file) throws IOException
    Dumps this instance into a file stream in binary format.
    Overrides:
      `dump` in class `Attribute`
    Parameters:
      `file` - output stream.
    Throws:
      `IOException` - if an I/O error occurs.

  - ### getComponents

    public RecordComponentInfo[] getComponents()
    Gets all the record components.
    Returns:
      array of Record Component Info elements.

  - ### toString

    public String toString()
    Converts this instance to a String suitable for debugging.
    Overrides:
      `toString` in class `Attribute`
    Returns:
      String a String suitable for debugging.