Skip to content

Commit

Permalink
Only capitalize the first letter of acronym per Google's style rules
Browse files Browse the repository at this point in the history
  • Loading branch information
ob-stripe committed Jul 28, 2018
1 parent bbae59e commit 19d4d5a
Show file tree
Hide file tree
Showing 193 changed files with 1,860 additions and 1,896 deletions.
47 changes: 30 additions & 17 deletions config/checkstyle/checkstyle.xml
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://checkstyle.sourceforge.net/dtds/configuration_1_3.dtd">
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">

<!--
Checkstyle configuration that checks the Google coding conventions from Google Java Style
Expand Down Expand Up @@ -31,8 +31,10 @@
<module name="OuterTypeFilename"/>
<module name="IllegalTokenText">
<property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/>
<property name="format" value="\\u00(09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/>
<property name="message" value="Consider using special escape sequence instead of octal value or Unicode escaped value."/>
<property name="format"
value="\\u00(09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/>
<property name="message"
value="Consider using special escape sequence instead of octal value or Unicode escaped value."/>
</module>
<module name="AvoidEscapedUnicodeCharacters">
<property name="allowEscapesForControlCharacters" value="true"/>
Expand All @@ -48,18 +50,23 @@
<module name="NoLineWrap"/>
<module name="EmptyBlock">
<property name="option" value="TEXT"/>
<property name="tokens" value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
<property name="tokens"
value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
</module>
<module name="NeedBraces"/>
<module name="LeftCurly"/>
<module name="RightCurly">
<property name="id" value="RightCurlySame"/>
<property name="tokens" value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_DO"/>
<property name="tokens"
value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE,
LITERAL_DO"/>
</module>
<module name="RightCurly">
<property name="id" value="RightCurlyAlone"/>
<property name="option" value="alone"/>
<property name="tokens" value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT, INSTANCE_INIT"/>
<property name="tokens"
value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT,
INSTANCE_INIT"/>
</module>
<module name="WhitespaceAround">
<property name="allowEmptyConstructors" value="true"/>
Expand All @@ -68,7 +75,7 @@
<property name="allowEmptyLoops" value="true"/>
<message key="ws.notFollowed"
value="WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks may only be represented as '{}' when not part of a multi-block statement (4.1.3)"/>
<message key="ws.notPreceded"
<message key="ws.notPreceded"
value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/>
</module>
<module name="OneStatementPerLine"/>
Expand Down Expand Up @@ -157,11 +164,11 @@
<module name="GenericWhitespace">
<message key="ws.followed"
value="GenericWhitespace ''{0}'' is followed by whitespace."/>
<message key="ws.preceded"
<message key="ws.preceded"
value="GenericWhitespace ''{0}'' is preceded with whitespace."/>
<message key="ws.illegalFollow"
<message key="ws.illegalFollow"
value="GenericWhitespace ''{0}'' should followed by whitespace."/>
<message key="ws.notPreceded"
<message key="ws.notPreceded"
value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
</module>
<module name="Indentation">
Expand All @@ -174,7 +181,7 @@
</module>
<module name="AbbreviationAsWordInName">
<property name="ignoreFinal" value="false"/>
<property name="allowedAbbreviationLength" value="4"/>
<property name="allowedAbbreviationLength" value="1"/>
</module>
<module name="OverloadMethodsDeclarationOrder"/>
<module name="VariableDeclarationUsageDistance"/>
Expand All @@ -185,17 +192,21 @@
</module>
<module name="MethodParamPad"/>
<module name="NoWhitespaceBefore">
<property name="tokens" value="COMMA, SEMI, POST_INC, POST_DEC, DOT, ELLIPSIS, METHOD_REF"/>
<property name="tokens"
value="COMMA, SEMI, POST_INC, POST_DEC, DOT, ELLIPSIS, METHOD_REF"/>
<property name="allowLineBreaks" value="true"/>
</module>
<module name="ParenPad"/>
<module name="OperatorWrap">
<property name="option" value="NL"/>
<property name="tokens" value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR, LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR, METHOD_REF "/>
<property name="tokens"
value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR,
LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR, METHOD_REF "/>
</module>
<module name="AnnotationLocation">
<property name="id" value="AnnotationLocationMostCases"/>
<property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/>
<property name="tokens"
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/>
</module>
<module name="AnnotationLocation">
<property name="id" value="AnnotationLocationVariables"/>
Expand All @@ -205,12 +216,14 @@
<module name="NonEmptyAtclauseDescription"/>
<module name="JavadocTagContinuationIndentation"/>
<module name="SummaryJavadoc">
<property name="forbiddenSummaryFragments" value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/>
<property name="forbiddenSummaryFragments"
value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/>
</module>
<module name="JavadocParagraph"/>
<module name="AtclauseOrder">
<property name="tagOrder" value="@param, @return, @throws, @deprecated"/>
<property name="target" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
<property name="target"
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
</module>
<module name="JavadocMethod">
<property name="scope" value="public"/>
Expand Down
13 changes: 0 additions & 13 deletions src/main/java/com/stripe/exception/APIConnectionException.java

