Reputation: 1199
I've pasted the classes relevant to my question below. vis2
is an instantiated version of the Connect2
class. When debugging, if I'm in the Connect
class, and then jump into the vis2.setURL(String url)
method, this
is listed in the Variables
view. The value for this
is listed as Connect2 (id=22)
.
Is it possible to have Eclipse show WHICH instance of Connect2
this
is describing (in this case vis2
)? Thanks in advance.
Main.java
public class Main {
public static main(String[] args) {
Connect connect = new Connect();
connect.findLocid();
}
}
Connect.java
public class Connect {
public void findLocid(){
Connect2 vis2 = new Connect2();
vis2.setURL("Https://www.someurl.com");
vis2.execute();
}
}
Connect2.java
public class Connect2 {
private String url;
public Connect3 me;
public void execute() {
me = new Connect3(this.url);
me.connect();
}
public void setURL(String url) {
this.url = url;
}
}
Upvotes: 0
Views: 940
Reputation: 4463
One way you could fix this problem is to add a name
variable to each of your classes. For example, Connect2
could be modified as such:
public class Connect2 {
private String url;
public String name;
public Connect3 me;
public Connect2(String name) {// and the rest of your arguments
this.name = name;
}
public void execute() {
me = new Connect3(this.url);
me.connect();
}
public void setURL(String url) {
this.url = url;
}
}
Then you can simply use the name as follows.
Connect2 <variable name> = new Connect2(<variable name>);//+ the rest of your arguments
Then you can easily find the value of the name variable.
Upvotes: 1