My problem is equivalent to implementing toString mehtod of a class. The output should be like: fieldVariable1= val1 | fieldVariable2= val2 |... etc. I could introduce the toString method but am unable to read the field variables and print them. Below is the approach i used.
public aspect INAspect { // INTRODUCTION public String SomeInterface.toString(byte[] bytes) { String s=""; // s = 'field1='+ this.field1 + 'field2=' + this.field2 | ... etc
return s; }
package com.comp.attributes; public class UserAttributes {
private String field1 = "abc"; private int field2 = 100; ... getters and setters...
//here toString() should be introduced that is like // "field1="+ this.field1+ "field2="+ this.field2 etc.
}
------
when i decompile the code of user attibutes it is showing hte toString implemented. except for reflections (which is not prefered to be used) i want to know if there is a way to get this achieved. I tried with AJType; but no luck.