类 AttributeList

所有已实现的接口:
Serializable , Cloneable , Iterable<Object> , Collection<Object> , List<Object> , RandomAccess

public class AttributeList extends ArrayList <Object >

表示 MBean 属性的值列表。请参阅 MBeanServer MBeanServerConnection getAttributes setAttributes 方法。

出于兼容性原因,虽然非常不鼓励,但可以将对象添加到 AttributeList 而不是 Attribute 的实例。但是,可以将 AttributeList 变为 type-safe ,这意味着尝试添加不是 Attribute 的对象将产生 IllegalArgumentException 。当调用方法 asList() 时,AttributeList 变为类型安全的。

自从:
1.5
参见:
  • 构造方法详细信息

    • AttributeList

      public AttributeList()
      构造一个空的 AttributeList
    • AttributeList

      public AttributeList(int initialCapacity)
      构造一个具有指定初始容量的空AttributeList
      参数:
      initialCapacity - AttributeList 的初始容量,由 ArrayList(int) 指定。
    • AttributeList

      public AttributeList(AttributeList  list)
      构造一个包含 AttributeList 指定元素的 AttributeList,按照它们由 AttributeList 的迭代器返回的顺序。 AttributeList 实例的初始容量为指定的 AttributeList 大小的 110%。
      参数:
      list - 定义新 AttributeList 初始内容的 AttributeList
      参见:
    • AttributeList

      public AttributeList(List <Attribute > list)
      构造一个包含 List 指定元素的 AttributeList,按照它们由 List 的迭代器返回的顺序。
      参数:
      list - 定义新 AttributeList 初始内容的 List
      抛出:
      IllegalArgumentException - 如果 list 参数是 null 或者如果 list 参数包含任何非属性对象。
      自从:
      1.6
      参见:
  • 方法详情

    • asList

      public List <Attribute > asList()
      将此list的视图作为 List<Attribute> 返回。对返回值的更改会反映在对原始 AttributeList 的更改中,反之亦然。
      返回:
      一个 List<Attribute> 其内容反映了这个 AttributeList 的内容。

      如果曾在给定的 AttributeList 实例上调用过此方法,则随后尝试向该实例添加一个不是 Attribute 的对象将失败并返回 IllegalArgumentException 。出于兼容性原因,从未调用过此方法的 AttributeList 允许添加 Attribute 以外的对象。

      抛出:
      IllegalArgumentException - 如果这个 AttributeList 包含一个不是 Attribute 的元素。
      自从:
      1.6
    • add

      public void add(Attribute  object)
      添加指定为列表最后一个元素的 Attribute
      参数:
      object - 要添加的属性。
    • add

      public void add(int index, Attribute  object)
      在指定位置插入指定为元素的属性。索引大于或等于当前位置的元素向上移动。如果索引超出范围 (index < 0 || index > size()),应引发 RuntimeOperationsException,包装抛出的 java.lang.IndexOutOfBoundsException。
      参数:
      index - 列表中要插入新 Attribute 对象的位置。
      object - 要插入的 Attribute 对象。
    • set

      public void set(int index, Attribute  object)
      将指定位置的元素设置为指定的属性。该位置的前一个元素将被丢弃。如果索引超出范围 (index < 0 || index > size()),应引发 RuntimeOperationsException,包装抛出的 java.lang.IndexOutOfBoundsException。
      参数:
      index - 指定的位置。
      object - 属性元素应设置的值。
    • addAll

      public boolean addAll(AttributeList  list)
      将指定的 AttributeList 中的所有元素追加到列表的末尾,按照它们由指定的 AttributeList 的迭代器返回的顺序。
      参数:
      list - 要插入到列表中的元素。
      返回:
      如果此list因调用而更改,则为真。
      参见:
    • addAll

      public boolean addAll(int index, AttributeList  list)
      将指定的 AttributeList 中的所有元素插入此list,从指定位置开始,按照它们由指定的 AttributeList 的迭代器返回的顺序。如果索引超出范围 (index < 0 || index > size()),应引发 RuntimeOperationsException,包装抛出的 java.lang.IndexOutOfBoundsException。
      参数:
      index - 从指定的 AttributeList 插入第一个元素的位置。
      list - 要插入到列表中的元素。
      返回:
      如果此list因调用而更改,则为真。
      参见:
    • add

      public boolean add(Object  element)
      将指定的元素附加到此list的末尾。
      指定者:
      add 在接口 Collection<Object>
      指定者:
      add 在接口 List<Object>
      重写:
      add 在类 ArrayList<Object>
      参数:
      element - 要附加到此list的元素
      返回:
      true(由 Collection.add(E) 指定)
      抛出:
      IllegalArgumentException - 如果这个 AttributeListtype-safeelement 不是 Attribute
    • add

      public void add(int index, Object  element)
      在此list中的指定位置插入指定元素。将当前位于该位置的元素(如果有)和任何后续元素向右移动(将其索引加一)。
      指定者:
      add 在接口 List<Object>
      重写:
      add 在类 ArrayList<Object>
      参数:
      index - 要插入指定元素的索引
      element - 要插入的元素
      抛出:
      IllegalArgumentException - 如果这个 AttributeListtype-safeelement 不是 Attribute
    • addAll

      public boolean addAll(Collection <?> c)
      将指定集合中的所有元素追加到此list的末尾,按照它们由指定集合的迭代器返回的顺序。如果在操作进行时修改了指定的集合,则此操作的行为是未定义的。 (这意味着如果指定的集合是这个列表并且这个列表是非空的,那么这个调用的行为是未定义的。)
      指定者:
      addAll 在接口 Collection<Object>
      指定者:
      addAll 在接口 List<Object>
      重写:
      addAll 在类 ArrayList<Object>
      参数:
      c - 包含要添加到此list的元素的集合
      返回:
      true 如果此list因调用而更改
      抛出:
      IllegalArgumentException - 如果这个 AttributeListtype-safe 并且 c 包含一个不是 Attribute 的元素。
      参见:
    • addAll

      public boolean addAll(int index, Collection <?> c)
      将指定集合中的所有元素插入此list,从指定位置开始。将当前位于该位置的元素(如果有)和任何后续元素向右移动(增加它们的索引)。新元素将按照它们由指定集合的迭代器返回的顺序出现在列表中。
      指定者:
      addAll 在接口 List<Object>
      重写:
      addAll 在类 ArrayList<Object>
      参数:
      index - 从指定集合中插入第一个元素的索引
      c - 包含要添加到此list的元素的集合
      返回:
      true 如果此list因调用而更改
      抛出:
      IllegalArgumentException - 如果这个 AttributeListtype-safe 并且 c 包含一个不是 Attribute 的元素。
    • set

      public Object  set(int index, Object  element)
      用指定元素替换此list中指定位置的元素。
      指定者:
      set 在接口 List<Object>
      重写:
      set 在类 ArrayList<Object>
      参数:
      index - 要替换的元素的索引
      element - 要存储在指定位置的元素
      返回:
      先前在指定位置的元素
      抛出:
      IllegalArgumentException - 如果这个 AttributeListtype-safeelement 不是 Attribute