本文整理汇总了Java中twitter4j.conf.Configuration类的典型用法代码示例。如果您正苦于以下问题:Java Configuration类的具体用法?Java Configuration怎么用?Java Configuration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Configuration类属于twitter4j.conf包,在下文中一共展示了Configuration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TwitterAdsImpl
import twitter4j.conf.Configuration; //导入依赖的package包/类
TwitterAdsImpl(Configuration conf, Authorization auth) {
this.twitterAdsClient = new TwitterAdsClient(conf, auth);
this.targetingApi = new TwitterAdsTargetingApiImpl(twitterAdsClient);
this.accountApi = new TwitterAdsAccountApiImpl(twitterAdsClient);
this.lineItemApi = new TwitterAdsLineItemApiImpl(twitterAdsClient);
this.cardsApi = new TwitterAdsCardsApiImpl(twitterAdsClient);
this.fundingInstrumentApi = new TwitterAdsFundingInstrumentApiImpl(twitterAdsClient);
this.promotedApi = new TwitterAdsVideoApiImpl(twitterAdsClient);
this.tailoredAudienceApi = new TwitterAdsAudienceApiImpl(twitterAdsClient);
this.statApi = new TwitterAdsStatApiImpl(twitterAdsClient);
this.webEventApi = new TwitterAdsWebEventApiImpl(twitterAdsClient);
this.campaignApi = new TwitterAdsCampaignApiImpl(twitterAdsClient);
this.promotedTweetApi = new TwitterAdsPromotedTweetApiImpl(twitterAdsClient);
this.biddingApi = new TwitterAdsBiddingApiImpl(twitterAdsClient);
this.adsPreviewApi = new TwitterAdsPreviewApiImpl(twitterAdsClient);
this.callToActionApi = new TwitterCallToActionApiImpl(twitterAdsClient);
this.scheduledTweetApi = new TwitterScheduledTweetsApiImpl(twitterAdsClient);
}
示例2: getConfiguration
import twitter4j.conf.Configuration; //导入依赖的package包/类
/**
* Builds a Twitter4J Configuration using the OAuth params.
*
* @return Configuration
*/
public Configuration getConfiguration() {
checkComplete();
ConfigurationBuilder confBuilder = new ConfigurationBuilder();
confBuilder.setOAuthConsumerKey(consumerKey);
confBuilder.setOAuthConsumerSecret(consumerSecret);
confBuilder.setOAuthAccessToken(accessToken);
confBuilder.setOAuthAccessTokenSecret(accessTokenSecret);
if (getHttpProxyHost() != null) {
confBuilder.setHttpProxyHost(getHttpProxyHost());
}
if (getHttpProxyUser() != null) {
confBuilder.setHttpProxyHost(getHttpProxyUser());
}
if (getHttpProxyPassword() != null) {
confBuilder.setHttpProxyHost(getHttpProxyPassword());
}
if (httpProxyPort != null) {
confBuilder.setHttpProxyPort(httpProxyPort);
}
return confBuilder.build();
}
示例3: createUserList
import twitter4j.conf.Configuration; //导入依赖的package包/类
static ResponseList<User> createUserList(JSONArray list, HttpResponse res, Configuration conf) throws TwitterException {
try {
if (conf.isJSONStoreEnabled()) {
DataObjectFactoryUtil.clearThreadLocalMap();
}
int size = list.length();
ResponseList<User> users = new ResponseListImpl<User>(size, res);
for (int i = 0; i < size; i++) {
JSONObject json = list.getJSONObject(i);
User user = new UserJSONImpl(json);
users.add(user);
if (conf.isJSONStoreEnabled()) {
DataObjectFactoryUtil.registerJSONObject(user, json);
}
}
if (conf.isJSONStoreEnabled()) {
DataObjectFactoryUtil.registerJSONObject(users, list);
}
return users;
} catch (JSONException jsone) {
throw new TwitterException(jsone);
} catch (TwitterException te) {
throw te;
}
}
示例4: createDirectMessageList
import twitter4j.conf.Configuration; //导入依赖的package包/类
static ResponseList<DirectMessage> createDirectMessageList(HttpResponse res, Configuration conf) throws TwitterException {
try {
if (conf.isJSONStoreEnabled()) {
DataObjectFactoryUtil.clearThreadLocalMap();
}
JSONArray list = res.asJSONArray();
int size = list.length();
ResponseList<DirectMessage> directMessages = new ResponseListImpl<DirectMessage>(size, res);
for (int i = 0; i < size; i++) {
JSONObject json = list.getJSONObject(i);
DirectMessage directMessage = new DirectMessageJSONImpl(json);
directMessages.add(directMessage);
if (conf.isJSONStoreEnabled()) {
DataObjectFactoryUtil.registerJSONObject(directMessage, json);
}
}
if (conf.isJSONStoreEnabled()) {
DataObjectFactoryUtil.registerJSONObject(directMessages, list);
}
return directMessages;
} catch (JSONException jsone) {
throw new TwitterException(jsone);
} catch (TwitterException te) {
throw te;
}
}
示例5: createStatusList
import twitter4j.conf.Configuration; //导入依赖的package包/类
public static ResponseList<Status> createStatusList(HttpResponse res, Configuration conf) throws TwitterException {
try {
if (conf.isJSONStoreEnabled()) {
DataObjectFactoryUtil.clearThreadLocalMap();
}
JSONArray list = res.asJSONArray();
int size = list.length();
ResponseList<Status> statuses = new ResponseListImpl<Status>(size, res);
for (int i = 0; i < size; i++) {
JSONObject json = list.getJSONObject(i);
Status status = new StatusJSONImpl(json);
if (conf.isJSONStoreEnabled()) {
DataObjectFactoryUtil.registerJSONObject(status, json);
}
statuses.add(status);
}
if (conf.isJSONStoreEnabled()) {
DataObjectFactoryUtil.registerJSONObject(statuses, list);
}
return statuses;
} catch (JSONException jsone) {
throw new TwitterException(jsone);
}
}
示例6: parseStatuses
import twitter4j.conf.Configuration; //导入依赖的package包/类
public static ResponseList<Status> parseStatuses(Configuration conf, JSONArray list) throws JSONException, TwitterException {
if (conf.isJSONStoreEnabled()) {
DataObjectFactoryUtil.clearThreadLocalMap();
}
int size = list.length();
ResponseList<Status> statuses = new ResponseListImpl<Status>(size, null);
for (int i = 0; i < size; i++) {
JSONObject json = list.getJSONObject(i);
Status status = new StatusJSONImpl(json);
if (conf.isJSONStoreEnabled()) {
DataObjectFactoryUtil.registerJSONObject(status, json);
}
statuses.add(status);
}
if (conf.isJSONStoreEnabled()) {
DataObjectFactoryUtil.registerJSONObject(statuses, list);
}
return statuses;
}
示例7: createUserListList
import twitter4j.conf.Configuration; //导入依赖的package包/类
static ResponseList<UserList> createUserListList(HttpResponse res, Configuration conf) throws TwitterException {
try {
if (conf.isJSONStoreEnabled()) {
DataObjectFactoryUtil.clearThreadLocalMap();
}
JSONArray list = res.asJSONArray();
int size = list.length();
ResponseList<UserList> users = new ResponseListImpl<UserList>(size, res);
for (int i = 0; i < size; i++) {
JSONObject userListJson = list.getJSONObject(i);
UserList userList = new UserListJSONImpl(userListJson);
users.add(userList);
if (conf.isJSONStoreEnabled()) {
DataObjectFactoryUtil.registerJSONObject(userList, userListJson);
}
}
if (conf.isJSONStoreEnabled()) {
DataObjectFactoryUtil.registerJSONObject(users, list);
}
return users;
} catch (JSONException jsone) {
throw new TwitterException(jsone);
} catch (TwitterException te) {
throw te;
}
}
示例8: DispatcherImpl
import twitter4j.conf.Configuration; //导入依赖的package包/类
public DispatcherImpl(final Configuration conf) {
executorService = Executors.newFixedThreadPool(conf.getAsyncNumThreads(),
new ThreadFactory() {
int count = 0;
@Override
public Thread newThread(Runnable r) {
Thread thread = new Thread(r);
thread.setName(String.format("Twitter4J Async Dispatcher[%d]", count++));
thread.setDaemon(conf.isDaemonEnabled());
return thread;
}
}
);
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
executorService.shutdown();
}
});
}
示例9: createSavedSearchList
import twitter4j.conf.Configuration; //导入依赖的package包/类
static ResponseList<SavedSearch> createSavedSearchList(HttpResponse res, Configuration conf) throws TwitterException {
if (conf.isJSONStoreEnabled()) {
TwitterObjectFactory.clearThreadLocalMap();
}
JSONArray json = res.asJSONArray();
ResponseList<SavedSearch> savedSearches;
try {
savedSearches = new ResponseListImpl<SavedSearch>(json.length(), res);
for (int i = 0; i < json.length(); i++) {
JSONObject savedSearchesJSON = json.getJSONObject(i);
SavedSearch savedSearch = new SavedSearchJSONImpl(savedSearchesJSON);
savedSearches.add(savedSearch);
if (conf.isJSONStoreEnabled()) {
TwitterObjectFactory.registerJSONObject(savedSearch, savedSearchesJSON);
}
}
if (conf.isJSONStoreEnabled()) {
TwitterObjectFactory.registerJSONObject(savedSearches, json);
}
return savedSearches;
} catch (JSONException jsone) {
throw new TwitterException(jsone.getMessage() + ":" + res.asString(), jsone);
}
}
示例10: createFriendshipList
import twitter4j.conf.Configuration; //导入依赖的package包/类
static ResponseList<Friendship> createFriendshipList(HttpResponse res, Configuration conf) throws TwitterException {
try {
if (conf.isJSONStoreEnabled()) {
TwitterObjectFactory.clearThreadLocalMap();
}
JSONArray list = res.asJSONArray();
int size = list.length();
ResponseList<Friendship> friendshipList = new ResponseListImpl<Friendship>(size, res);
for (int i = 0; i < size; i++) {
JSONObject json = list.getJSONObject(i);
Friendship friendship = new FriendshipJSONImpl(json);
if (conf.isJSONStoreEnabled()) {
TwitterObjectFactory.registerJSONObject(friendship, json);
}
friendshipList.add(friendship);
}
if (conf.isJSONStoreEnabled()) {
TwitterObjectFactory.registerJSONObject(friendshipList, list);
}
return friendshipList;
} catch (JSONException jsone) {
throw new TwitterException(jsone);
}
}
示例11: createPagableUserList
import twitter4j.conf.Configuration; //导入依赖的package包/类
static PagableResponseList<User> createPagableUserList(HttpResponse res, Configuration conf) throws TwitterException {
try {
if (conf.isJSONStoreEnabled()) {
TwitterObjectFactory.clearThreadLocalMap();
}
JSONObject json = res.asJSONObject();
JSONArray list = json.getJSONArray("users");
int size = list.length();
PagableResponseList<User> users =
new PagableResponseListImpl<User>(size, json, res);
for (int i = 0; i < size; i++) {
JSONObject userJson = list.getJSONObject(i);
User user = new UserJSONImpl(userJson);
if (conf.isJSONStoreEnabled()) {
TwitterObjectFactory.registerJSONObject(user, userJson);
}
users.add(user);
}
if (conf.isJSONStoreEnabled()) {
TwitterObjectFactory.registerJSONObject(users, json);
}
return users;
} catch (JSONException jsone) {
throw new TwitterException(jsone);
}
}
示例12: createUserList
import twitter4j.conf.Configuration; //导入依赖的package包/类
static ResponseList<User> createUserList(JSONArray list, HttpResponse res, Configuration conf) throws TwitterException {
try {
if (conf.isJSONStoreEnabled()) {
TwitterObjectFactory.clearThreadLocalMap();
}
int size = list.length();
ResponseList<User> users =
new ResponseListImpl<User>(size, res);
for (int i = 0; i < size; i++) {
JSONObject json = list.getJSONObject(i);
User user = new UserJSONImpl(json);
users.add(user);
if (conf.isJSONStoreEnabled()) {
TwitterObjectFactory.registerJSONObject(user, json);
}
}
if (conf.isJSONStoreEnabled()) {
TwitterObjectFactory.registerJSONObject(users, list);
}
return users;
} catch (JSONException jsone) {
throw new TwitterException(jsone);
}
}
示例13: createDirectMessageList
import twitter4j.conf.Configuration; //导入依赖的package包/类
static ResponseList<DirectMessage> createDirectMessageList(HttpResponse res, Configuration conf) throws TwitterException {
try {
if (conf.isJSONStoreEnabled()) {
TwitterObjectFactory.clearThreadLocalMap();
}
JSONArray list = res.asJSONArray();
int size = list.length();
ResponseList<DirectMessage> directMessages = new ResponseListImpl<DirectMessage>(size, res);
for (int i = 0; i < size; i++) {
JSONObject json = list.getJSONObject(i);
DirectMessage directMessage = new DirectMessageJSONImpl(json);
directMessages.add(directMessage);
if (conf.isJSONStoreEnabled()) {
TwitterObjectFactory.registerJSONObject(directMessage, json);
}
}
if (conf.isJSONStoreEnabled()) {
TwitterObjectFactory.registerJSONObject(directMessages, list);
}
return directMessages;
} catch (JSONException jsone) {
throw new TwitterException(jsone);
}
}
示例14: QueryResultJSONImpl
import twitter4j.conf.Configuration; //导入依赖的package包/类
QueryResultJSONImpl(HttpResponse res, Configuration conf) throws TwitterException {
super(res);
JSONObject json = res.asJSONObject();
try {
JSONObject searchMetaData = json.getJSONObject("search_metadata");
completedIn = ParseUtil.getDouble("completed_in", searchMetaData);
count = ParseUtil.getInt("count", searchMetaData);
maxId = ParseUtil.getLong("max_id", searchMetaData);
nextResults = searchMetaData.has("next_results") ? searchMetaData.getString("next_results") : null;
query = ParseUtil.getURLDecodedString("query", searchMetaData);
refreshUrl = ParseUtil.getUnescapedString("refresh_url", searchMetaData);
sinceId = ParseUtil.getLong("since_id", searchMetaData);
JSONArray array = json.getJSONArray("statuses");
tweets = new ArrayList<Status>(array.length());
if (conf.isJSONStoreEnabled()) {
TwitterObjectFactory.clearThreadLocalMap();
}
for (int i = 0; i < array.length(); i++) {
JSONObject tweet = array.getJSONObject(i);
tweets.add(new StatusJSONImpl(tweet, conf));
}
} catch (JSONException jsone) {
throw new TwitterException(jsone.getMessage() + ":" + json.toString(), jsone);
}
}
示例15: createPlaceList
import twitter4j.conf.Configuration; //导入依赖的package包/类
static ResponseList<Place> createPlaceList(JSONArray list, HttpResponse res
, Configuration conf) throws TwitterException {
if (conf.isJSONStoreEnabled()) {
TwitterObjectFactory.clearThreadLocalMap();
}
try {
int size = list.length();
ResponseList<Place> places =
new ResponseListImpl<Place>(size, res);
for (int i = 0; i < size; i++) {
JSONObject json = list.getJSONObject(i);
Place place = new PlaceJSONImpl(json);
places.add(place);
if (conf.isJSONStoreEnabled()) {
TwitterObjectFactory.registerJSONObject(place, json);
}
}
if (conf.isJSONStoreEnabled()) {
TwitterObjectFactory.registerJSONObject(places, list);
}
return places;
} catch (JSONException jsone) {
throw new TwitterException(jsone);
}
}