java - How to access the Impl classes of Twitter4J? -
using mongodb, need persist objects twitter4j. twitter4j uses interfaces, implemented in json versions. example:
the api returns status
(an interface), , status
implemented statusjsonimpl
.
i can't save status
mongodb, need implement statusjsonimpl
.
my issue is, class statusjsonimpl
not public (see here) can't use in code. tried download source of twitter4j manually add "public
" statusjsonimpl
: can do:
status status = twitter.updatestatus(lateststatus); string statusstringified = twitterobjectfactory.getrawjson(status); statusjsonimpl statusimplemented = (statusjsonimpl) twitterobjectfactory.createuserlist(statusstringified); singletonlaunchdb.getmongo().save(statusimplemented);
but still java.lang.illegalaccesserror
on class statusjsonimpl
@ run time.
i see other sa answers users routinely point other users impl classes... how use in code?
your appreciated.
status serializable. recover statusjsonimpl
statusstringified
can write.
jsonobject json = new jsonobject(statusstringified); status status = new statusjsonimpl(json);
the code sample statusserializationtest.java
i hope helps.
Comments
Post a Comment