Skip to content

Commit

Permalink
marked configuration fields as transient
Browse files Browse the repository at this point in the history
git-svn-id: http://yusuke.homeip.net/svn/twitter4j/trunk@494 117b7e0d-5933-0410-9d29-ab41bb01d86b
  • Loading branch information
yusuke committed Dec 30, 2009
1 parent 750769c commit 91a4977
Show file tree
Hide file tree
Showing 11 changed files with 135 additions and 77 deletions.
58 changes: 58 additions & 0 deletions src/main/java/twitter4j/RateLimitStatusEvent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
Copyright (c) 2007-2009, Yusuke Yamamoto
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Yusuke Yamamoto nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY Yusuke Yamamoto ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL Yusuke Yamamoto BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package twitter4j;

/**
* A data interface representing Twitter REST API's rate limit status
*
* @author Yusuke Yamamoto - yusuke at mac.com
* @see <a href="http://apiwiki.twitter.com/Rate-limiting">Twitter API Wiki / Rate limiting</a>
*/
public class RateLimitStatusEvent extends java.util.EventObject {

private RateLimitStatus rateLimitStatus;

private boolean isAccountRateLimitStatus;

RateLimitStatusEvent(Object source, RateLimitStatus rateLimitStatus, boolean isAccountRateLimitStatus){
super(source);
this.rateLimitStatus = rateLimitStatus;
this.isAccountRateLimitStatus = isAccountRateLimitStatus;
}

public RateLimitStatus getRateLimitStatus() {
return rateLimitStatus;
}

public boolean isAccountRateLimitStatus() {
return isAccountRateLimitStatus;
}
public boolean isIPRateLimitStatus() {
return !isAccountRateLimitStatus;
}

}
2 changes: 1 addition & 1 deletion src/main/java/twitter4j/StatusStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* @since Twitter4J 2.0.4
*/
public class StatusStream {
private final static boolean DEBUG = Configuration.getInstance().isDebug();
private static final boolean DEBUG = Configuration.getInstance().isDebug();

private boolean streamAlive = true;
private BufferedReader br;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/twitter4j/TwitterFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
* @since Twitter4J 2.1.0
*/
public class TwitterFactory {
private final static Twitter DEFAULT_INSTANCE;
private static final Configuration conf = Configuration.getInstance();
private static final Twitter DEFAULT_INSTANCE;
private transient static final Configuration conf = Configuration.getInstance();

static {
DEFAULT_INSTANCE = new Twitter();
Expand Down
128 changes: 64 additions & 64 deletions src/main/java/twitter4j/TwitterMethod.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,97 +87,97 @@ private Object readResolve() throws ObjectStreamException {
}

/*Search API Methods*/
public final static TwitterMethod SEARCH = getInstance("SEARCH");
public static final TwitterMethod SEARCH = getInstance("SEARCH");

public final static TwitterMethod TRENDS = new TwitterMethod("TRENDS");
public final static TwitterMethod CURRENT_TRENDS = new TwitterMethod("CURRENT_TRENDS");
public final static TwitterMethod DAILY_TRENDS = new TwitterMethod("DAILY_TRENDS");
public final static TwitterMethod WEEKLY_TRENDS = new TwitterMethod("WEEKLY_TRENDS");
public static final TwitterMethod TRENDS = new TwitterMethod("TRENDS");
public static final TwitterMethod CURRENT_TRENDS = new TwitterMethod("CURRENT_TRENDS");
public static final TwitterMethod DAILY_TRENDS = new TwitterMethod("DAILY_TRENDS");
public static final TwitterMethod WEEKLY_TRENDS = new TwitterMethod("WEEKLY_TRENDS");

/*Timeline Methods*/
public final static TwitterMethod PUBLIC_TIMELINE = new TwitterMethod("PUBLIC_TIMELINE");
public final static TwitterMethod HOME_TIMELINE = new TwitterMethod("HOME_TIMELINE");
public final static TwitterMethod FRIENDS_TIMELINE = new TwitterMethod("FRIENDS_TIMELINE");
public final static TwitterMethod USER_TIMELINE = new TwitterMethod("USER_TIMELINE");
public final static TwitterMethod MENTIONS = new TwitterMethod("MENTIONS");
public final static TwitterMethod RETWEETED_BY_ME = new TwitterMethod("RETWEETED_BY_ME");
public final static TwitterMethod RETWEETED_TO_ME = new TwitterMethod("RETWEETED_TO_ME");
public final static TwitterMethod RETWEETS_OF_ME = new TwitterMethod("RETWEETS_OF_ME");
public static final TwitterMethod PUBLIC_TIMELINE = new TwitterMethod("PUBLIC_TIMELINE");
public static final TwitterMethod HOME_TIMELINE = new TwitterMethod("HOME_TIMELINE");
public static final TwitterMethod FRIENDS_TIMELINE = new TwitterMethod("FRIENDS_TIMELINE");
public static final TwitterMethod USER_TIMELINE = new TwitterMethod("USER_TIMELINE");
public static final TwitterMethod MENTIONS = new TwitterMethod("MENTIONS");
public static final TwitterMethod RETWEETED_BY_ME = new TwitterMethod("RETWEETED_BY_ME");
public static final TwitterMethod RETWEETED_TO_ME = new TwitterMethod("RETWEETED_TO_ME");
public static final TwitterMethod RETWEETS_OF_ME = new TwitterMethod("RETWEETS_OF_ME");

/*Status Methods*/
public final static TwitterMethod SHOW_STATUS = new TwitterMethod("SHOW_STATUS");
public final static TwitterMethod UPDATE_STATUS = new TwitterMethod("UPDATE_STATUS");
public final static TwitterMethod DESTROY_STATUS = new TwitterMethod("DESTROY_STATUS");
public final static TwitterMethod RETWEET_STATUS = new TwitterMethod("RETWEET_STATUS");
public final static TwitterMethod RETWEETS = new TwitterMethod("RETWEETS");
public static final TwitterMethod SHOW_STATUS = new TwitterMethod("SHOW_STATUS");
public static final TwitterMethod UPDATE_STATUS = new TwitterMethod("UPDATE_STATUS");
public static final TwitterMethod DESTROY_STATUS = new TwitterMethod("DESTROY_STATUS");
public static final TwitterMethod RETWEET_STATUS = new TwitterMethod("RETWEET_STATUS");
public static final TwitterMethod RETWEETS = new TwitterMethod("RETWEETS");

/*User Methods*/
public final static TwitterMethod SHOW_USER = new TwitterMethod("SHOW_USER");
public final static TwitterMethod FRIENDS_STATUSES = new TwitterMethod("FRIENDS_STAUSES");
public final static TwitterMethod FOLLOWERS_STATUSES = new TwitterMethod("FOLLOWERS_STATUSES");
public static final TwitterMethod SHOW_USER = new TwitterMethod("SHOW_USER");
public static final TwitterMethod FRIENDS_STATUSES = new TwitterMethod("FRIENDS_STAUSES");
public static final TwitterMethod FOLLOWERS_STATUSES = new TwitterMethod("FOLLOWERS_STATUSES");

/*List Methods*/
public final static TwitterMethod CREATE_USER_LIST = new TwitterMethod("CREATE_USER_LIST");
public final static TwitterMethod UPDATE_USER_LIST = new TwitterMethod("UPDATE_USER_LIST");
public final static TwitterMethod USER_LISTS = new TwitterMethod("USER_LISTS");
public final static TwitterMethod SHOW_USER_LIST = new TwitterMethod("SHOW_USER_LIST");
public final static TwitterMethod DELETE_USER_LIST = new TwitterMethod("DELETE_USER_LIST");
public final static TwitterMethod USER_LIST_STATUSES = new TwitterMethod("USER_LIST_STATUSES");
public final static TwitterMethod USER_LIST_MEMBERSHIPS = new TwitterMethod("USER_LIST_MEMBERSHIPS");
public final static TwitterMethod USER_LIST_SUBSCRIPTIONS = new TwitterMethod("USER_LIST_SUBSCRIPTIONS");
public static final TwitterMethod CREATE_USER_LIST = new TwitterMethod("CREATE_USER_LIST");
public static final TwitterMethod UPDATE_USER_LIST = new TwitterMethod("UPDATE_USER_LIST");
public static final TwitterMethod USER_LISTS = new TwitterMethod("USER_LISTS");
public static final TwitterMethod SHOW_USER_LIST = new TwitterMethod("SHOW_USER_LIST");
public static final TwitterMethod DELETE_USER_LIST = new TwitterMethod("DELETE_USER_LIST");
public static final TwitterMethod USER_LIST_STATUSES = new TwitterMethod("USER_LIST_STATUSES");
public static final TwitterMethod USER_LIST_MEMBERSHIPS = new TwitterMethod("USER_LIST_MEMBERSHIPS");
public static final TwitterMethod USER_LIST_SUBSCRIPTIONS = new TwitterMethod("USER_LIST_SUBSCRIPTIONS");

/*List Members Methods*/
public final static TwitterMethod LIST_MEMBERS = new TwitterMethod("LIST_MEMBERS");
public final static TwitterMethod ADD_LIST_MEMBER = new TwitterMethod("ADD_LIST_MEMBERS");
public final static TwitterMethod DELETE_LIST_MEMBER = new TwitterMethod("DELETE_LIST_MEMBERS");
public final static TwitterMethod CHECK_LIST_MEMBERSHIP = new TwitterMethod("CHECK_LIST_MEMBERSHIP");
public static final TwitterMethod LIST_MEMBERS = new TwitterMethod("LIST_MEMBERS");
public static final TwitterMethod ADD_LIST_MEMBER = new TwitterMethod("ADD_LIST_MEMBERS");
public static final TwitterMethod DELETE_LIST_MEMBER = new TwitterMethod("DELETE_LIST_MEMBERS");
public static final TwitterMethod CHECK_LIST_MEMBERSHIP = new TwitterMethod("CHECK_LIST_MEMBERSHIP");

/*List Subscribers Methods*/
public final static TwitterMethod LIST_SUBSCRIBERS = new TwitterMethod("LIST_SUBSCRIBERS");
public final static TwitterMethod SUBSCRIBE_LIST = new TwitterMethod("SUBSCRIBE_LIST");
public final static TwitterMethod UNSUBSCRIBE_LIST = new TwitterMethod("UNSUBSCRIBE_LIST");
public final static TwitterMethod CHECK_LIST_SUBSCRIPTION = new TwitterMethod("CHECK_LIST_SUBSCRIPTION");
public static final TwitterMethod LIST_SUBSCRIBERS = new TwitterMethod("LIST_SUBSCRIBERS");
public static final TwitterMethod SUBSCRIBE_LIST = new TwitterMethod("SUBSCRIBE_LIST");
public static final TwitterMethod UNSUBSCRIBE_LIST = new TwitterMethod("UNSUBSCRIBE_LIST");
public static final TwitterMethod CHECK_LIST_SUBSCRIPTION = new TwitterMethod("CHECK_LIST_SUBSCRIPTION");

/*Direct Message Methods*/
public final static TwitterMethod DIRECT_MESSAGES = new TwitterMethod("DIRECT_MESSAGES");
public final static TwitterMethod SENT_DIRECT_MESSAGES = new TwitterMethod("SENT_DIRECT_MESSAGES");
public final static TwitterMethod SEND_DIRECT_MESSAGE = new TwitterMethod("SEND_DIRECT_MESSAGE");
public final static TwitterMethod DESTROY_DIRECT_MESSAGES = new TwitterMethod("DESTROY_DIRECT_MESSAGES");
public static final TwitterMethod DIRECT_MESSAGES = new TwitterMethod("DIRECT_MESSAGES");
public static final TwitterMethod SENT_DIRECT_MESSAGES = new TwitterMethod("SENT_DIRECT_MESSAGES");
public static final TwitterMethod SEND_DIRECT_MESSAGE = new TwitterMethod("SEND_DIRECT_MESSAGE");
public static final TwitterMethod DESTROY_DIRECT_MESSAGES = new TwitterMethod("DESTROY_DIRECT_MESSAGES");

/*Friendship Methods*/
public final static TwitterMethod CREATE_FRIENDSHIP = new TwitterMethod("CREATE_FRIENDSHIP");
public final static TwitterMethod DESTROY_FRIENDSHIP = new TwitterMethod("DESTROY_FRIENDSHIP");
public final static TwitterMethod EXISTS_FRIENDSHIP = new TwitterMethod("EXISTS_FRIENDSHIP");
public final static TwitterMethod SHOW_FRIENDSHIP = new TwitterMethod("SHOW_FRIENDSHIP");
public static final TwitterMethod CREATE_FRIENDSHIP = new TwitterMethod("CREATE_FRIENDSHIP");
public static final TwitterMethod DESTROY_FRIENDSHIP = new TwitterMethod("DESTROY_FRIENDSHIP");
public static final TwitterMethod EXISTS_FRIENDSHIP = new TwitterMethod("EXISTS_FRIENDSHIP");
public static final TwitterMethod SHOW_FRIENDSHIP = new TwitterMethod("SHOW_FRIENDSHIP");

/*Social Graph Methods*/
public final static TwitterMethod FRIENDS_IDS = new TwitterMethod("FRIENDS_IDS");
public final static TwitterMethod FOLLOWERS_IDS = new TwitterMethod("FOLLOWERS_IDS");
public static final TwitterMethod FRIENDS_IDS = new TwitterMethod("FRIENDS_IDS");
public static final TwitterMethod FOLLOWERS_IDS = new TwitterMethod("FOLLOWERS_IDS");

/*Account Methods*/
//verifyCredentials
public final static TwitterMethod RATE_LIMIT_STATUS = new TwitterMethod("RATE_LIMIT_STATUS");
public final static TwitterMethod UPDATE_DELIVERY_DEVICE = new TwitterMethod("UPDATE_DELIVERY_DEVICE");
public final static TwitterMethod UPDATE_PROFILE_COLORS = new TwitterMethod("UPDATE_PROFILE_COLORS");
public final static TwitterMethod UPDATE_PROFILE_IMAGE = new TwitterMethod("UPDATE_PROFILE_IMAGE");
public final static TwitterMethod UPDATE_PROFILE_BACKGROUND_IMAGE = new TwitterMethod("UPDATE_PROFILE_BACKGROUND_IMAGE");
public final static TwitterMethod UPDATE_PROFILE = new TwitterMethod("UPDATE_PROFILE");
public static final TwitterMethod RATE_LIMIT_STATUS = new TwitterMethod("RATE_LIMIT_STATUS");
public static final TwitterMethod UPDATE_DELIVERY_DEVICE = new TwitterMethod("UPDATE_DELIVERY_DEVICE");
public static final TwitterMethod UPDATE_PROFILE_COLORS = new TwitterMethod("UPDATE_PROFILE_COLORS");
public static final TwitterMethod UPDATE_PROFILE_IMAGE = new TwitterMethod("UPDATE_PROFILE_IMAGE");
public static final TwitterMethod UPDATE_PROFILE_BACKGROUND_IMAGE = new TwitterMethod("UPDATE_PROFILE_BACKGROUND_IMAGE");
public static final TwitterMethod UPDATE_PROFILE = new TwitterMethod("UPDATE_PROFILE");

/*Favorite Methods*/
public final static TwitterMethod FAVORITES = new TwitterMethod("FAVORITES");
public final static TwitterMethod CREATE_FAVORITE = new TwitterMethod("CREATE_FAVORITE");
public final static TwitterMethod DESTROY_FAVORITE = new TwitterMethod("DESTROY_FAVORITE");
public static final TwitterMethod FAVORITES = new TwitterMethod("FAVORITES");
public static final TwitterMethod CREATE_FAVORITE = new TwitterMethod("CREATE_FAVORITE");
public static final TwitterMethod DESTROY_FAVORITE = new TwitterMethod("DESTROY_FAVORITE");

/*Notification Methods*/
public final static TwitterMethod ENABLE_NOTIFICATION = new TwitterMethod("ENABLE_NOTIFICATION");
public final static TwitterMethod DISABLE_NOTIFICATION = new TwitterMethod("DISABLE_NOTIFICATION");
public static final TwitterMethod ENABLE_NOTIFICATION = new TwitterMethod("ENABLE_NOTIFICATION");
public static final TwitterMethod DISABLE_NOTIFICATION = new TwitterMethod("DISABLE_NOTIFICATION");

/*Block Methods*/
public final static TwitterMethod CREATE_BLOCK = new TwitterMethod("CREATE_BLOCK");
public final static TwitterMethod DESTROY_BLOCK = new TwitterMethod("DESTROY_BLOCK");
public final static TwitterMethod EXISTS_BLOCK = new TwitterMethod("EXISTS_BLOCK");
public final static TwitterMethod BLOCKING_USERS = new TwitterMethod("BLOCKING_USERS");
public final static TwitterMethod BLOCKING_USERS_IDS = new TwitterMethod("BLOCKING_USERS_IDS");
public static final TwitterMethod CREATE_BLOCK = new TwitterMethod("CREATE_BLOCK");
public static final TwitterMethod DESTROY_BLOCK = new TwitterMethod("DESTROY_BLOCK");
public static final TwitterMethod EXISTS_BLOCK = new TwitterMethod("EXISTS_BLOCK");
public static final TwitterMethod BLOCKING_USERS = new TwitterMethod("BLOCKING_USERS");
public static final TwitterMethod BLOCKING_USERS_IDS = new TwitterMethod("BLOCKING_USERS_IDS");

/*Spam Reporting Methods*/
//reportSpam()
Expand All @@ -191,5 +191,5 @@ private Object readResolve() throws ObjectStreamException {
/*Local Trends Methods*/

/*Help Methods*/
public final static TwitterMethod TEST = new TwitterMethod("TEST");
public static final TwitterMethod TEST = new TwitterMethod("TEST");
}
4 changes: 2 additions & 2 deletions src/main/java/twitter4j/TwitterStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
* @since Twitter4J 2.0.4
*/
public class TwitterStream extends TwitterSupport {
private final static Configuration conf = Configuration.getInstance();
private transient static final Configuration conf = Configuration.getInstance();

private final static boolean DEBUG = conf.isDebug();
private static final boolean DEBUG = conf.isDebug();

private StatusListener statusListener;
private StreamHandlingThread handler = null;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/twitter4j/TwitterSupport.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* @author Yusuke Yamamoto - yusuke at mac.com
*/
class TwitterSupport implements java.io.Serializable {
protected transient final static Configuration conf = Configuration.getInstance();
protected transient static final Configuration conf = Configuration.getInstance();

protected transient static final HttpRequestFactory requestFactory = new HttpRequestFactory(conf);

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/twitter4j/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
* @author Yusuke Yamamoto - yusuke at mac.com
*/
public class Version {
private final static String VERSION = "2.1.0-SNAPSHOT";
private final static String TITLE = "Twitter4J";
private static final String VERSION = "2.1.0-SNAPSHOT";
private static final String TITLE = "Twitter4J";

public static String getVersion(){
return VERSION;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/twitter4j/http/BasicAuthorization.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* @author Yusuke Yamamoto - yusuke at mac.com
*/
public final class BasicAuthorization implements Authorization, java.io.Serializable {
private final static boolean DEBUG = Configuration.getInstance().isDebug();
private transient static final boolean DEBUG = Configuration.getInstance().isDebug();

private String userId;
private String password;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/twitter4j/http/OAuthAuthorization.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@
* @see <a href="http://oauth.net/core/1.0a/">OAuth Core 1.0a</a>
*/
public final class OAuthAuthorization implements Authorization, java.io.Serializable {
private static final Configuration conf = Configuration.getInstance();
private transient static final Configuration conf = Configuration.getInstance();
private static final String HMAC_SHA1 = "HmacSHA1";
private static final PostParameter OAUTH_SIGNATURE_METHOD = new PostParameter("oauth_signature_method", "HMAC-SHA1");
private final static boolean DEBUG = Configuration.getInstance().isDebug();
private transient static final boolean DEBUG = conf.getInstance().isDebug();
static final long serialVersionUID = -4368426677157998618L;
private String consumerKey = "";
private String consumerSecret;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/twitter4j/http/Response.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
* @author Yusuke Yamamoto - yusuke at mac.com
*/
public class Response {
private final static boolean DEBUG = Configuration.getInstance().isDebug();
private static final boolean DEBUG = Configuration.getInstance().isDebug();

private static ThreadLocal<DocumentBuilder> builders =
new ThreadLocal<DocumentBuilder>() {
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/twitter4j/TwitterTestUnit.java
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ public void testAccountProfileImageUpdates() throws Exception {
twitterAPI1.updateProfileBackgroundImage(getRandomlyChosenFile(),
(5 < System.currentTimeMillis() % 5));
}
final static String[] files = {"src/test/resources/t4j-reverse.jpeg",
static final String[] files = {"src/test/resources/t4j-reverse.jpeg",
"src/test/resources/t4j-reverse.png",
"src/test/resources/t4j-reverse.gif",
"src/test/resources/t4j.jpeg",
Expand Down

0 comments on commit 91a4977

Please sign in to comment.