package sds.classfile.attributes;

import sds.classfile.Info;

/**
 * This adapter class is for info of class has attribute.
 * @author inagaki
 */
public abstract class AttributeInfo implements Info {
	private int nameIndex;
	private int attrLen;
	private AttributeType type;

	/**
	 * constructor.
	 * @param type attribute type
	 * @param nameIndex constant-pool entry index of attribute name
	 * @param length attribute length
	 */
	public AttributeInfo(AttributeType type, int nameIndex, int length) {
		this.type = type;
		this.nameIndex = nameIndex;
		this.attrLen = length;
	}

	/**
	 * returns constant-pool entry index of attribute name.
	 * @return constant-pool entry index of attribute name
	 */
	public int getNameIndex() {
		return nameIndex;
	}

	/**
	 * returns attribute length.
	 * @return length
	 */
	public int getAttrLen() {
		return attrLen;
	}

	/**
	 * returns attribute type.
	 * @return type
	 */
	public AttributeType getType() {
		return type;
	}
}
@@ -54,16 +54,99 @@
 le.Info;
+%0Aimport sds.classfile.ConstantPool;%0Aimport sds.classfile.constantpool.ConstantInfo;
 %0A%0A/**%0A *
@@ -658,24 +658,340 @@
 length;%0A%09%7D%0A%0A
+%09/**%0A%09 * returns extracted content of the attribute from constant-pool.%0A%09 * @param info constant info which the attribute has%0A%09 * @param pool constant-pool%0A%09 * @return extracted content%0A%09 */%0A%09public String extract(ConstantInfo info, ConstantPool pool) %7B%0A%09%09return sds.util.Utf8ValueExtractor.extract(info, pool);%0A%09%7D%0A%0A
 %09/**%0A%09 * ret

add method for extracting content of attribute.