Skip to content

Commit aa087fa

Browse files
committed
Minor refactoring of examples
- Favor printf over println - Rename Action argument from request to arg
1 parent 424e0b9 commit aa087fa

6 files changed

Lines changed: 227 additions & 225 deletions

File tree

gcloud-java-examples/src/main/java/com/google/cloud/examples/bigquery/BigQueryExample.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public class BigQueryExample {
108108

109109
private abstract static class BigQueryAction<T> {
110110

111-
abstract void run(BigQuery bigquery, T request) throws Exception;
111+
abstract void run(BigQuery bigquery, T arg) throws Exception;
112112

113113
abstract T parse(String... args) throws Exception;
114114

@@ -775,18 +775,18 @@ public static void main(String... args) throws Exception {
775775
return;
776776
}
777777
BigQuery bigquery = optionsBuilder.build().service();
778-
Object request;
778+
Object arg;
779779
try {
780-
request = action.parse(args);
780+
arg = action.parse(args);
781781
} catch (IllegalArgumentException ex) {
782-
System.out.println("Invalid input for action '" + actionName + "'. " + ex.getMessage());
783-
System.out.println("Expected: " + action.params());
782+
System.out.printf("Invalid input for action '%s'. %s%n", actionName, ex.getMessage());
783+
System.out.printf("Expected: %s%n", action.params());
784784
return;
785785
} catch (Exception ex) {
786-
System.out.println("Failed to parse request.");
786+
System.out.println("Failed to parse arguments.");
787787
ex.printStackTrace();
788788
return;
789789
}
790-
action.run(bigquery, request);
790+
action.run(bigquery, arg);
791791
}
792792
}

0 commit comments

Comments
 (0)