This file was deleted.

13 changes: 13 additions & 0 deletions src/main/java/com/stripe/exception/ApiConnectionException.java
@@ -0,0 +1,13 @@
package com.stripe.exception;

public class ApiConnectionException extends StripeException {
private static final long serialVersionUID = 2L;

public ApiConnectionException(String message) {
this(message, null);
}

public ApiConnectionException(String message, Throwable e) {
super(message, null, null, 0, e);
}
}
@@ -1,6 +1,6 @@
package com.stripe.exception;

public class APIException extends StripeException {
public class ApiException extends StripeException {
private static final long serialVersionUID = 2L;

/**
Expand All @@ -10,11 +10,11 @@ public class APIException extends StripeException {
*/
@Deprecated
// TODO: remove this constructor in next major version bump
public APIException(String message, String requestId, Integer statusCode, Throwable e) {
public ApiException(String message, String requestId, Integer statusCode, Throwable e) {
this(message, requestId, null, statusCode, e);
}

public APIException(String message, String requestId, String code, Integer statusCode,
public ApiException(String message, String requestId, String code, Integer statusCode,
Throwable e) {
super(message, requestId, code, statusCode, e);
}
Expand Down
66 changes: 31 additions & 35 deletions src/main/java/com/stripe/model/Account.java
@@ -1,13 +1,11 @@
package com.stripe.model;

import com.google.gson.annotations.SerializedName;

import com.stripe.exception.APIConnectionException;
import com.stripe.exception.APIException;
import com.stripe.exception.ApiConnectionException;
import com.stripe.exception.ApiException;
import com.stripe.exception.AuthenticationException;
import com.stripe.exception.CardException;
import com.stripe.exception.InvalidRequestException;
import com.stripe.net.APIResource;
import com.stripe.net.ApiResource;
import com.stripe.net.RequestOptions;

import java.util.List;
Expand All @@ -20,14 +18,13 @@
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public class Account extends APIResource implements HasId, MetadataStore<Account> {
public class Account extends ApiResource implements HasId, MetadataStore<Account> {
@Getter(onMethod = @__({@Override})) String id;
String object;
String businessLogo;
String businessName;
String businessPrimaryColor;
@SerializedName("business_url")
String businessURL;
String businessUrl;
Boolean chargesEnabled;
String country;
Boolean debitNegativeBalances;
Expand All @@ -47,8 +44,7 @@ public class Account extends APIResource implements HasId, MetadataStore<Account
String statementDescriptor;
String supportEmail;
String supportPhone;
@SerializedName("support_url")
String supportURL;
String supportUrl;
String timezone;
AccountTosAcceptance tosAcceptance;
AccountTransferSchedule transferSchedule;
Expand Down Expand Up @@ -81,7 +77,7 @@ public class Account extends APIResource implements HasId, MetadataStore<Account
*/
public static Account create(Map<String, Object> params)
throws AuthenticationException, InvalidRequestException,
APIConnectionException, CardException, APIException {
ApiConnectionException, CardException, ApiException {
return create(params, null);
}

Expand All @@ -90,8 +86,8 @@ public static Account create(Map<String, Object> params)
*/
public static Account create(Map<String, Object> params, RequestOptions options)
throws AuthenticationException, InvalidRequestException,
APIConnectionException, CardException, APIException {
return request(RequestMethod.POST, classURL(Account.class), params, Account.class, options);
ApiConnectionException, CardException, ApiException {
return request(RequestMethod.POST, classUrl(Account.class), params, Account.class, options);
}
// </editor-fold>

Expand All @@ -101,7 +97,7 @@ public static Account create(Map<String, Object> params, RequestOptions options)
*/
public DeletedAccount delete()
throws AuthenticationException, InvalidRequestException,
APIConnectionException, CardException, APIException {
ApiConnectionException, CardException, ApiException {
return delete(null, (RequestOptions) null);
}

Expand All @@ -110,7 +106,7 @@ public DeletedAccount delete()
*/
public DeletedAccount delete(RequestOptions options)
throws AuthenticationException, InvalidRequestException,
APIConnectionException, CardException, APIException {
ApiConnectionException, CardException, ApiException {
return delete(null, options);
}

Expand All @@ -119,7 +115,7 @@ public DeletedAccount delete(RequestOptions options)
*/
public DeletedAccount delete(Map<String, Object> params)
throws AuthenticationException, InvalidRequestException,
APIConnectionException, CardException, APIException {
ApiConnectionException, CardException, ApiException {
return delete(params, null);
}

Expand All @@ -128,8 +124,8 @@ public DeletedAccount delete(Map<String, Object> params)
*/
public DeletedAccount delete(Map<String, Object> params, RequestOptions options)
throws AuthenticationException, InvalidRequestException,
APIConnectionException, CardException, APIException {
return request(RequestMethod.DELETE, instanceURL(Account.class, this.id), params,
ApiConnectionException, CardException, ApiException {
return request(RequestMethod.DELETE, instanceUrl(Account.class, this.id), params,
DeletedAccount.class, options);
}
// </editor-fold>
Expand All @@ -140,7 +136,7 @@ public DeletedAccount delete(Map<String, Object> params, RequestOptions options)
*/
public static AccountCollection list(Map<String, Object> params)
throws AuthenticationException, InvalidRequestException,
APIConnectionException, CardException, APIException {
ApiConnectionException, CardException, ApiException {
return list(params, null);
}

Expand All @@ -149,8 +145,8 @@ public static AccountCollection list(Map<String, Object> params)
*/
public static AccountCollection list(Map<String, Object> params, RequestOptions options)
throws AuthenticationException, InvalidRequestException,
APIConnectionException, CardException, APIException {
return requestCollection(classURL(Account.class), params, AccountCollection.class, options);
ApiConnectionException, CardException, ApiException {
return requestCollection(classUrl(Account.class), params, AccountCollection.class, options);
}
// </editor-fold>

Expand All @@ -160,7 +156,7 @@ public static AccountCollection list(Map<String, Object> params, RequestOptions
*/
public Account reject(Map<String, Object> params)
throws AuthenticationException, InvalidRequestException,
APIConnectionException, CardException, APIException {
ApiConnectionException, CardException, ApiException {
return reject(params, null);
}

Expand All @@ -169,9 +165,9 @@ public Account reject(Map<String, Object> params)
*/
public Account reject(Map<String, Object> params, RequestOptions options)
throws AuthenticationException, InvalidRequestException,
APIConnectionException, CardException, APIException {
ApiConnectionException, CardException, ApiException {
return request(RequestMethod.POST, String.format("%s/reject",
instanceURL(Account.class, this.getId())), params, Account.class, options);
instanceUrl(Account.class, this.getId())), params, Account.class, options);
}
// </editor-fold>

Expand All @@ -181,7 +177,7 @@ public Account reject(Map<String, Object> params, RequestOptions options)
*/
public static Account retrieve()
throws AuthenticationException, InvalidRequestException,
APIConnectionException, CardException, APIException {
ApiConnectionException, CardException, ApiException {
return retrieve((RequestOptions) null);
}

Expand All @@ -190,8 +186,8 @@ public static Account retrieve()
*/
public static Account retrieve(RequestOptions options)
throws AuthenticationException, InvalidRequestException,
APIConnectionException, CardException, APIException {
return request(RequestMethod.GET, singleClassURL(Account.class), null, Account.class, options);
ApiConnectionException, CardException, ApiException {
return request(RequestMethod.GET, singleClassUrl(Account.class), null, Account.class, options);
}

/**
Expand All @@ -206,7 +202,7 @@ public static Account retrieve(RequestOptions options)
@Deprecated
public static Account retrieve(String apiKeyOrAccountId)
throws AuthenticationException, InvalidRequestException,
APIConnectionException, CardException, APIException {
ApiConnectionException, CardException, ApiException {
if (null == apiKeyOrAccountId || apiKeyOrAccountId.startsWith("sk_")) {
return retrieve(RequestOptions.builder().setApiKey(apiKeyOrAccountId).build());
} else {
Expand All @@ -219,17 +215,17 @@ public static Account retrieve(String apiKeyOrAccountId)
*/
public static Account retrieve(String id, RequestOptions options)
throws AuthenticationException, InvalidRequestException,
APIConnectionException, CardException, APIException {
return request(RequestMethod.GET, instanceURL(Account.class, id), null, Account.class, options);
ApiConnectionException, CardException, ApiException {
return request(RequestMethod.GET, instanceUrl(Account.class, id), null, Account.class, options);
}

/**
* Retrieve account details.
*/
public static Account retrieve(String id, Map<String, Object> params, RequestOptions options)
throws AuthenticationException, InvalidRequestException,
APIConnectionException, CardException, APIException {
return request(RequestMethod.GET, instanceURL(Account.class, id), params, Account.class,
ApiConnectionException, CardException, ApiException {
return request(RequestMethod.GET, instanceUrl(Account.class, id), params, Account.class,
options);
}
// </editor-fold>
Expand All @@ -241,7 +237,7 @@ public static Account retrieve(String id, Map<String, Object> params, RequestOpt
@Override
public Account update(Map<String, Object> params)
throws AuthenticationException, InvalidRequestException,
APIConnectionException, CardException, APIException {
ApiConnectionException, CardException, ApiException {
return update(params, null);
}

Expand All @@ -251,8 +247,8 @@ public Account update(Map<String, Object> params)
@Override
public Account update(Map<String, Object> params, RequestOptions options)
throws AuthenticationException, InvalidRequestException,
APIConnectionException, CardException, APIException {
return request(RequestMethod.POST, instanceURL(Account.class, this.id), params, Account.class,
ApiConnectionException, CardException, ApiException {
return request(RequestMethod.POST, instanceUrl(Account.class, this.id), params, Account.class,
options);
}
// </editor-fold>
Expand Down

0 comments on commit 19d4d5a

Please sign in to comment.