com.android.dx.cf.iface
Class StdAttributeList

java.lang.Object
  extended by com.android.dx.util.MutabilityControl
      extended by com.android.dx.util.FixedSizeList
          extended by com.android.dx.cf.iface.StdAttributeList
All Implemented Interfaces:
AttributeList, ToHuman

public final class StdAttributeList
extends FixedSizeList
implements AttributeList

Standard implementation of AttributeList, which directly stores an array of Attribute objects and can be made immutable.


Constructor Summary
StdAttributeList(int size)
          Constructs an instance.
 
Method Summary
 int byteLength()
          Get the total length of this list in bytes, when part of a class file.
 Attribute findFirst(String name)
          Get the first attribute in the list with the given name, if any.
 Attribute findNext(Attribute attrib)
          Get the next attribute in the list after the given one, with the same name, if any.
 Attribute get(int n)
          Get the nth attribute.
 void set(int n, Attribute attribute)
          Sets the attribute at the given index.
 
Methods inherited from class com.android.dx.util.FixedSizeList
equals, get0, getOrNull0, hashCode, set0, shrinkToFit, size, toHuman, toHuman, toString, toString
 
Methods inherited from class com.android.dx.util.MutabilityControl
isImmutable, isMutable, setImmutable, throwIfImmutable, throwIfMutable
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.android.dx.cf.iface.AttributeList
isMutable, size
 

Constructor Detail

StdAttributeList

public StdAttributeList(int size)
Constructs an instance. All indices initially contain null.

Parameters:
size - the size of the list
Method Detail

get

public Attribute get(int n)
Get the nth attribute.

Specified by:
get in interface AttributeList
Parameters:
n - n >= 0, n < size(); which attribute
Returns:
non-null; the attribute in question

byteLength

public 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.

Specified by:
byteLength in interface AttributeList
Returns:
>= 2; the total length, in bytes

findFirst

public Attribute findFirst(String name)
Get the first attribute in the list with the given name, if any.

Specified by:
findFirst in interface AttributeList
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

public Attribute findNext(Attribute attrib)
Get the next attribute in the list after the given one, with the same name, if any.

Specified by:
findNext in interface AttributeList
Parameters:
attrib - non-null; attribute to start looking after
Returns:
null-ok; next attribute after attrib with the same name as attrib

set

public void set(int n,
                Attribute attribute)
Sets the attribute at the given index.

Parameters:
n - >= 0, < size(); which attribute
attribute - null-ok; the attribute object


Copyright © 2015. All rights reserved.