Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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

 
Village Idiot
Posts: 484
jQuery Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author
Posts: 23919
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 484
jQuery Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 23919
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 484
jQuery Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
combined in reply
 
Matt Kohanek
Village Idiot
Posts: 484
jQuery Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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;
 
I didn't like the taste of tongue and it didn't like the taste of me. I will now try this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic