Skip to content

Commit de3986b

Browse files
author
Karl Rieb
committed
Remove public final from DbxClientV2 and DbxTeamClientV2.
1 parent d37be8f commit de3986b

File tree

12 files changed

+58
-45
lines changed

12 files changed

+58
-45
lines changed

ChangeLog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
- Replace public final references in DbxClientV2 and DbxTeamClientV2 with accessor methods.
12

23
---------------------------------------------
34
2.0-beta-7 (2016-02-24)

examples/account-info/src/com/dropbox/core/examples/account_info/Main.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ public static void main(String[] args)
6262
// Make the /account/info API call.
6363
FullAccount dbxAccountInfo;
6464
try {
65-
dbxAccountInfo = dbxClient.users.getCurrentAccount();
65+
dbxAccountInfo = dbxClient.users()
66+
.getCurrentAccount();
6667
}
6768
catch (DbxException ex) {
6869
System.err.println("Error making API call: " + ex.getMessage());

examples/android/src/main/java/com/dropbox/core/examples/android/DownloadFileTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ protected File doInBackground(FileMetadata... params) {
6666

6767
// Download the file.
6868
try (OutputStream outputStream = new FileOutputStream(file)) {
69-
mDbxClient.files.download(metadata.getPathLower(), metadata.getRev())
69+
mDbxClient.files().download(metadata.getPathLower(), metadata.getRev())
7070
.download(outputStream);
7171
}
7272

examples/android/src/main/java/com/dropbox/core/examples/android/FileThumbnailRequestHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public Result load(Request request, int networkPolicy) throws IOException {
4949

5050
try {
5151
DbxDownloader<FileMetadata> downloader =
52-
mDbxClient.files.getThumbnailBuilder(request.uri.getPath())
52+
mDbxClient.files().getThumbnailBuilder(request.uri.getPath())
5353
.withFormat(ThumbnailFormat.JPEG)
5454
.withSize(ThumbnailSize.W1024H768)
5555
.start();

examples/android/src/main/java/com/dropbox/core/examples/android/GetCurrentAccountTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ protected void onPostExecute(FullAccount account) {
3939
protected FullAccount doInBackground(Void... params) {
4040

4141
try {
42-
return mDbxClient.users.getCurrentAccount();
42+
return mDbxClient.users().getCurrentAccount();
4343

4444
} catch (DbxException e) {
4545
mException = e;

examples/android/src/main/java/com/dropbox/core/examples/android/ListFolderTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ protected void onPostExecute(ListFolderResult result) {
4040
@Override
4141
protected ListFolderResult doInBackground(String... params) {
4242
try {
43-
return mDbxClient.files.listFolder(params[0]);
43+
return mDbxClient.files().listFolder(params[0]);
4444
} catch (DbxException e) {
4545
mException = e;
4646
}

examples/android/src/main/java/com/dropbox/core/examples/android/UploadFileTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ protected FileMetadata doInBackground(String... params) {
5959
String remoteFileName = localFile.getName();
6060

6161
try (InputStream inputStream = new FileInputStream(localFile)) {
62-
return mDbxClient.files.uploadBuilder(remoteFolderPath + "/" + remoteFileName)
62+
return mDbxClient.files().uploadBuilder(remoteFolderPath + "/" + remoteFileName)
6363
.withMode(WriteMode.OVERWRITE)
6464
.uploadAndFinish(inputStream);
6565
} catch (DbxException | IOException e) {

examples/longpoll/src/com/dropbox/core/examples/longpoll/Main.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ public static void longpoll(DbxAuthInfo auth, String path) throws IOException {
5757
System.out.println("Longpolling for changes... press CTRL-C to exit.");
5858
while (true) {
5959
// will block for longpollTimeoutSecs or until a change is made in the folder
60-
ListFolderLongpollResult result = dbxLongpollClient.files.listFolderLongpoll(cursor, longpollTimeoutSecs);
60+
ListFolderLongpollResult result = dbxLongpollClient.files()
61+
.listFolderLongpoll(cursor, longpollTimeoutSecs);
6162

6263
// we have changes, list them
6364
if (result.getChanges()) {
@@ -117,7 +118,8 @@ private static DbxClientV2 createClient(DbxAuthInfo auth, StandardHttpRequestor.
117118
*/
118119
private static String getLatestCursor(DbxClientV2 dbxClient, String path)
119120
throws DbxApiException, DbxException {
120-
ListFolderGetLatestCursorResult result = dbxClient.files.listFolderGetLatestCursorBuilder(path)
121+
ListFolderGetLatestCursorResult result = dbxClient.files()
122+
.listFolderGetLatestCursorBuilder(path)
121123
.withIncludeDeleted(true)
122124
.withIncludeMediaInfo(false)
123125
.withRecursive(true)
@@ -138,7 +140,8 @@ private static String printChanges(DbxClientV2 client, String cursor)
138140
throws DbxApiException, DbxException {
139141

140142
while (true) {
141-
ListFolderResult result = client.files.listFolderContinue(cursor);
143+
ListFolderResult result = client.files()
144+
.listFolderContinue(cursor);
142145
for (Metadata metadata : result.getEntries()) {
143146
String type;
144147
String details;

examples/upload-file/src/com/dropbox/core/examples/upload_file/Main.java

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import com.dropbox.core.json.JsonReader;
88
import com.dropbox.core.v2.DbxClientV2;
99
import com.dropbox.core.v2.DbxPathV2;
10-
import com.dropbox.core.v2.files.DbxFiles;
1110
import com.dropbox.core.v2.files.FileMetadata;
1211
import com.dropbox.core.v2.files.UploadErrorException;
1312
import com.dropbox.core.v2.files.WriteMode;
@@ -25,18 +24,13 @@
2524
* An example command-line application that runs through the web-based OAuth
2625
* flow (using {@link DbxWebAuth}).
2726
*/
28-
public class Main
29-
{
30-
public static void main(String[] args)
31-
throws IOException
32-
{
27+
public class Main {
28+
public static void main(String[] args) throws IOException {
3329
int code = _main(args);
3430
System.exit(code);
3531
}
3632

37-
private static int _main(String[] args)
38-
throws IOException
39-
{
33+
private static int _main(String[] args) throws IOException {
4034
// Only display important log messages.
4135
Logger.getLogger("").setLevel(Level.WARNING);
4236

@@ -69,8 +63,7 @@ private static int _main(String[] args)
6963
DbxAuthInfo authInfo;
7064
try {
7165
authInfo = DbxAuthInfo.Reader.readFromFile(argAuthFile);
72-
}
73-
catch (JsonReader.FileLoadException ex) {
66+
} catch (JsonReader.FileLoadException ex) {
7467
System.err.println("Error loading <auth-file>: " + ex.getMessage());
7568
return 1;
7669
}
@@ -92,23 +85,21 @@ private static int _main(String[] args)
9285
try {
9386
InputStream in = new FileInputStream(localFile);
9487
try {
95-
metadata = dbxClient.files.uploadBuilder(dropboxPath)
88+
metadata = dbxClient.files()
89+
.uploadBuilder(dropboxPath)
9690
.withMode(WriteMode.ADD)
9791
.withClientModified(new Date(localFile.lastModified()))
9892
.uploadAndFinish(in);
9993
} finally {
10094
in.close();
10195
}
102-
}
103-
catch (UploadErrorException ex) {
96+
} catch (UploadErrorException ex) {
10497
System.out.println("Error uploading to Dropbox: " + ex.getMessage());
10598
return 1;
106-
}
107-
catch (DbxException ex) {
99+
} catch (DbxException ex) {
108100
System.out.println("Error uploading to Dropbox: " + ex.getMessage());
109101
return 1;
110-
}
111-
catch (IOException ex) {
102+
} catch (IOException ex) {
112103
System.out.println("Error reading from file \"" + localPath + "\": " + ex.getMessage());
113104
return 1;
114105
}

examples/web-file-browser/src/com/dropbox/core/examples/web_file_browser/DropboxBrowse.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import com.dropbox.core.util.StringUtil;
99
import com.dropbox.core.v2.DbxClientV2;
1010
import com.dropbox.core.v2.DbxPathV2;
11-
import com.dropbox.core.v2.files.DbxFiles;
1211
import com.dropbox.core.v2.files.DeletedMetadata;
1312
import com.dropbox.core.v2.files.FileMetadata;
1413
import com.dropbox.core.v2.files.FolderMetadata;
@@ -77,7 +76,8 @@ private void renderFolder(HttpServletResponse response, User user, DbxClientV2 d
7776
ListFolderResult result;
7877
try {
7978
try {
80-
result = dbxClient.files.listFolder(path);
79+
result = dbxClient.files()
80+
.listFolder(path);
8181
}
8282
catch (ListFolderErrorException ex) {
8383
if (ex.errorValue.isPath()) {
@@ -98,7 +98,8 @@ private void renderFolder(HttpServletResponse response, User user, DbxClientV2 d
9898
if (!result.getHasMore()) break;
9999

100100
try {
101-
result = dbxClient.files.listFolderContinue(result.getCursor());
101+
result = dbxClient.files()
102+
.listFolderContinue(result.getCursor());
102103
}
103104
catch (ListFolderContinueErrorException ex) {
104105
if (ex.errorValue.isPath()) {
@@ -203,7 +204,8 @@ public void doBrowse(HttpServletRequest request, HttpServletResponse response)
203204
}
204205
Metadata metadata;
205206
try {
206-
metadata = dbxClient.files.getMetadata(path);
207+
metadata = dbxClient.files()
208+
.getMetadata(path);
207209
}
208210
catch (GetMetadataErrorException ex) {
209211
if (ex.errorValue.isPath()) {
@@ -271,7 +273,8 @@ public void doUpload(HttpServletRequest request, HttpServletResponse response)
271273
String fullTargetPath = targetFolder + "/" + fileName;
272274
FileMetadata metadata;
273275
try {
274-
metadata = dbxClient.files.upload(fullTargetPath)
276+
metadata = dbxClient.files()
277+
.upload(fullTargetPath)
275278
.uploadAndFinish(filePart.getInputStream());
276279
}
277280
catch (DbxException ex) {

0 commit comments

Comments
 (0)