String constValue = null;\r
final ConstantValue cv = field.getConstantValue();\r
if (cv != null) {\r
- jcfaField.setConstantValue(jc.getConstantPool().getConstantString(\r
- cv.getConstantValueIndex(), Constants.CONSTANT_String));\r
+ jcfaField.setConstantValue("\""\r
+ + jc.getConstantPool().getConstantString(\r
+ cv.getConstantValueIndex(),\r
+ Constants.CONSTANT_String) + "\"");\r
\r
jcfaField\r
.getComment()\r
.getCommentList()\r
- .add("FIXME other type support is missing. Now only String.");\r
-\r
- jcfaField.setConstantValueType(Constants.CONSTANT_String);\r
+ .add("FIXME other type support is missing. <br />Now only String.");\r
}\r
-\r
- System.out.println(" " + access + field.getType().toString() + " "\r
- + field.getName()\r
- + (constValue == null ? "" : " = \"" + constValue + "\""));\r
}\r
\r
private void analyzeMethods(final JavaClass jc, final JcfaClass jcfaClass)\r
result.append("}");
}
+ /**
+ * Write field.
+ *
+ * @param jcfaField
+ * @param result
+ */
public static void writeToBuffer(final JcfaField jcfaField,
final StringBuffer result) {
writeToBuffer(jcfaField.getComment(), result);
result.append(" " + jcfaField.getAccess() + " " + jcfaField.getType()
+ " " + jcfaField.getName());
+ if (jcfaField.getConstantValue() != null) {
+ result.append(" = ");
+ result.append(jcfaField.getConstantValue());
+ }
result.append(";");
}
protected String constantValue;
- protected short constantValueType;
-
public String getAccess() {
return access;
}
return constantValue;
}
- public short getConstantValueType() {
- return constantValueType;
- }
-
public String getName() {
return name;
}
this.constantValue = constantValue;
}
- public void setConstantValueType(short constantValueType) {
- this.constantValueType = constantValueType;
- }
-
public void setName(String name) {
this.name = name;
}
/* TODO import func. is missing. */
public class TestJavaClass002 {
- /* FIXME other type support is missing. Now only String. */
- public static final java.lang.String TEST_001;
+ /* FIXME other type support is missing. <br />Now only String. */
+ public static final java.lang.String TEST_001 = "Hello jcfa world.";
/* */
protected static java.lang.String test002;
/* */