Works fine for me: $ java -cp clojure.jar:twitter4j-core-2.1.2.jar clojure.main Clojure 1.2.0-master-SNAPSHOT user=> (import 'twitter4j.TwitterStreamFactory) twitter4j.TwitterStreamFactory user=> (.getInstance (TwitterStreamFactory.) "foo" "bar") [Sun May 16 17:09:37 PDT 2010]Using class twitter4j.internal.logging.StdOutLoggerFactory as logging factory. #<TwitterStream TwitterBase{auth=BasicAuthorization{userId='foo', password='**********''}}>
On May 16, 1: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