package sds.assemble;

import sds.classfile.ConstantPool;
import sds.classfile.MemberInfo;
import static sds.util.AccessFlags.get;
import static sds.util.Utf8ValueExtractor.extract;

/**
 * This adapter class is for
 * {@link FieldContent <code>FieldContent</code>}
 * and
 * {@link MethodContent <code>MethodContent</code>}.
 * @author inagaki
 */
public abstract class MemberContent extends BaseContent {
	private String accessFlag;
	private String desc;
	private String name;

	MemberContent(MemberInfo info, ConstantPool pool, Type contentType) {
		this.accessFlag = get(info.getAccessFlags(), info.getType());
		this.desc = extract(pool.get(info.getDescriptorIndex()-1), pool);
		this.name = extract(pool.get(info.getNameIndex()-1), pool);
		this.contentType = contentType;
	}

	/**
	 * returns this member's access flag.
	 * @return access flag.
	 */
	public String getAccessFlag() {
		return accessFlag;
	}

	/**
	 * returns this member's descriptor.
	 * @return descriptor
	 */
	public String getDescriptor() {
		return desc;
	}

	/**
	 * returns this member's name.
	 * @return name
	 */
	public String getName() {
		return name;
	}
}

@@ -84,16 +84,17 @@
 erInfo;%0A
+%0A
 import s
@@ -125,16 +125,63 @@
 gs.get;%0A
+import static sds.util.DescriptorParser.parse;%0A
 import s
@@ -670,16 +670,22 @@
 .desc = 
+parse(
 extract(
@@ -720,32 +720,33 @@
 ndex()-1), pool)
+)
 ;%0A%09%09this.name = 
@@ -1190,10 +1190,9 @@
 ame;%0A%09%7D%0A
+
 %7D
-%0A

change to parse descriptor.