"Clojurize" just got added to my custom dictionary :)

You'll want to use the standard . syntax for creating a new object.
You wrote this

(new TwitterStreamFactory)

It's standard to write

(TwitterStreamFactory. )

So your form would look like this:

(.getInstance (TwitterStreamFactory. ) "something" "other")

Sean

On May 16, 4:25 pm, Brian Wolf <brw...@gmail.com> wrote:
> Hi,
>
> I was wondering how to 'clojurize'
>
>   twitterStream = new TwitterStreamFactory().getInstance(args[0],
> args[1]);
>
> from the java code below,which is the  from the open source twitter4j
> java library (http://twitter4j.org/en/index.html)
>
> from the source, .getInstance(args[0], args[1])  is a "protected"
> method of TwitterStreamFactory, :
>
> so I think should be callable on the function (?),
>
> tried this and various permutations
>
> (.getInstance ( new TwitterStreamFactory) "something" "other")
>
> but the error says
>
> "cant call public method on non-public class
> : public java.lang.Object twitter4j.TwitterFactoryBase.getInstance
>
> or  twitterStream can to be instantiated using a public method using
> 'this' like below (if im following the java code right), but I
> understand the java concept of 'this' doesn't exist in clojure
>
> Thanks,
>
> Brian
>
> import twitter4j.Status;
> import twitter4j.StatusDeletionNotice;
> import twitter4j.StatusListener;
> import twitter4j.TwitterException;
> import twitter4j.TwitterStream;
> import twitter4j.TwitterStreamFactory;
>
> /**
>  * <p>This is a code example of Twitter4J Streaming API - sample
> method support.<br>
>  * Usage: java twitter4j.examples.PrintSampleStream
> [<i>TwitterScreenName</i> <i>TwitterPassword</i>]<br>
>  * </p>
>  * @author Yusuke Yamamoto - yusuke at mac.com
>  */
> public final class PrintSampleStream implements StatusListener{
>     /**
>      * Main entry of this application.
>      * @param args String[] TwitterID TwitterPassword
>      */
>     public static void main(String[] args)throws TwitterException {
>         PrintSampleStream printSampleStream = new
> PrintSampleStream(args);
>         printSampleStream.startConsuming();
>     }
>
>     TwitterStream twitterStream;
>
>     PrintSampleStream(String[] args) {
>         try {
>             twitterStream = new
> TwitterStreamFactory(this).getInstance();
>         } catch (IllegalStateException is) {
>             // screen name / password combination is not in
> twitter4j.properties
>             if (args.length < 2) {
>                 System.out.println(
>                         "Usage: java
> twitter4j.examples.PrintSampleStream [ScreenName Password]");
>                 System.exit(-1);
>             }
>             twitterStream = new
> TwitterStreamFactory().getInstance(args[0], args[1]);
>         }
>     }
>
> --
> 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 
> athttp://groups.google.com/group/clojure?hl=en

-- 
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

Reply via email to