• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Trying to figure out why Im getting "cannot be resolved" error

 
Matt Kohanek
Village Idiot
Ranch Hand
Posts: 484
Java jQuery Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a class with the following:



Right now method is underlined and it says method cannot be resolved. So my first question I guess is what class should method be in? Is it going to be in either DeviceCollection or DeviceCOllectionXMLAO, or should it be in the class where I have the method from above. I have a few classes with method (method is an instance of httpclient getmethod btw) in it, bu not sure where it is wanting method to come from in the code above. Im assuming there is only going to be one option with method being where it is in that code.
 
Henry Wong
author
Marshal
Pie
Posts: 21024
78
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The way you are using "method", it can either be a local variable, a static variable, or the name of a class. It can't be resolved because it is none of those (that is in scope).

Henry
 
Matt Kohanek
Village Idiot
Ranch Hand
Posts: 484
Java jQuery Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any idea of how it intended to be used here lol?

my DeviceCollection is just a list<> of devices with setters and getters. readXML is my method to read some xml froma web service. So I would think method would be the name of a class here, because it looks like simplexml is reading the data from the GetMethod (method) as a Stream, and then binding it to the DeviceColelction list.

Trying to think this out by saying it, does it sound like Im on the right track with that? And if it is indeed supposed to be a class, where would that method class be? Would it be just a class I call method, or would it be a class within another class?
And how is my java supposed to know which class of method I am trying to use?
 
Henry Wong
author
Marshal
Pie
Posts: 21024
78
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Matt Kohanek wrote:Any idea of how it intended to be used here lol?


It is *your* program. You are supposed to design your application and then code it. It is silly to just code stuff, and then try to figure out what you originally intended to do.

Henry
 
Matt Kohanek
Village Idiot
Ranch Hand
Posts: 484
Java jQuery Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
combined in reply
 
Matt Kohanek
Village Idiot
Ranch Hand
Posts: 484
Java jQuery Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its a collaboration, actually - I did right the majority of code sure, but not this part...pretty silly I guess...

I mean I have a good idea of what it does. method is an instance of the httpclient getMethod, it is getting the response as a stream, then sent to the access object to parse. Then this value is set to deviceCollection.

Now I have a method called getDevice looking like this:



But I dont think that is what method is referring to here. What method is referring to is what I am trying to figure out. I know it has to be an instance of the getMethod, and I know that somehow it needs to use a url for the argument. So maybe it is this class?

Im gonna keep typing, maybe I can figure this out...

So method will have pre defined classes, such as .getResponseBodyAsStream...
So it is definitely an instance of GetMethod...
Now somehow it has to know that the getResponseBodyAsStream is getting this stream froma web service, that takes the form of xml...

OK, so that means there will have to be an instance of httpclient, and then an instance of GetMethod...
And then the GetMethod needs the url...

So maybe something like this:



That seems correct to me, it satisfies everything I just typed...
Now I cant figure out how to bind the deviceCollection to TreeNode data;
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic