FileDocCategorySizeDatePackage
IFieldCollection.javaAPI DocAndroid 1.5 API3517Wed May 06 22:41:16 BST 2009com.vladium.jcd.cls

IFieldCollection

public interface IFieldCollection implements Cloneable, com.vladium.jcd.compiler.IClassFormatOutput
An abstraction of the 'fields' component of .class format. The contents are {@link Field_info} structures corresponding to all fields directly declared by this class/interface. The order in which they appear is unspecified.
author
(C) 2001, Vlad Roubtsov

Fields Summary
Constructors Summary
Methods Summary
public voidaccept(IClassDefVisitor visitor, java.lang.Object ctx)

public intadd(Field_info field)
Adds a new Field_info descriptor to this collection. No duplicate checks are made. It is the responsibility of the caller to ensure that all data referenced in 'field' will eventually appear in the constant pool.

param
field new field descriptor [may not be null]
return
new field's offset

public java.lang.Objectclone()

public Field_infoget(int offset)
Returns {@link Field_info} descriptor at a given offset.

param
offset field offset [must be in [0, size()) range; input not checked]
return
Field_info descriptor [never null]
throws
IndexOutOfBoundsException if 'offset' is outside of valid range

public int[]get(ClassDef cls, java.lang.String name)
Returns an array of offsets for fields named 'name' (empty array if no matching fields found). Note: even though Java syntax disallows for a class to have multiple fields with the same name it is possible at the bytecode level (as long as the type descriptors disambiguate).

param
cls class definition providing the constant pool against which to resolve names [may not be null]
param
name field name [null or empty will result in no matches]
return
array of field offsets in no particular order [never null; could be empty]
throws
IllegalArgumentException if 'cls' is null

public Field_infoset(int offset, Field_info field)
Replaces the Field_info descriptor at a given offset. No duplicate checks are made. No field type compatibility checks are made. It is the responsibility of the caller to ensure that all data referenced in 'field' will eventually appear in the constant pool.

param
offset field offset [must be in [0, size()) range; input not checked]
param
field new field descriptor [may not be null]
return
previous field descriptor at this offset [never null]
throws
IndexOutOfBoundsException if 'offset' is outside of valid range

public intsize()
Returns the number of fields in this collection [can be 0].