How do I call Foo.class?

2010-04-09 Thread dknesek
How do I invoke Foo.class in Clojure?

Specifically, I'm trying to convert this (working) Java to Clojure.

service.getEntry(new URL(entryUrl), PortfolioEntry.class);

When I do this:

(def entry-url-str (str base-url portfolio-feed-url-suffix "/" id))  ;
this works
(def entry-url (new URL entry-url-str)) ; this works too
(doto service
...
(. getEnrty entry-url (class PortfolioEntry)))

I get this:

actual: java.lang.IllegalArgumentException: No matching method found:
getEnrty for class com.google.gdata.client.finance.FinanceService

Is seems like "(class PortfolioEntry)" doesn't resolve to the same
type as "PortfolioEntry.class".

Any ideas?

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe, reply using "remove me" as the subject.


Re: How do I call Foo.class?

2010-04-09 Thread Stuart Halloway

Clojure doesn't make you say "class" to talk about a class:

String
=> class java.lang.String

Saying "class" takes the class of a thing, even when that thing is a  
class:


(class String)
=> java.lang.Class

Stu


How do I invoke Foo.class in Clojure?

Specifically, I'm trying to convert this (working) Java to Clojure.

service.getEntry(new URL(entryUrl), PortfolioEntry.class);

When I do this:

(def entry-url-str (str base-url portfolio-feed-url-suffix "/" id))  ;
this works
(def entry-url (new URL entry-url-str)) ; this works too
(doto service
   ...
   (. getEnrty entry-url (class PortfolioEntry)))

I get this:

actual: java.lang.IllegalArgumentException: No matching method found:
getEnrty for class com.google.gdata.client.finance.FinanceService

Is seems like "(class PortfolioEntry)" doesn't resolve to the same
type as "PortfolioEntry.class".

Any ideas?

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient  
with your first post.

To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe, reply using "remove me" as the subject.


--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: How do I call Foo.class?

2010-04-09 Thread dknesek
So to be clear - I should be able to use:

(. getEnrty entry-url PortfolioEntry)

Right?

P.S.  Great Clojure book.

On Apr 9, 1:43 pm, Stuart Halloway  wrote:
> Clojure doesn't make you say "class" to talk about a class:
>
> String
> => class java.lang.String
>
> Saying "class" takes the class of a thing, even when that thing is a  
> class:
>
> (class String)
> => java.lang.Class
>
> Stu
>
>
>
> > How do I invoke Foo.class in Clojure?
>
> > Specifically, I'm trying to convert this (working) Java to Clojure.
>
> > service.getEntry(new URL(entryUrl), PortfolioEntry.class);
>
> > When I do this:
>
> > (def entry-url-str (str base-url portfolio-feed-url-suffix "/" id))  ;
> > this works
> > (def entry-url (new URL entry-url-str)) ; this works too
> > (doto service
> >    ...
> >    (. getEnrty entry-url (class PortfolioEntry)))
>
> > I get this:
>
> > actual: java.lang.IllegalArgumentException: No matching method found:
> > getEnrty for class com.google.gdata.client.finance.FinanceService
>
> > Is seems like "(class PortfolioEntry)" doesn't resolve to the same
> > type as "PortfolioEntry.class".
>
> > Any ideas?
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Clojure" group.
> > To post to this group, send email to clojure@googlegroups.com
> > Note that posts from new members are moderated - please be patient  
> > with your first post.
> > To unsubscribe from this group, send email to
> > clojure+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/clojure?hl=en
>
> > To unsubscribe, reply using "remove me" as the subject.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: How do I call Foo.class?

2010-04-10 Thread Mike Mazur
Hi,

On Sat, Apr 10, 2010 at 04:31, dknesek  wrote:
> So to be clear - I should be able to use:
>
> (. getEnrty entry-url PortfolioEntry)

Is that typo in your code? s/getEnrty/getEntry/

Mike

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe, reply using "remove me" as the subject.


Re: How do I call Foo.class?

2010-04-11 Thread Lars Nilsson
On Fri, Apr 9, 2010 at 11:31 AM, dknesek  wrote:
> How do I invoke Foo.class in Clojure?
>
> Specifically, I'm trying to convert this (working) Java to Clojure.
>
> service.getEntry(new URL(entryUrl), PortfolioEntry.class);
>
> When I do this:
>
> (def entry-url-str (str base-url portfolio-feed-url-suffix "/" id))  ;
> this works
> (def entry-url (new URL entry-url-str)) ; this works too
> (doto service
>    ...
>    (. getEnrty entry-url (class PortfolioEntry)))
>
> I get this:
>
> actual: java.lang.IllegalArgumentException: No matching method found:
> getEnrty for class com.google.gdata.client.finance.FinanceService
>
> Is seems like "(class PortfolioEntry)" doesn't resolve to the same
> type as "PortfolioEntry.class".
>
> Any ideas?

Is getEnrty copy'n'pasted, or just mistyped in the email twice (in
code snippet and error message)?

Lars Nilsson

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe, reply using "remove me" as the subject.


Re: How do I call Foo.class?

2010-04-11 Thread Nurullah Akkaya

For analytics code which expects a call in Java like the following,

AccountFeed accountFeed = 
  analyticsService.getFeed(queryUrl, AccountFeed.class);

I had to do this,

(defn get-class [class]
  (Class/forName (str "com.google.gdata.data.analytics." class)))

Class/forName will return a java.lang.Class then you can pass it to the
function,

(.getFeed service url (get-class "AccountFeed"))

Hope it helps...
-- 
Nurullah Akkaya
http://nakkaya.com

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe, reply using "remove me" as the subject.