Interface AttributeList

All Known Implementing Classes:
StdAttributeList

public interface AttributeList
Interface for lists of attributes.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Get the total length of this list in bytes, when part of a class file.
    Get the first attribute in the list with the given name, if any.
    Get the next attribute in the list after the given one, with the same name, if any.
    get(int n)
    Get the nth attribute.
    boolean
    Get whether this instance is mutable.
    int
    Get the number of attributes in the list.
  • Method Details

    • isMutable

      boolean isMutable()
      Get whether this instance is mutable. Note that the AttributeList interface itself doesn't provide any means of mutation, but that doesn't mean that there isn't a non-interface way of mutating an instance.
      Returns:
      true iff this instance is somehow mutable
    • size

      int size()
      Get the number of attributes in the list.
      Returns:
      the size
    • get

      Attribute get(int n)
      Get the nth attribute.
      Parameters:
      n - n >= 0, n < size(); which attribute
      Returns:
      non-null; the attribute in question
    • byteLength

      int byteLength()
      Get the total length of this list in bytes, when part of a class file. The returned value includes the two bytes for the attributes_count length indicator.
      Returns:
      >= 2; the total length, in bytes
    • findFirst

      Attribute findFirst(String name)
      Get the first attribute in the list with the given name, if any.
      Parameters:
      name - non-null; attribute name
      Returns:
      null-ok; first attribute in the list with the given name, or null if there is none
    • findNext

      Attribute findNext(Attribute attrib)
      Get the next attribute in the list after the given one, with the same name, if any.
      Parameters:
      attrib - non-null; attribute to start looking after
      Returns:
      null-ok; next attribute after attrib with the same name as attrib