diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index bf87d471e34a..3d93f2d032c7 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -32,6 +32,8 @@ When changes are made to authentication and project ID-related code, authenticat
Known issue: If you have installed the Google Cloud SDK, be sure to log in (using `gcloud auth login`) before running tests. Though the Datastore tests use a local Datastore emulator that doesn't require authentication, they will not run if you have the Google Cloud SDK installed but aren't authenticated.
+**Please, do not use your production projects for executing integration tests.** While we do our best to make our tests independent of your project's state and content, they do perform create, modify and deletes, and you do not want to have your production data accidentally modified.
+
Adding Features
---------------
In order to add a feature to gcloud-java:
diff --git a/README.md b/README.md
index 67fbc4c8e337..68c624c37489 100644
--- a/README.md
+++ b/README.md
@@ -6,6 +6,8 @@ Java idiomatic client for [Google Cloud Platform][cloud-platform] services.
[](https://travis-ci.org/GoogleCloudPlatform/gcloud-java)
[](https://coveralls.io/r/GoogleCloudPlatform/gcloud-java?branch=master)
[]( https://img.shields.io/maven-central/v/com.google.gcloud/gcloud-java.svg)
+[](https://www.codacy.com/app/mziccard/gcloud-java)
+[](https://www.versioneye.com/user/projects/56bd8ee72a29ed002d2b0969)
- [Homepage] (https://googlecloudplatform.github.io/gcloud-java/)
- [API Documentation] (http://googlecloudplatform.github.io/gcloud-java/apidocs)
@@ -27,33 +29,33 @@ If you are using Maven, add this to your pom.xml file
com.google.gcloudgcloud-java
- 0.1.3
+ 0.1.5
```
If you are using Gradle, add this to your dependencies
```Groovy
-compile 'com.google.gcloud:gcloud-java:0.1.3'
+compile 'com.google.gcloud:gcloud-java:0.1.5'
```
If you are using SBT, add this to your dependencies
```Scala
-libraryDependencies += "com.google.gcloud" % "gcloud-java" % "0.1.3"
+libraryDependencies += "com.google.gcloud" % "gcloud-java" % "0.1.5"
```
Example Applications
--------------------
-- [`BigQueryExample`](https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/gcloud-java-examples/src/main/java/com/google/gcloud/examples/BigQueryExample.java) - A simple command line interface providing some of Cloud BigQuery's functionality
- - Read more about using this application on the [`gcloud-java-examples` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/BigQueryExample.html).
+- [`BigQueryExample`](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/bigquery/BigQueryExample.java) - A simple command line interface providing some of Cloud BigQuery's functionality
+ - Read more about using this application on the [`BigQueryExample` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/bigquery/BigQueryExample.html).
- [`Bookshelf`](https://github.com/GoogleCloudPlatform/getting-started-java/tree/master/bookshelf) - An App Engine app that manages a virtual bookshelf.
- This app uses `gcloud-java` to interface with Cloud Datastore and Cloud Storage. It also uses Cloud SQL, another Google Cloud Platform service.
-- [`DatastoreExample`](https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/gcloud-java-examples/src/main/java/com/google/gcloud/examples/DatastoreExample.java) - A simple command line interface for the Cloud Datastore
- - Read more about using this application on the [`gcloud-java-examples` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/DatastoreExample.html).
-- [`ResourceManagerExample`](https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/gcloud-java-examples/src/main/java/com/google/gcloud/examples/ResourceManagerExample.java) - A simple command line interface providing some of Cloud Resource Manager's functionality
- - Read more about using this application on the [`gcloud-java-examples` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/ResourceManagerExample.html).
-- [`SparkDemo`](https://github.com/GoogleCloudPlatform/java-docs-samples/blob/master/managedvms/sparkjava) - An example of using gcloud-java-datastore from within the SparkJava and App Engine Managed VM frameworks.
- - Read about how it works on the example's [README page](https://github.com/GoogleCloudPlatform/java-docs-samples/tree/master/managedvms/sparkjava#how-does-it-work).
-- [`StorageExample`](https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/gcloud-java-examples/src/main/java/com/google/gcloud/examples/StorageExample.java) - A simple command line interface providing some of Cloud Storage's functionality
- - Read more about using this application on the [`gcloud-java-examples` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/StorageExample.html).
+- [`DatastoreExample`](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/datastore/DatastoreExample.java) - A simple command line interface for the Cloud Datastore
+ - Read more about using this application on the [`DatastoreExample` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/datastore/DatastoreExample.html).
+- [`ResourceManagerExample`](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/resourcemanager/ResourceManagerExample.java) - A simple command line interface providing some of Cloud Resource Manager's functionality
+ - Read more about using this application on the [`ResourceManagerExample` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/resourcemanager/ResourceManagerExample.html).
+- [`SparkDemo`](https://github.com/GoogleCloudPlatform/java-docs-samples/blob/master/managed_vms/sparkjava) - An example of using gcloud-java-datastore from within the SparkJava and App Engine Managed VM frameworks.
+ - Read about how it works on the example's [README page](https://github.com/GoogleCloudPlatform/java-docs-samples/tree/master/managed_vms/sparkjava#how-does-it-work).
+- [`StorageExample`](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/storage/StorageExample.java) - A simple command line interface providing some of Cloud Storage's functionality
+ - Read more about using this application on the [`StorageExample` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/storage/StorageExample.html).
Specifying a Project ID
-----------------------
@@ -123,41 +125,39 @@ Google Cloud BigQuery (Alpha)
Here is a code snippet showing a simple usage example from within Compute/App Engine. Note that you
must [supply credentials](#authentication) and a project ID if running this snippet elsewhere.
+Complete source code can be found at
+[CreateTableAndLoadData.java](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/bigquery/snippets/CreateTableAndLoadData.java).
```java
import com.google.gcloud.bigquery.BigQuery;
import com.google.gcloud.bigquery.BigQueryOptions;
import com.google.gcloud.bigquery.Field;
-import com.google.gcloud.bigquery.JobStatus;
-import com.google.gcloud.bigquery.JobInfo;
-import com.google.gcloud.bigquery.LoadJobConfiguration;
+import com.google.gcloud.bigquery.FormatOptions;
+import com.google.gcloud.bigquery.Job;
import com.google.gcloud.bigquery.Schema;
import com.google.gcloud.bigquery.StandardTableDefinition;
+import com.google.gcloud.bigquery.Table;
import com.google.gcloud.bigquery.TableId;
import com.google.gcloud.bigquery.TableInfo;
BigQuery bigquery = BigQueryOptions.defaultInstance().service();
TableId tableId = TableId.of("dataset", "table");
-TableInfo info = bigquery.getTable(tableId);
-if (info == null) {
+Table table = bigquery.getTable(tableId);
+if (table == null) {
System.out.println("Creating table " + tableId);
Field integerField = Field.of("fieldName", Field.Type.integer());
Schema schema = Schema.of(integerField);
- bigquery.create(TableInfo.of(tableId, StandardTableDefinition.of(schema)));
+ table = bigquery.create(TableInfo.of(tableId, StandardTableDefinition.of(schema)));
+}
+System.out.println("Loading data into table " + tableId);
+Job loadJob = table.load(FormatOptions.csv(), "gs://bucket/path");
+while (!loadJob.isDone()) {
+ Thread.sleep(1000L);
+}
+if (loadJob.status().error() != null) {
+ System.out.println("Job completed with errors");
} else {
- System.out.println("Loading data into table " + tableId);
- LoadJobConfiguration configuration = LoadJobConfiguration.of(tableId, "gs://bucket/path");
- JobInfo loadJob = JobInfo.of(configuration);
- loadJob = bigquery.create(loadJob);
- while (loadJob.status().state() != JobStatus.State.DONE) {
- Thread.sleep(1000L);
- loadJob = bigquery.getJob(loadJob.jobId());
- }
- if (loadJob.status().error() != null) {
- System.out.println("Job completed with errors");
- } else {
- System.out.println("Job succeeded");
- }
+ System.out.println("Job succeeded");
}
```
@@ -171,8 +171,32 @@ Google Cloud Datastore
#### Preview
-Here is a code snippet showing a simple usage example from within Compute/App Engine. Note that you must [supply credentials](#authentication) and a project ID if running this snippet elsewhere.
+Here are two code snippets showing simple usage examples from within Compute/App Engine. Note that you must [supply credentials](#authentication) and a project ID if running this snippet elsewhere.
+
+The first snippet shows how to create a Datastore entity. Complete source code can be found at
+[CreateEntity.java](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/datastore/snippets/CreateEntity.java).
+
+```java
+import com.google.gcloud.datastore.Datastore;
+import com.google.gcloud.datastore.DatastoreOptions;
+import com.google.gcloud.datastore.DateTime;
+import com.google.gcloud.datastore.Entity;
+import com.google.gcloud.datastore.Key;
+import com.google.gcloud.datastore.KeyFactory;
+Datastore datastore = DatastoreOptions.defaultInstance().service();
+KeyFactory keyFactory = datastore.newKeyFactory().kind("keyKind");
+Key key = keyFactory.newKey("keyName");
+Entity entity = Entity.builder(key)
+ .set("name", "John Doe")
+ .set("age", 30)
+ .set("access_time", DateTime.now())
+ .build();
+datastore.put(entity);
+```
+The second snippet shows how to update a Datastore entity if it exists. Complete source code can be
+found at
+[UpdateEntity.java](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/datastore/snippets/UpdateEntity.java).
```java
import com.google.gcloud.datastore.Datastore;
import com.google.gcloud.datastore.DatastoreOptions;
@@ -182,17 +206,10 @@ import com.google.gcloud.datastore.Key;
import com.google.gcloud.datastore.KeyFactory;
Datastore datastore = DatastoreOptions.defaultInstance().service();
-KeyFactory keyFactory = datastore.newKeyFactory().kind(KIND);
-Key key = keyFactory.newKey(keyName);
+KeyFactory keyFactory = datastore.newKeyFactory().kind("keyKind");
+Key key = keyFactory.newKey("keyName");
Entity entity = datastore.get(key);
-if (entity == null) {
- entity = Entity.builder(key)
- .set("name", "John Do")
- .set("age", 30)
- .set("access_time", DateTime.now())
- .build();
- datastore.put(entity);
-} else {
+if (entity != null) {
System.out.println("Updating access_time for " + entity.getString("name"));
entity = Entity.builder(entity)
.set("access_time", DateTime.now())
@@ -210,7 +227,8 @@ Google Cloud Resource Manager (Alpha)
#### Preview
Here is a code snippet showing a simple usage example. Note that you must supply Google SDK credentials for this service, not other forms of authentication listed in the [Authentication section](#authentication).
-
+Complete source code can be found at
+[UpdateAndListProjects.java](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/resourcemanager/snippets/UpdateAndListProjects.java).
```java
import com.google.gcloud.resourcemanager.Project;
import com.google.gcloud.resourcemanager.ResourceManager;
@@ -219,14 +237,15 @@ import com.google.gcloud.resourcemanager.ResourceManagerOptions;
import java.util.Iterator;
ResourceManager resourceManager = ResourceManagerOptions.defaultInstance().service();
-Project myProject = resourceManager.get("some-project-id"); // Use an existing project's ID
-Project newProject = myProject.toBuilder()
- .addLabel("launch-status", "in-development")
- .build()
- .replace();
-System.out.println("Updated the labels of project " + newProject.projectId()
- + " to be " + newProject.labels());
-// List all the projects you have permission to view.
+Project project = resourceManager.get("some-project-id"); // Use an existing project's ID
+if (project != null) {
+ Project newProject = project.toBuilder()
+ .addLabel("launch-status", "in-development")
+ .build()
+ .replace();
+ System.out.println("Updated the labels of project " + newProject.projectId()
+ + " to be " + newProject.labels());
+}
Iterator projectIterator = resourceManager.list().iterateAll();
System.out.println("Projects I can view:");
while (projectIterator.hasNext()) {
@@ -244,8 +263,28 @@ Google Cloud Storage
#### Preview
-Here is a code snippet showing a simple usage example from within Compute/App Engine. Note that you must [supply credentials](#authentication) and a project ID if running this snippet elsewhere.
+Here are two code snippets showing simple usage examples from within Compute/App Engine. Note that you must [supply credentials](#authentication) and a project ID if running this snippet elsewhere.
+
+The first snippet shows how to create a Storage blob. Complete source code can be found at
+[CreateBlob.java](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/storage/snippets/CreateBlob.java).
+
+```java
+import static java.nio.charset.StandardCharsets.UTF_8;
+
+import com.google.gcloud.storage.Blob;
+import com.google.gcloud.storage.BlobId;
+import com.google.gcloud.storage.BlobInfo;
+import com.google.gcloud.storage.Storage;
+import com.google.gcloud.storage.StorageOptions;
+Storage storage = StorageOptions.defaultInstance().service();
+BlobId blobId = BlobId.of("bucket", "blob_name");
+BlobInfo blobInfo = BlobInfo.builder(blobId).contentType("text/plain").build();
+Blob blob = storage.create(blobInfo, "Hello, Cloud Storage!".getBytes(UTF_8));
+```
+The second snippet shows how to update a Storage blob if it exists. Complete source code can be
+found at
+[UpdateBlob.java](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/storage/snippets/UpdateBlob.java).
```java
import static java.nio.charset.StandardCharsets.UTF_8;
@@ -259,12 +298,8 @@ import java.nio.channels.WritableByteChannel;
Storage storage = StorageOptions.defaultInstance().service();
BlobId blobId = BlobId.of("bucket", "blob_name");
-Blob blob = Blob.get(storage, blobId);
-if (blob == null) {
- BlobInfo blobInfo = BlobInfo.builder(blobId).contentType("text/plain").build();
- storage.create(blobInfo, "Hello, Cloud Storage!".getBytes(UTF_8));
-} else {
- System.out.println("Updating content for " + blobId.name());
+Blob blob = storage.get(blobId);
+if (blob != null) {
byte[] prevContent = blob.content();
System.out.println(new String(prevContent, UTF_8));
WritableByteChannel channel = blob.writer();
diff --git a/codacy-conf.json b/codacy-conf.json
new file mode 100644
index 000000000000..e8c819684c9c
--- /dev/null
+++ b/codacy-conf.json
@@ -0,0 +1 @@
+{"patterns":[{"patternId":"Custom_Javascript_Scopes","enabled":true},{"patternId":"Custom_Javascript_EvalWith","enabled":true},{"patternId":"Custom_Javascript_TryCatch","enabled":true},{"patternId":"Custom_Scala_NonFatal","enabled":true},{"patternId":"bitwise","enabled":true},{"patternId":"maxparams","enabled":true},{"patternId":"CSSLint_universal_selector","enabled":true},{"patternId":"CSSLint_unqualified_attributes","enabled":true},{"patternId":"CSSLint_zero_units","enabled":true},{"patternId":"CSSLint_overqualified_elements","enabled":true},{"patternId":"CSSLint_shorthand","enabled":true},{"patternId":"CSSLint_duplicate_background_images","enabled":true},{"patternId":"CSSLint_box_model","enabled":true},{"patternId":"CSSLint_compatible_vendor_prefixes","enabled":true},{"patternId":"CSSLint_display_property_grouping","enabled":true},{"patternId":"CSSLint_duplicate_properties","enabled":true},{"patternId":"CSSLint_empty_rules","enabled":true},{"patternId":"CSSLint_errors","enabled":true},{"patternId":"CSSLint_gradients","enabled":true},{"patternId":"CSSLint_important","enabled":true},{"patternId":"CSSLint_known_properties","enabled":true},{"patternId":"CSSLint_text_indent","enabled":true},{"patternId":"CSSLint_unique_headings","enabled":true},{"patternId":"PyLint_E0100","enabled":true},{"patternId":"PyLint_E0101","enabled":true},{"patternId":"PyLint_E0102","enabled":true},{"patternId":"PyLint_E0103","enabled":true},{"patternId":"PyLint_E0104","enabled":true},{"patternId":"PyLint_E0105","enabled":true},{"patternId":"PyLint_E0106","enabled":true},{"patternId":"PyLint_E0107","enabled":true},{"patternId":"PyLint_E0108","enabled":true},{"patternId":"PyLint_E0202","enabled":true},{"patternId":"PyLint_E0203","enabled":true},{"patternId":"PyLint_E0211","enabled":true},{"patternId":"PyLint_E0601","enabled":true},{"patternId":"PyLint_E0603","enabled":true},{"patternId":"PyLint_E0604","enabled":true},{"patternId":"PyLint_E0701","enabled":true},{"patternId":"PyLint_E0702","enabled":true},{"patternId":"PyLint_E0710","enabled":true},{"patternId":"PyLint_E0711","enabled":true},{"patternId":"PyLint_E0712","enabled":true},{"patternId":"PyLint_E1003","enabled":true},{"patternId":"PyLint_E1102","enabled":true},{"patternId":"PyLint_E1111","enabled":true},{"patternId":"PyLint_E1120","enabled":true},{"patternId":"PyLint_E1121","enabled":true},{"patternId":"PyLint_E1123","enabled":true},{"patternId":"PyLint_E1124","enabled":true},{"patternId":"PyLint_E1200","enabled":true},{"patternId":"PyLint_E1201","enabled":true},{"patternId":"PyLint_E1205","enabled":true},{"patternId":"PyLint_E1206","enabled":true},{"patternId":"PyLint_E1300","enabled":true},{"patternId":"PyLint_E1301","enabled":true},{"patternId":"PyLint_E1302","enabled":true},{"patternId":"PyLint_E1303","enabled":true},{"patternId":"PyLint_E1304","enabled":true},{"patternId":"PyLint_E1305","enabled":true},{"patternId":"PyLint_E1306","enabled":true},{"patternId":"rulesets-codesize.xml-CyclomaticComplexity","enabled":true},{"patternId":"rulesets-codesize.xml-NPathComplexity","enabled":true},{"patternId":"rulesets-codesize.xml-ExcessiveMethodLength","enabled":true},{"patternId":"rulesets-codesize.xml-ExcessiveClassLength","enabled":true},{"patternId":"rulesets-codesize.xml-ExcessiveParameterList","enabled":true},{"patternId":"rulesets-codesize.xml-ExcessivePublicCount","enabled":true},{"patternId":"rulesets-codesize.xml-TooManyFields","enabled":true},{"patternId":"rulesets-codesize.xml-TooManyMethods","enabled":true},{"patternId":"rulesets-codesize.xml-ExcessiveClassComplexity","enabled":true},{"patternId":"rulesets-controversial.xml-Superglobals","enabled":true},{"patternId":"rulesets-design.xml-ExitExpression","enabled":true},{"patternId":"rulesets-design.xml-EvalExpression","enabled":true},{"patternId":"rulesets-design.xml-GotoStatement","enabled":true},{"patternId":"rulesets-design.xml-NumberOfChildren","enabled":true},{"patternId":"rulesets-design.xml-DepthOfInheritance","enabled":true},{"patternId":"rulesets-unusedcode.xml-UnusedPrivateField","enabled":true},{"patternId":"rulesets-unusedcode.xml-UnusedLocalVariable","enabled":true},{"patternId":"rulesets-unusedcode.xml-UnusedPrivateMethod","enabled":true},{"patternId":"rulesets-unusedcode.xml-UnusedFormalParameter","enabled":true},{"patternId":"PyLint_C0303","enabled":true},{"patternId":"PyLint_C1001","enabled":true},{"patternId":"rulesets-naming.xml-ShortVariable","enabled":true},{"patternId":"rulesets-naming.xml-LongVariable","enabled":true},{"patternId":"rulesets-naming.xml-ShortMethodName","enabled":true},{"patternId":"rulesets-naming.xml-ConstantNamingConventions","enabled":true},{"patternId":"rulesets-naming.xml-BooleanGetMethodName","enabled":true},{"patternId":"PyLint_W0101","enabled":true},{"patternId":"PyLint_W0102","enabled":true},{"patternId":"PyLint_W0104","enabled":true},{"patternId":"PyLint_W0105","enabled":true},{"patternId":"Custom_Scala_GetCalls","enabled":true},{"patternId":"ScalaStyle_EqualsHashCodeChecker","enabled":true},{"patternId":"ScalaStyle_ParameterNumberChecker","enabled":true},{"patternId":"ScalaStyle_ReturnChecker","enabled":true},{"patternId":"ScalaStyle_NullChecker","enabled":true},{"patternId":"ScalaStyle_NoCloneChecker","enabled":true},{"patternId":"ScalaStyle_NoFinalizeChecker","enabled":true},{"patternId":"ScalaStyle_CovariantEqualsChecker","enabled":true},{"patternId":"ScalaStyle_StructuralTypeChecker","enabled":true},{"patternId":"ScalaStyle_MethodLengthChecker","enabled":true},{"patternId":"ScalaStyle_NumberOfMethodsInTypeChecker","enabled":true},{"patternId":"ScalaStyle_WhileChecker","enabled":true},{"patternId":"ScalaStyle_VarFieldChecker","enabled":true},{"patternId":"ScalaStyle_VarLocalChecker","enabled":true},{"patternId":"ScalaStyle_RedundantIfChecker","enabled":true},{"patternId":"ScalaStyle_DeprecatedJavaChecker","enabled":true},{"patternId":"ScalaStyle_EmptyClassChecker","enabled":true},{"patternId":"ScalaStyle_NotImplementedErrorUsage","enabled":true},{"patternId":"Custom_Scala_GroupImports","enabled":true},{"patternId":"Custom_Scala_ReservedKeywords","enabled":true},{"patternId":"Custom_Scala_ElseIf","enabled":true},{"patternId":"Custom_Scala_CallByNameAsLastArguments","enabled":true},{"patternId":"Custom_Scala_WildcardImportOnMany","enabled":true},{"patternId":"Custom_Scala_UtilTryForTryCatch","enabled":true},{"patternId":"Custom_Scala_ProhibitObjectName","enabled":true},{"patternId":"Custom_Scala_ImportsAtBeginningOfPackage","enabled":true},{"patternId":"Custom_Scala_NameResultsAndParameters","enabled":true},{"patternId":"Custom_Scala_IncompletePatternMatching","enabled":true},{"patternId":"Custom_Scala_UsefulTypeAlias","enabled":true},{"patternId":"Custom_Scala_JavaThreads","enabled":true},{"patternId":"Custom_Scala_DirectPromiseCreation","enabled":true},{"patternId":"Custom_Scala_StructuralTypes","enabled":true},{"patternId":"Custom_Scala_CollectionLastHead","enabled":true},{"patternId":"PyLint_W0106","enabled":true},{"patternId":"PyLint_W0107","enabled":true},{"patternId":"PyLint_W0108","enabled":true},{"patternId":"PyLint_W0109","enabled":true},{"patternId":"PyLint_W0110","enabled":true},{"patternId":"PyLint_W0120","enabled":true},{"patternId":"PyLint_W0122","enabled":true},{"patternId":"PyLint_W0150","enabled":true},{"patternId":"PyLint_W0199","enabled":true},{"patternId":"rulesets-cleancode.xml-ElseExpression","enabled":true},{"patternId":"rulesets-cleancode.xml-StaticAccess","enabled":true},{"patternId":"ScalaStyle_NonASCIICharacterChecker","enabled":true},{"patternId":"ScalaStyle_FieldNamesChecker","enabled":true},{"patternId":"Custom_Scala_WithNameCalls","enabled":true},{"patternId":"strictexception_AvoidRethrowingException","enabled":true},{"patternId":"strings_AppendCharacterWithChar","enabled":true},{"patternId":"braces_IfElseStmtsMustUseBraces","enabled":true},{"patternId":"basic_AvoidDecimalLiteralsInBigDecimalConstructor","enabled":true},{"patternId":"basic_CheckSkipResult","enabled":true},{"patternId":"javabeans_MissingSerialVersionUID","enabled":true},{"patternId":"migrating_ShortInstantiation","enabled":true},{"patternId":"design_AvoidInstanceofChecksInCatchClause","enabled":true},{"patternId":"naming_LongVariable","enabled":true},{"patternId":"migrating_ReplaceEnumerationWithIterator","enabled":true},{"patternId":"j2ee_DoNotCallSystemExit","enabled":true},{"patternId":"unusedcode_UnusedLocalVariable","enabled":true},{"patternId":"strings_InefficientStringBuffering","enabled":true},{"patternId":"basic_DontUseFloatTypeForLoopIndices","enabled":true},{"patternId":"basic_AvoidBranchingStatementAsLastInLoop","enabled":true},{"patternId":"migrating_JUnit4TestShouldUseTestAnnotation","enabled":true},{"patternId":"optimizations_AddEmptyString","enabled":true},{"patternId":"logging-jakarta-commons_ProperLogger","enabled":true},{"patternId":"optimizations_RedundantFieldInitializer","enabled":true},{"patternId":"logging-java_AvoidPrintStackTrace","enabled":true},{"patternId":"empty_EmptyFinallyBlock","enabled":true},{"patternId":"design_CompareObjectsWithEquals","enabled":true},{"patternId":"basic_ClassCastExceptionWithToArray","enabled":true},{"patternId":"strictexception_DoNotExtendJavaLangError","enabled":true},{"patternId":"junit_UnnecessaryBooleanAssertion","enabled":true},{"patternId":"design_SimplifyBooleanExpressions","enabled":true},{"patternId":"basic_ForLoopShouldBeWhileLoop","enabled":true},{"patternId":"basic_BigIntegerInstantiation","enabled":true},{"patternId":"optimizations_UseArrayListInsteadOfVector","enabled":true},{"patternId":"optimizations_UnnecessaryWrapperObjectCreation","enabled":true},{"patternId":"strings_StringBufferInstantiationWithChar","enabled":true},{"patternId":"basic_JumbledIncrementer","enabled":true},{"patternId":"design_SwitchStmtsShouldHaveDefault","enabled":true},{"patternId":"strictexception_AvoidThrowingRawExceptionTypes","enabled":true},{"patternId":"migrating_LongInstantiation","enabled":true},{"patternId":"design_SimplifyBooleanReturns","enabled":true},{"patternId":"empty_EmptyInitializer","enabled":true},{"patternId":"design_FieldDeclarationsShouldBeAtStartOfClass","enabled":true},{"patternId":"unnecessary_UnnecessaryConversionTemporary","enabled":true},{"patternId":"design_AvoidProtectedFieldInFinalClass","enabled":true},{"patternId":"junit_UseAssertTrueInsteadOfAssertEquals","enabled":true},{"patternId":"naming_PackageCase","enabled":true},{"patternId":"migrating_JUnitUseExpected","enabled":true},{"patternId":"controversial_UnnecessaryConstructor","enabled":true},{"patternId":"naming_MethodNamingConventions","enabled":true},{"patternId":"design_DefaultLabelNotLastInSwitchStmt","enabled":true},{"patternId":"basic_UnconditionalIfStatement","enabled":true},{"patternId":"design_SingularField","enabled":true},{"patternId":"design_AssignmentToNonFinalStatic","enabled":true},{"patternId":"braces_WhileLoopsMustUseBraces","enabled":true},{"patternId":"logging-java_SystemPrintln","enabled":true},{"patternId":"strings_UseStringBufferLength","enabled":true},{"patternId":"controversial_AvoidUsingNativeCode","enabled":true},{"patternId":"strictexception_AvoidLosingExceptionInformation","enabled":true},{"patternId":"imports_ImportFromSamePackage","enabled":true},{"patternId":"finalizers_AvoidCallingFinalize","enabled":true},{"patternId":"finalizers_FinalizeOverloaded","enabled":true},{"patternId":"naming_ClassNamingConventions","enabled":true},{"patternId":"logging-java_LoggerIsNotStaticFinal","enabled":true},{"patternId":"finalizers_FinalizeOnlyCallsSuperFinalize","enabled":true},{"patternId":"unnecessary_UselessOverridingMethod","enabled":true},{"patternId":"naming_SuspiciousConstantFieldName","enabled":true},{"patternId":"design_OptimizableToArrayCall","enabled":true},{"patternId":"imports_UnnecessaryFullyQualifiedName","enabled":true},{"patternId":"migrating_ReplaceHashtableWithMap","enabled":true},{"patternId":"unusedcode_UnusedPrivateField","enabled":true},{"patternId":"strings_UnnecessaryCaseChange","enabled":true},{"patternId":"migrating_IntegerInstantiation","enabled":true},{"patternId":"design_NonStaticInitializer","enabled":true},{"patternId":"design_MissingBreakInSwitch","enabled":true},{"patternId":"design_AvoidReassigningParameters","enabled":true},{"patternId":"basic_AvoidThreadGroup","enabled":true},{"patternId":"empty_EmptyCatchBlock","parameters":{"allowCommentedBlocks":"true"},"enabled":true},{"patternId":"codesize_ExcessiveParameterList","parameters":{"minimum":"8","violationSuppressRegex":"\"\"","violationSuppressXPath":"\"\""},"enabled":true},{"patternId":"naming_SuspiciousHashcodeMethodName","enabled":true},{"patternId":"migrating_JUnit4TestShouldUseBeforeAnnotation","enabled":true},{"patternId":"design_UncommentedEmptyMethodBody","enabled":true},{"patternId":"basic_BrokenNullCheck","enabled":true},{"patternId":"strings_ConsecutiveLiteralAppends","enabled":true},{"patternId":"strings_StringInstantiation","enabled":true},{"patternId":"design_EqualsNull","enabled":true},{"patternId":"basic_OverrideBothEqualsAndHashcode","enabled":true},{"patternId":"design_InstantiationToGetClass","enabled":true},{"patternId":"basic_BooleanInstantiation","enabled":true},{"patternId":"strings_AvoidStringBufferField","enabled":true},{"patternId":"basic_ReturnFromFinallyBlock","enabled":true},{"patternId":"empty_EmptyTryBlock","enabled":true},{"patternId":"naming_SuspiciousEqualsMethodName","enabled":true},{"patternId":"basic_ExtendsObject","enabled":true},{"patternId":"strings_UselessStringValueOf","enabled":true},{"patternId":"design_UnsynchronizedStaticDateFormatter","enabled":true},{"patternId":"design_UseCollectionIsEmpty","enabled":true},{"patternId":"controversial_AvoidFinalLocalVariable","enabled":true},{"patternId":"strictexception_AvoidThrowingNullPointerException","enabled":true},{"patternId":"design_AvoidProtectedMethodInFinalClassNotExtending","enabled":true},{"patternId":"optimizations_PrematureDeclaration","enabled":true},{"patternId":"empty_EmptySwitchStatements","enabled":true},{"patternId":"basic_MisplacedNullCheck","enabled":true},{"patternId":"optimizations_UseStringBufferForStringAppends","enabled":true},{"patternId":"strings_StringToString","enabled":true},{"patternId":"naming_MethodWithSameNameAsEnclosingClass","enabled":true},{"patternId":"migrating_ReplaceVectorWithList","enabled":true},{"patternId":"imports_UnusedImports","enabled":true},{"patternId":"unnecessary_UnnecessaryFinalModifier","enabled":true},{"patternId":"basic_AvoidMultipleUnaryOperators","enabled":true},{"patternId":"junit_SimplifyBooleanAssertion","enabled":true},{"patternId":"unnecessary_UselessParentheses","enabled":true},{"patternId":"design_IdempotentOperations","enabled":true},{"patternId":"braces_IfStmtsMustUseBraces","enabled":true},{"patternId":"strings_UseIndexOfChar","enabled":true},{"patternId":"naming_NoPackage","enabled":true},{"patternId":"finalizers_FinalizeDoesNotCallSuperFinalize","enabled":true},{"patternId":"design_UseVarargs","enabled":true},{"patternId":"unusedcode_UnusedFormalParameter","enabled":true},{"patternId":"design_ReturnEmptyArrayRatherThanNull","enabled":true},{"patternId":"junit_UseAssertNullInsteadOfAssertTrue","enabled":true},{"patternId":"design_UseUtilityClass","enabled":true},{"patternId":"design_AvoidDeeplyNestedIfStmts","enabled":true},{"patternId":"empty_EmptyStatementNotInLoop","enabled":true},{"patternId":"junit_UseAssertSameInsteadOfAssertTrue","enabled":true},{"patternId":"braces_ForLoopsMustUseBraces","enabled":true},{"patternId":"controversial_DoNotCallGarbageCollectionExplicitly","enabled":true},{"patternId":"naming_GenericsNaming","enabled":true},{"patternId":"strings_UseEqualsToCompareStrings","enabled":true},{"patternId":"optimizations_AvoidArrayLoops","enabled":true},{"patternId":"empty_EmptyStaticInitializer","enabled":true},{"patternId":"design_UncommentedEmptyConstructor","enabled":true},{"patternId":"empty_EmptyStatementBlock","enabled":true},{"patternId":"basic_CollapsibleIfStatements","enabled":true},{"patternId":"design_FinalFieldCouldBeStatic","enabled":true},{"patternId":"logging-java_MoreThanOneLogger","enabled":true},{"patternId":"codesize_ExcessiveClassLength","enabled":true},{"patternId":"design_ImmutableField","enabled":true},{"patternId":"controversial_OneDeclarationPerLine","enabled":true},{"patternId":"empty_EmptyWhileStmt","enabled":true},{"patternId":"unnecessary_UnnecessaryReturn","enabled":true},{"patternId":"strings_InefficientEmptyStringCheck","enabled":true},{"patternId":"design_UseNotifyAllInsteadOfNotify","enabled":true},{"patternId":"strictexception_DoNotThrowExceptionInFinally","enabled":true},{"patternId":"junit_UseAssertEqualsInsteadOfAssertTrue","enabled":true},{"patternId":"typeresolution_CloneMethodMustImplementCloneable","enabled":true},{"patternId":"codesize_NPathComplexity","enabled":true},{"patternId":"imports_DontImportJavaLang","enabled":true},{"patternId":"empty_EmptySynchronizedBlock","enabled":true},{"patternId":"migrating_JUnit4TestShouldUseAfterAnnotation","enabled":true},{"patternId":"design_AvoidConstantsInterface","enabled":true},{"patternId":"unnecessary_UselessOperationOnImmutable","enabled":true},{"patternId":"design_PositionLiteralsFirstInComparisons","enabled":true},{"patternId":"migrating_ByteInstantiation","enabled":true},{"patternId":"junit_JUnitSpelling","enabled":true},{"patternId":"junit_JUnitTestsShouldIncludeAssert","enabled":true},{"patternId":"finalizers_EmptyFinalizer","enabled":true},{"patternId":"design_NonCaseLabelInSwitchStatement","enabled":true},{"patternId":"android_DoNotHardCodeSDCard","enabled":true},{"patternId":"design_LogicInversion","enabled":true},{"patternId":"unusedcode_UnusedPrivateMethod","enabled":true},{"patternId":"naming_AvoidDollarSigns","enabled":true},{"patternId":"finalizers_FinalizeShouldBeProtected","enabled":true},{"patternId":"clone_ProperCloneImplementation","enabled":true},{"patternId":"basic_CheckResultSet","enabled":true},{"patternId":"controversial_AvoidPrefixingMethodParameters","enabled":true},{"patternId":"migrating_JUnit4SuitesShouldUseSuiteAnnotation","enabled":true},{"patternId":"empty_EmptyIfStmt","enabled":true},{"patternId":"basic_DontCallThreadRun","enabled":true},{"patternId":"junit_JUnitStaticSuite","enabled":true},{"patternId":"optimizations_UseArraysAsList","enabled":true},{"patternId":"design_MissingStaticMethodInNonInstantiatableClass","enabled":true},{"patternId":"unusedcode_UnusedModifier","enabled":true},{"patternId":"Style_MethodName","enabled":true},{"patternId":"Metrics_CyclomaticComplexity","enabled":true},{"patternId":"Lint_DuplicateMethods","enabled":true},{"patternId":"Style_Lambda","enabled":true},{"patternId":"Lint_UselessSetterCall","enabled":true},{"patternId":"Style_VariableName","enabled":true},{"patternId":"Lint_AmbiguousOperator","enabled":true},{"patternId":"Style_LeadingCommentSpace","enabled":true},{"patternId":"Style_CaseEquality","enabled":true},{"patternId":"Lint_StringConversionInInterpolation","enabled":true},{"patternId":"Performance_ReverseEach","enabled":true},{"patternId":"Lint_LiteralInCondition","enabled":true},{"patternId":"Performance_Sample","enabled":true},{"patternId":"Style_NonNilCheck","enabled":true},{"patternId":"Lint_RescueException","enabled":true},{"patternId":"Lint_UselessElseWithoutRescue","enabled":true},{"patternId":"Style_ConstantName","enabled":true},{"patternId":"Lint_LiteralInInterpolation","enabled":true},{"patternId":"Lint_NestedMethodDefinition","enabled":true},{"patternId":"Style_DoubleNegation","enabled":true},{"patternId":"Lint_SpaceBeforeFirstArg","enabled":true},{"patternId":"Lint_Debugger","enabled":true},{"patternId":"Style_ClassVars","enabled":true},{"patternId":"Lint_EmptyEnsure","enabled":true},{"patternId":"Style_MultilineBlockLayout","enabled":true},{"patternId":"Lint_UnusedBlockArgument","enabled":true},{"patternId":"Lint_UselessAccessModifier","enabled":true},{"patternId":"Performance_Size","enabled":true},{"patternId":"Lint_EachWithObjectArgument","enabled":true},{"patternId":"Style_Alias","enabled":true},{"patternId":"Lint_Loop","enabled":true},{"patternId":"Style_NegatedWhile","enabled":true},{"patternId":"Style_ColonMethodCall","enabled":true},{"patternId":"Lint_AmbiguousRegexpLiteral","enabled":true},{"patternId":"Lint_UnusedMethodArgument","enabled":true},{"patternId":"Style_MultilineIfThen","enabled":true},{"patternId":"Lint_EnsureReturn","enabled":true},{"patternId":"Style_NegatedIf","enabled":true},{"patternId":"Lint_Eval","enabled":true},{"patternId":"Style_NilComparison","enabled":true},{"patternId":"Style_ArrayJoin","enabled":true},{"patternId":"Lint_ConditionPosition","enabled":true},{"patternId":"Lint_UnreachableCode","enabled":true},{"patternId":"Performance_Count","enabled":true},{"patternId":"Lint_EmptyInterpolation","enabled":true},{"patternId":"Style_LambdaCall","enabled":true},{"patternId":"Lint_HandleExceptions","enabled":true},{"patternId":"Lint_ShadowingOuterLocalVariable","enabled":true},{"patternId":"Lint_EndAlignment","enabled":true},{"patternId":"Style_MultilineTernaryOperator","enabled":true},{"patternId":"Style_AutoResourceCleanup","enabled":true},{"patternId":"Lint_ElseLayout","enabled":true},{"patternId":"Style_NestedTernaryOperator","enabled":true},{"patternId":"Style_OneLineConditional","enabled":true},{"patternId":"Style_EmptyElse","enabled":true},{"patternId":"Lint_UselessComparison","enabled":true},{"patternId":"Metrics_PerceivedComplexity","enabled":true},{"patternId":"Style_InfiniteLoop","enabled":true},{"patternId":"Rails_Date","enabled":true},{"patternId":"Style_EvenOdd","enabled":true},{"patternId":"Style_IndentationConsistency","enabled":true},{"patternId":"Style_ModuleFunction","enabled":true},{"patternId":"Lint_UselessAssignment","enabled":true},{"patternId":"Style_EachWithObject","enabled":true},{"patternId":"Performance_Detect","enabled":true},{"patternId":"duplicate_key","enabled":true},{"patternId":"no_interpolation_in_single_quotes","enabled":true},{"patternId":"no_backticks","enabled":true},{"patternId":"no_unnecessary_fat_arrows","enabled":true},{"patternId":"indentation","enabled":true},{"patternId":"ensure_comprehensions","enabled":true},{"patternId":"no_stand_alone_at","enabled":true},{"patternId":"cyclomatic_complexity","enabled":true},{"patternId":"Deserialize","enabled":true},{"patternId":"SymbolDoS","enabled":true},{"patternId":"SkipBeforeFilter","enabled":true},{"patternId":"SanitizeMethods","enabled":true},{"patternId":"SelectTag","enabled":true},{"patternId":"XMLDoS","enabled":true},{"patternId":"SimpleFormat","enabled":true},{"patternId":"Evaluation","enabled":true},{"patternId":"BasicAuth","enabled":true},{"patternId":"JRubyXML","enabled":true},{"patternId":"RenderInline","enabled":true},{"patternId":"YAMLParsing","enabled":true},{"patternId":"Redirect","enabled":true},{"patternId":"UnsafeReflection","enabled":true},{"patternId":"SSLVerify","enabled":true},{"patternId":"HeaderDoS","enabled":true},{"patternId":"TranslateBug","enabled":true},{"patternId":"Execute","enabled":true},{"patternId":"JSONParsing","enabled":true},{"patternId":"LinkTo","enabled":true},{"patternId":"FileDisclosure","enabled":true},{"patternId":"SafeBufferManipulation","enabled":true},{"patternId":"ModelAttributes","enabled":true},{"patternId":"ResponseSplitting","enabled":true},{"patternId":"DigestDoS","enabled":true},{"patternId":"Send","enabled":true},{"patternId":"MailTo","enabled":true},{"patternId":"SymbolDoSCVE","enabled":true},{"patternId":"StripTags","enabled":true},{"patternId":"MassAssignment","enabled":true},{"patternId":"RegexDoS","enabled":true},{"patternId":"SelectVulnerability","enabled":true},{"patternId":"FileAccess","enabled":true},{"patternId":"ContentTag","enabled":true},{"patternId":"SessionSettings","enabled":true},{"patternId":"FilterSkipping","enabled":true},{"patternId":"CreateWith","enabled":true},{"patternId":"JSONEncoding","enabled":true},{"patternId":"SQLCVEs","enabled":true},{"patternId":"ForgerySetting","enabled":true},{"patternId":"QuoteTableName","enabled":true},{"patternId":"I18nXSS","enabled":true},{"patternId":"WithoutProtection","enabled":true},{"patternId":"CrossSiteScripting","enabled":true},{"patternId":"SingleQuotes","enabled":true},{"patternId":"NestedAttributes","enabled":true},{"patternId":"DetailedExceptions","enabled":true},{"patternId":"LinkToHref","enabled":true},{"patternId":"RenderDoS","enabled":true},{"patternId":"ModelSerialize","enabled":true},{"patternId":"SQL","enabled":true},{"patternId":"Render","enabled":true},{"patternId":"UnscopedFind","enabled":true},{"patternId":"ValidationRegex","enabled":true},{"patternId":"EscapeFunction","enabled":true},{"patternId":"Custom_Scala_FieldNamesChecker","enabled":true},{"patternId":"Custom_Scala_ObjDeserialization","enabled":true},{"patternId":"Custom_Scala_RSAPadding","enabled":true},{"patternId":"ESLint_no-extra-boolean-cast","enabled":true},{"patternId":"ESLint_no-iterator","enabled":true},{"patternId":"ESLint_no-invalid-regexp","enabled":true},{"patternId":"ESLint_no-obj-calls","enabled":true},{"patternId":"ESLint_no-sparse-arrays","enabled":true},{"patternId":"ESLint_no-unreachable","enabled":true},{"patternId":"ESLint_no-dupe-keys","enabled":true},{"patternId":"ESLint_no-multi-str","enabled":true},{"patternId":"ESLint_no-extend-native","enabled":true},{"patternId":"ESLint_guard-for-in","enabled":true},{"patternId":"ESLint_no-func-assign","enabled":true},{"patternId":"ESLint_no-extra-semi","enabled":true},{"patternId":"ESLint_camelcase","enabled":true},{"patternId":"ESLint_no-mixed-spaces-and-tabs","enabled":true},{"patternId":"ESLint_no-undef","enabled":true},{"patternId":"ESLint_semi","enabled":true},{"patternId":"ESLint_no-empty-character-class","enabled":true},{"patternId":"ESLint_complexity","enabled":true},{"patternId":"ESLint_no-dupe-class-members","enabled":true},{"patternId":"ESLint_no-debugger","enabled":true},{"patternId":"ESLint_block-scoped-var","enabled":true},{"patternId":"ESLint_no-loop-func","enabled":true},{"patternId":"ESLint_no-use-before-define","enabled":true},{"patternId":"ESLint_no-console","enabled":true},{"patternId":"ESLint_require-yield","enabled":true},{"patternId":"ESLint_no-redeclare","enabled":true},{"patternId":"ESLint_no-undefined","enabled":true},{"patternId":"ESLint_use-isnan","enabled":true},{"patternId":"ESLint_no-control-regex","enabled":true},{"patternId":"ESLint_no-const-assign","enabled":true},{"patternId":"ESLint_no-new","enabled":true},{"patternId":"ESLint_new-cap","enabled":true},{"patternId":"ESLint_no-irregular-whitespace","enabled":true},{"patternId":"ESLint_object-shorthand","enabled":true},{"patternId":"ESLint_no-ex-assign","enabled":true},{"patternId":"ESLint_wrap-iife","enabled":true},{"patternId":"ESLint_arrow-parens","enabled":true},{"patternId":"ESLint_no-constant-condition","enabled":true},{"patternId":"ESLint_no-octal","enabled":true},{"patternId":"ESLint_no-dupe-args","enabled":true},{"patternId":"ESLint_quotes","enabled":true},{"patternId":"ESLint_no-fallthrough","enabled":true},{"patternId":"ESLint_no-delete-var","enabled":true},{"patternId":"ESLint_no-caller","enabled":true},{"patternId":"ESLint_no-cond-assign","enabled":true},{"patternId":"ESLint_no-this-before-super","enabled":true},{"patternId":"ESLint_no-negated-in-lhs","enabled":true},{"patternId":"ESLint_no-inner-declarations","enabled":true},{"patternId":"ESLint_eqeqeq","enabled":true},{"patternId":"ESLint_curly","enabled":true},{"patternId":"ESLint_arrow-spacing","enabled":true},{"patternId":"ESLint_no-empty","enabled":true},{"patternId":"ESLint_no-unused-vars","enabled":true},{"patternId":"ESLint_generator-star-spacing","enabled":true},{"patternId":"ESLint_no-duplicate-case","enabled":true},{"patternId":"ESLint_valid-typeof","enabled":true},{"patternId":"ESLint_no-regex-spaces","enabled":true},{"patternId":"ESLint_no-class-assign","enabled":true},{"patternId":"PyLint_W0221","enabled":true},{"patternId":"PyLint_E0117","enabled":true},{"patternId":"PyLint_E0001","enabled":true},{"patternId":"PyLint_E0241","enabled":true},{"patternId":"PyLint_W0404","enabled":true},{"patternId":"PyLint_E0704","enabled":true},{"patternId":"PyLint_E0703","enabled":true},{"patternId":"PyLint_E0302","enabled":true},{"patternId":"PyLint_W1301","enabled":true},{"patternId":"PyLint_R0201","enabled":true},{"patternId":"PyLint_E0113","enabled":true},{"patternId":"PyLint_W0410","enabled":true},{"patternId":"PyLint_C0123","enabled":true},{"patternId":"PyLint_E0115","enabled":true},{"patternId":"PyLint_E0114","enabled":true},{"patternId":"PyLint_E1126","enabled":true},{"patternId":"PyLint_W0702","enabled":true},{"patternId":"PyLint_W1303","enabled":true},{"patternId":"PyLint_W0622","enabled":true},{"patternId":"PyLint_W0222","enabled":true},{"patternId":"PyLint_W0233","enabled":true},{"patternId":"PyLint_W1305","enabled":true},{"patternId":"PyLint_E1127","enabled":true},{"patternId":"PyLint_E0112","enabled":true},{"patternId":"PyLint_W0611","enabled":true},{"patternId":"PyLint_W0601","enabled":true},{"patternId":"PyLint_W1300","enabled":true},{"patternId":"PyLint_W0124","enabled":true},{"patternId":"PyLint_R0203","enabled":true},{"patternId":"PyLint_E0236","enabled":true},{"patternId":"PyLint_W0612","enabled":true},{"patternId":"PyLint_W0604","enabled":true},{"patternId":"PyLint_W0705","enabled":true},{"patternId":"PyLint_E0238","enabled":true},{"patternId":"PyLint_W0602","enabled":true},{"patternId":"PyLint_R0102","enabled":true},{"patternId":"PyLint_R0202","enabled":true},{"patternId":"PyLint_E0240","enabled":true},{"patternId":"PyLint_W0623","enabled":true},{"patternId":"PyLint_W0711","enabled":true},{"patternId":"PyLint_E0116","enabled":true},{"patternId":"PyLint_E0239","enabled":true},{"patternId":"PyLint_E1132","enabled":true},{"patternId":"PyLint_W1307","enabled":true},{"patternId":"PyLint_C0200","enabled":true},{"patternId":"PyLint_E0301","enabled":true},{"patternId":"PyLint_W1306","enabled":true},{"patternId":"PyLint_W1302","enabled":true},{"patternId":"PyLint_E0110","enabled":true},{"patternId":"PyLint_E1125","enabled":true}]}
\ No newline at end of file
diff --git a/gcloud-java-bigquery/README.md b/gcloud-java-bigquery/README.md
index 3f3678f41a04..3387cd8c4f41 100644
--- a/gcloud-java-bigquery/README.md
+++ b/gcloud-java-bigquery/README.md
@@ -6,6 +6,8 @@ Java idiomatic client for [Google Cloud BigQuery] (https://cloud.google.com/bigq
[](https://travis-ci.org/GoogleCloudPlatform/gcloud-java)
[](https://coveralls.io/r/GoogleCloudPlatform/gcloud-java?branch=master)
[]( https://img.shields.io/maven-central/v/com.google.gcloud/gcloud-java-bigquery.svg)
+[](https://www.codacy.com/app/mziccard/gcloud-java)
+[](https://www.versioneye.com/user/projects/56bd8ee72a29ed002d2b0969)
- [Homepage] (https://googlecloudplatform.github.io/gcloud-java/)
- [API Documentation] (http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/gcloud/bigquery/package-summary.html)
@@ -20,22 +22,22 @@ If you are using Maven, add this to your pom.xml file
com.google.gcloudgcloud-java-bigquery
- 0.1.3
+ 0.1.5
```
If you are using Gradle, add this to your dependencies
```Groovy
-compile 'com.google.gcloud:gcloud-java-bigquery:0.1.3'
+compile 'com.google.gcloud:gcloud-java-bigquery:0.1.5'
```
If you are using SBT, add this to your dependencies
```Scala
-libraryDependencies += "com.google.gcloud" % "gcloud-java-bigquery" % "0.1.3"
+libraryDependencies += "com.google.gcloud" % "gcloud-java-bigquery" % "0.1.5"
```
Example Application
-------------------
-- [`BigQueryExample`](https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/gcloud-java-examples/src/main/java/com/google/gcloud/examples/BigQueryExample.java) - A simple command line interface providing some of Cloud BigQuery's functionality.
-Read more about using this application on the [`gcloud-java-examples` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/BigQueryExample.html).
+- [`BigQueryExample`](../gcloud-java-examples/src/main/java/com/google/gcloud/examples/bigquery/BigQueryExample.java) - A simple command line interface providing some of Cloud BigQuery's functionality.
+Read more about using this application on the [`BigQueryExample` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/bigquery/BigQueryExample.html).
Authentication
--------------
@@ -114,6 +116,7 @@ with only one string field. Add the following imports at the top of your file:
import com.google.gcloud.bigquery.Field;
import com.google.gcloud.bigquery.Schema;
import com.google.gcloud.bigquery.StandardTableDefinition;
+import com.google.gcloud.bigquery.Table;
import com.google.gcloud.bigquery.TableId;
import com.google.gcloud.bigquery.TableInfo;
```
@@ -127,7 +130,7 @@ Field stringField = Field.of("StringField", Field.Type.string());
Schema schema = Schema.of(stringField);
// Create a table
StandardTableDefinition tableDefinition = StandardTableDefinition.of(schema);
-TableInfo createdTableInfo = bigquery.create(TableInfo.of(tableId, tableDefinition));
+Table createdTable = bigquery.create(TableInfo.of(tableId, tableDefinition));
```
#### Loading data into a table
@@ -199,90 +202,13 @@ while (rowIterator.hasNext()) {
```
#### Complete source code
-Here we put together all the code shown above into one program. This program assumes that you are
-running on Compute Engine or from your own desktop. To run this example on App Engine, simply move
+In
+[InsertDataAndQueryTable.java](../gcloud-java-examples/src/main/java/com/google/gcloud/examples/bigquery/snippets/InsertDataAndQueryTable.java)
+we put together all the code shown above into one program. The program assumes that you are
+running on Compute Engine or from your own desktop. To run the example on App Engine, simply move
the code from the main method to your application's servlet class and change the print statements to
display on your webpage.
-```java
-import com.google.gcloud.bigquery.BigQuery;
-import com.google.gcloud.bigquery.BigQueryOptions;
-import com.google.gcloud.bigquery.DatasetInfo;
-import com.google.gcloud.bigquery.Field;
-import com.google.gcloud.bigquery.FieldValue;
-import com.google.gcloud.bigquery.InsertAllRequest;
-import com.google.gcloud.bigquery.InsertAllResponse;
-import com.google.gcloud.bigquery.QueryRequest;
-import com.google.gcloud.bigquery.QueryResponse;
-import com.google.gcloud.bigquery.Schema;
-import com.google.gcloud.bigquery.StandardTableDefinition;
-import com.google.gcloud.bigquery.TableId;
-import com.google.gcloud.bigquery.TableInfo;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-public class GcloudBigQueryExample {
-
- public static void main(String[] args) throws InterruptedException {
-
- // Create a service instance
- BigQuery bigquery = BigQueryOptions.defaultInstance().service();
-
- // Create a dataset
- String datasetId = "my_dataset_id";
- bigquery.create(DatasetInfo.builder(datasetId).build());
-
- TableId tableId = TableId.of(datasetId, "my_table_id");
- // Table field definition
- Field stringField = Field.of("StringField", Field.Type.string());
- // Table schema definition
- Schema schema = Schema.of(stringField);
- // Create a table
- StandardTableDefinition tableDefinition = StandardTableDefinition.of(schema);
- TableInfo createdTableInfo = bigquery.create(TableInfo.of(tableId, tableDefinition));
-
- // Define rows to insert
- Map firstRow = new HashMap<>();
- Map secondRow = new HashMap<>();
- firstRow.put("StringField", "value1");
- secondRow.put("StringField", "value2");
- // Create an insert request
- InsertAllRequest insertRequest = InsertAllRequest.builder(tableId)
- .addRow(firstRow)
- .addRow(secondRow)
- .build();
- // Insert rows
- InsertAllResponse insertResponse = bigquery.insertAll(insertRequest);
- // Check if errors occurred
- if (insertResponse.hasErrors()) {
- System.out.println("Errors occurred while inserting rows");
- }
-
- // Create a query request
- QueryRequest queryRequest =
- QueryRequest.builder("SELECT * FROM my_dataset_id.my_table_id")
- .maxWaitTime(60000L)
- .maxResults(1000L)
- .build();
- // Request query to be executed and wait for results
- QueryResponse queryResponse = bigquery.query(queryRequest);
- while (!queryResponse.jobCompleted()) {
- Thread.sleep(1000L);
- queryResponse = bigquery.getQueryResults(queryResponse.jobId());
- }
- // Read rows
- Iterator> rowIterator = queryResponse.result().iterateAll();
- System.out.println("Table rows:");
- while (rowIterator.hasNext()) {
- System.out.println(rowIterator.next());
- }
- }
-}
-```
-
Troubleshooting
---------------
diff --git a/gcloud-java-bigquery/pom.xml b/gcloud-java-bigquery/pom.xml
index a5d711abf610..9a2137cb987d 100644
--- a/gcloud-java-bigquery/pom.xml
+++ b/gcloud-java-bigquery/pom.xml
@@ -1,7 +1,6 @@
4.0.0
- com.google.gcloudgcloud-java-bigqueryjarGCloud Java bigquery
@@ -11,7 +10,7 @@
com.google.gcloudgcloud-java-pom
- 0.1.4-SNAPSHOT
+ 0.1.6-SNAPSHOTgcloud-java-bigquery
@@ -31,13 +30,13 @@
com.google.apisgoogle-api-services-bigquery
- v2-rev254-1.21.0
+ v2-rev270-1.21.0compile
-
- com.google.guava
- guava-jdk5
-
+
+ com.google.guava
+ guava-jdk5
+
@@ -49,7 +48,7 @@
org.easymockeasymock
- 3.3
+ 3.4test
diff --git a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/Acl.java b/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/Acl.java
index b8e9926ce8c8..b8e1a817c836 100644
--- a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/Acl.java
+++ b/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/Acl.java
@@ -325,6 +325,8 @@ Access toPb() {
*/
public static final class View extends Entity {
+ private static final long serialVersionUID = -6851072781269419383L;
+
private final TableId id;
/**
diff --git a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/BigQuery.java b/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/BigQuery.java
index a1b23aba4d5d..986c595e350d 100644
--- a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/BigQuery.java
+++ b/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/BigQuery.java
@@ -206,7 +206,7 @@ private DatasetOption(BigQueryRpc.Option option, Object value) {
/**
* Returns an option to specify the dataset's fields to be returned by the RPC call. If this
* option is not provided all dataset's fields are returned. {@code DatasetOption.fields} can
- * be used to specify only the fields of interest. {@link DatasetInfo#datasetId()} is always
+ * be used to specify only the fields of interest. {@link Dataset#datasetId()} is always
* returned, even if not specified.
*/
public static DatasetOption fields(DatasetField... fields) {
@@ -275,8 +275,8 @@ private TableOption(BigQueryRpc.Option option, Object value) {
/**
* Returns an option to specify the table's fields to be returned by the RPC call. If this
* option is not provided all table's fields are returned. {@code TableOption.fields} can be
- * used to specify only the fields of interest. {@link TableInfo#tableId()} and type (which is
- * part of {@link TableInfo#definition()}) are always returned, even if not specified.
+ * used to specify only the fields of interest. {@link Table#tableId()} and type (which is part
+ * of {@link Table#definition()}) are always returned, even if not specified.
*/
public static TableOption fields(TableField... fields) {
return new TableOption(BigQueryRpc.Option.FIELDS, TableField.selector(fields));
@@ -369,7 +369,7 @@ public static JobListOption startPageToken(String pageToken) {
/**
* Returns an option to specify the job's fields to be returned by the RPC call. If this option
* is not provided all job's fields are returned. {@code JobOption.fields()} can be used to
- * specify only the fields of interest. {@link JobInfo#jobId()}, {@link JobStatus#state()},
+ * specify only the fields of interest. {@link Job#jobId()}, {@link JobStatus#state()},
* {@link JobStatus#error()} as well as type-specific configuration (e.g.
* {@link QueryJobConfiguration#query()} for Query Jobs) are always returned, even if not
* specified. {@link JobField#SELF_LINK} and {@link JobField#ETAG} can not be selected when
@@ -397,7 +397,7 @@ private JobOption(BigQueryRpc.Option option, Object value) {
/**
* Returns an option to specify the job's fields to be returned by the RPC call. If this option
* is not provided all job's fields are returned. {@code JobOption.fields()} can be used to
- * specify only the fields of interest. {@link JobInfo#jobId()} as well as type-specific
+ * specify only the fields of interest. {@link Job#jobId()} as well as type-specific
* configuration (e.g. {@link QueryJobConfiguration#query()} for Query Jobs) are always
* returned, even if not specified.
*/
@@ -457,46 +457,45 @@ public static QueryResultsOption maxWaitTime(long maxWaitTime) {
*
* @throws BigQueryException upon failure
*/
- DatasetInfo create(DatasetInfo dataset, DatasetOption... options) throws BigQueryException;
+ Dataset create(DatasetInfo dataset, DatasetOption... options);
/**
* Creates a new table.
*
* @throws BigQueryException upon failure
*/
- TableInfo create(TableInfo table, TableOption... options) throws BigQueryException;
+ Table create(TableInfo table, TableOption... options);
/**
* Creates a new job.
*
* @throws BigQueryException upon failure
*/
- JobInfo create(JobInfo job, JobOption... options) throws BigQueryException;
+ Job create(JobInfo job, JobOption... options);
/**
* Returns the requested dataset or {@code null} if not found.
*
* @throws BigQueryException upon failure
*/
- DatasetInfo getDataset(String datasetId, DatasetOption... options) throws BigQueryException;
+ Dataset getDataset(String datasetId, DatasetOption... options);
/**
* Returns the requested dataset or {@code null} if not found.
*
* @throws BigQueryException upon failure
*/
- DatasetInfo getDataset(DatasetId datasetId, DatasetOption... options) throws BigQueryException;
+ Dataset getDataset(DatasetId datasetId, DatasetOption... options);
/**
* Lists the project's datasets. This method returns partial information on each dataset
- * ({@link DatasetInfo#datasetId()}, {@link DatasetInfo#friendlyName()} and
- * {@link DatasetInfo#id()}). To get complete information use either
- * {@link #getDataset(String, DatasetOption...)} or
+ * ({@link Dataset#datasetId()}, {@link Dataset#friendlyName()} and {@link Dataset#id()}). To get
+ * complete information use either {@link #getDataset(String, DatasetOption...)} or
* {@link #getDataset(DatasetId, DatasetOption...)}.
*
* @throws BigQueryException upon failure
*/
- Page listDatasets(DatasetListOption... options) throws BigQueryException;
+ Page listDatasets(DatasetListOption... options);
/**
* Deletes the requested dataset.
@@ -504,7 +503,7 @@ public static QueryResultsOption maxWaitTime(long maxWaitTime) {
* @return {@code true} if dataset was deleted, {@code false} if it was not found
* @throws BigQueryException upon failure
*/
- boolean delete(String datasetId, DatasetDeleteOption... options) throws BigQueryException;
+ boolean delete(String datasetId, DatasetDeleteOption... options);
/**
* Deletes the requested dataset.
@@ -512,7 +511,7 @@ public static QueryResultsOption maxWaitTime(long maxWaitTime) {
* @return {@code true} if dataset was deleted, {@code false} if it was not found
* @throws BigQueryException upon failure
*/
- boolean delete(DatasetId datasetId, DatasetDeleteOption... options) throws BigQueryException;
+ boolean delete(DatasetId datasetId, DatasetDeleteOption... options);
/**
* Deletes the requested table.
@@ -520,7 +519,7 @@ public static QueryResultsOption maxWaitTime(long maxWaitTime) {
* @return {@code true} if table was deleted, {@code false} if it was not found
* @throws BigQueryException upon failure
*/
- boolean delete(String datasetId, String tableId) throws BigQueryException;
+ boolean delete(String datasetId, String tableId);
/**
* Deletes the requested table.
@@ -528,68 +527,64 @@ public static QueryResultsOption maxWaitTime(long maxWaitTime) {
* @return {@code true} if table was deleted, {@code false} if it was not found
* @throws BigQueryException upon failure
*/
- boolean delete(TableId tableId) throws BigQueryException;
+ boolean delete(TableId tableId);
/**
* Updates dataset information.
*
* @throws BigQueryException upon failure
*/
- DatasetInfo update(DatasetInfo dataset, DatasetOption... options) throws BigQueryException;
+ Dataset update(DatasetInfo dataset, DatasetOption... options);
/**
* Updates table information.
*
* @throws BigQueryException upon failure
*/
- TableInfo update(TableInfo table, TableOption... options) throws BigQueryException;
+ Table update(TableInfo table, TableOption... options);
/**
* Returns the requested table or {@code null} if not found.
*
* @throws BigQueryException upon failure
*/
- TableInfo getTable(String datasetId, String tableId, TableOption... options)
- throws BigQueryException;
+ Table getTable(String datasetId, String tableId, TableOption... options);
/**
* Returns the requested table or {@code null} if not found.
*
* @throws BigQueryException upon failure
*/
- TableInfo getTable(TableId tableId, TableOption... options)
- throws BigQueryException;
+ Table getTable(TableId tableId, TableOption... options);
/**
* Lists the tables in the dataset. This method returns partial information on each table
- * ({@link TableInfo#tableId()}, {@link TableInfo#friendlyName()}, {@link TableInfo#id()} and
- * type, which is part of {@link TableInfo#definition()}). To get complete information use either
+ * ({@link Table#tableId()}, {@link Table#friendlyName()}, {@link Table#id()} and type, which
+ * is part of {@link Table#definition()}). To get complete information use either
* {@link #getTable(TableId, TableOption...)} or
* {@link #getTable(String, String, TableOption...)}.
*
* @throws BigQueryException upon failure
*/
- Page listTables(String datasetId, TableListOption... options)
- throws BigQueryException;
+ Page
listTables(String datasetId, TableListOption... options);
/**
* Lists the tables in the dataset. This method returns partial information on each table
- * ({@link TableInfo#tableId()}, {@link TableInfo#friendlyName()}, {@link TableInfo#id()} and
- * type, which is part of {@link TableInfo#definition()}). To get complete information use either
+ * ({@link Table#tableId()}, {@link Table#friendlyName()}, {@link Table#id()} and type, which
+ * is part of {@link Table#definition()}). To get complete information use either
* {@link #getTable(TableId, TableOption...)} or
* {@link #getTable(String, String, TableOption...)}.
*
* @throws BigQueryException upon failure
*/
- Page listTables(DatasetId datasetId, TableListOption... options)
- throws BigQueryException;
+ Page
listTables(DatasetId datasetId, TableListOption... options);
/**
* Sends an insert all request.
*
* @throws BigQueryException upon failure
*/
- InsertAllResponse insertAll(InsertAllRequest request) throws BigQueryException;
+ InsertAllResponse insertAll(InsertAllRequest request);
/**
* Lists the table's rows.
@@ -597,36 +592,35 @@ Page listTables(DatasetId datasetId, TableListOption... options)
* @throws BigQueryException upon failure
*/
Page> listTableData(String datasetId, String tableId,
- TableDataListOption... options) throws BigQueryException;
+ TableDataListOption... options);
/**
* Lists the table's rows.
*
* @throws BigQueryException upon failure
*/
- Page> listTableData(TableId tableId, TableDataListOption... options)
- throws BigQueryException;
+ Page> listTableData(TableId tableId, TableDataListOption... options);
/**
* Returns the requested job or {@code null} if not found.
*
* @throws BigQueryException upon failure
*/
- JobInfo getJob(String jobId, JobOption... options) throws BigQueryException;
+ Job getJob(String jobId, JobOption... options);
/**
* Returns the requested job or {@code null} if not found.
*
* @throws BigQueryException upon failure
*/
- JobInfo getJob(JobId jobId, JobOption... options) throws BigQueryException;
+ Job getJob(JobId jobId, JobOption... options);
/**
* Lists the jobs.
*
* @throws BigQueryException upon failure
*/
- Page listJobs(JobListOption... options) throws BigQueryException;
+ Page listJobs(JobListOption... options);
/**
* Sends a job cancel request. This call will return immediately. The job status can then be
@@ -637,7 +631,7 @@ Page> listTableData(TableId tableId, TableDataListOption... opt
* found
* @throws BigQueryException upon failure
*/
- boolean cancel(String jobId) throws BigQueryException;
+ boolean cancel(String jobId);
/**
* Sends a job cancel request. This call will return immediately. The job status can then be
@@ -648,21 +642,21 @@ Page> listTableData(TableId tableId, TableDataListOption... opt
* found
* @throws BigQueryException upon failure
*/
- boolean cancel(JobId tableId) throws BigQueryException;
+ boolean cancel(JobId tableId);
/**
* Runs the query associated with the request.
*
* @throws BigQueryException upon failure
*/
- QueryResponse query(QueryRequest request) throws BigQueryException;
+ QueryResponse query(QueryRequest request);
/**
* Returns results of the query associated with the provided job.
*
* @throws BigQueryException upon failure
*/
- QueryResponse getQueryResults(JobId job, QueryResultsOption... options) throws BigQueryException;
+ QueryResponse getQueryResults(JobId job, QueryResultsOption... options);
/**
* Returns a channel to write data to be inserted into a BigQuery table. Data format and other
diff --git a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/BigQueryImpl.java b/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/BigQueryImpl.java
index de74bdcac89c..ce881c6ea079 100644
--- a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/BigQueryImpl.java
+++ b/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/BigQueryImpl.java
@@ -19,10 +19,7 @@
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.gcloud.RetryHelper.runWithRetries;
-import com.google.api.services.bigquery.model.Dataset;
import com.google.api.services.bigquery.model.GetQueryResultsResponse;
-import com.google.api.services.bigquery.model.Job;
-import com.google.api.services.bigquery.model.Table;
import com.google.api.services.bigquery.model.TableDataInsertAllRequest;
import com.google.api.services.bigquery.model.TableDataInsertAllRequest.Rows;
import com.google.api.services.bigquery.model.TableRow;
@@ -46,7 +43,7 @@
final class BigQueryImpl extends BaseService implements BigQuery {
- private static class DatasetPageFetcher implements NextPageFetcher {
+ private static class DatasetPageFetcher implements NextPageFetcher {
private static final long serialVersionUID = -3057564042439021278L;
private final Map requestOptions;
@@ -60,12 +57,12 @@ private static class DatasetPageFetcher implements NextPageFetcher
}
@Override
- public Page nextPage() {
+ public Page nextPage() {
return listDatasets(serviceOptions, requestOptions);
}
}
- private static class TablePageFetcher implements NextPageFetcher {
+ private static class TablePageFetcher implements NextPageFetcher
{
private static final long serialVersionUID = 8611248840504201187L;
private final Map requestOptions;
@@ -81,12 +78,12 @@ private static class TablePageFetcher implements NextPageFetcher {
}
@Override
- public Page nextPage() {
+ public Page
Objects of this class are immutable. Operations that modify the dataset like {@link #update}
* return a new object. To get a {@code Dataset} object with the most recent information use
- * {@link #reload}.
+ * {@link #reload}. {@code Dataset} adds a layer of service-related functionality over
+ * {@link DatasetInfo}.
*
*/
-public final class Dataset {
+public final class Dataset extends DatasetInfo {
- private final BigQuery bigquery;
- private final DatasetInfo info;
+ private static final long serialVersionUID = -4272921483363065593L;
- private static class TablePageFetcher implements PageImpl.NextPageFetcher
{
+ private final BigQueryOptions options;
+ private transient BigQuery bigquery;
- private static final long serialVersionUID = 6906197848579250598L;
+ /**
+ * A builder for {@code Dataset} objects.
+ */
+ public static final class Builder extends DatasetInfo.Builder {
+
+ private final BigQuery bigquery;
+ private final DatasetInfo.BuilderImpl infoBuilder;
- private final BigQueryOptions options;
- private final Page infoPage;
+ Builder(BigQuery bigquery, DatasetId datasetId) {
+ this.bigquery = bigquery;
+ this.infoBuilder = new DatasetInfo.BuilderImpl();
+ this.infoBuilder.datasetId(datasetId);
+ }
- TablePageFetcher(BigQueryOptions options, Page infoPage) {
- this.options = options;
- this.infoPage = infoPage;
+ Builder(Dataset dataset) {
+ this.bigquery = dataset.bigquery;
+ this.infoBuilder = new DatasetInfo.BuilderImpl(dataset);
}
@Override
- public Page
nextPage() {
- Page nextInfoPage = infoPage.nextPage();
- return new PageImpl<>(new TablePageFetcher(options, nextInfoPage),
- nextInfoPage.nextPageCursor(), new LazyTableIterable(options, nextInfoPage.values()));
+ public Builder datasetId(DatasetId datasetId) {
+ infoBuilder.datasetId(datasetId);
+ return this;
}
- }
- private static class LazyTableIterable implements Iterable
Objects of this class are immutable. Operations that modify the table like {@link #update}
* return a new object. To get a {@code Table} object with the most recent information use
- * {@link #reload}.
+ * {@link #reload}. {@code Table} adds a layer of service-related functionality over
+ * {@link TableInfo}.
*
*/
-public final class Table {
+public final class Table extends TableInfo {
- private final BigQuery bigquery;
- private final TableInfo info;
+ private static final long serialVersionUID = 5744556727066570096L;
- /**
- * Constructs a {@code Table} object for the provided {@code TableInfo}. The BigQuery service
- * is used to issue requests.
- *
- * @param bigquery the BigQuery service used for issuing requests
- * @param info table's info
- */
- public Table(BigQuery bigquery, TableInfo info) {
- this.bigquery = checkNotNull(bigquery);
- this.info = checkNotNull(info);
- }
+ private final BigQueryOptions options;
+ private transient BigQuery bigquery;
/**
- * Creates a {@code Table} object for the provided dataset and table's user-defined ids. Performs
- * an RPC call to get the latest table information.
- *
- * @param bigquery the BigQuery service used for issuing requests
- * @param dataset the dataset's user-defined id
- * @param table the table's user-defined id
- * @param options table options
- * @return the {@code Table} object or {@code null} if not found
- * @throws BigQueryException upon failure
+ * A builder for {@code Table} objects.
*/
- public static Table get(BigQuery bigquery, String dataset, String table,
- BigQuery.TableOption... options) {
- return get(bigquery, TableId.of(dataset, table), options);
- }
+ public static class Builder extends TableInfo.Builder {
- /**
- * Creates a {@code Table} object for the provided table identity. Performs an RPC call to get the
- * latest table information.
- *
- * @param bigquery the BigQuery service used for issuing requests
- * @param table the table's identity
- * @param options table options
- * @return the {@code Table} object or {@code null} if not found
- * @throws BigQueryException upon failure
- */
- public static Table get(BigQuery bigquery, TableId table, BigQuery.TableOption... options) {
- TableInfo info = bigquery.getTable(table, options);
- return info != null ? new Table(bigquery, info) : null;
+ private final BigQuery bigquery;
+ private final TableInfo.BuilderImpl infoBuilder;
+
+ Builder(BigQuery bigquery, TableId tableId, TableDefinition defintion) {
+ this.bigquery = bigquery;
+ this.infoBuilder = new TableInfo.BuilderImpl();
+ this.infoBuilder.tableId(tableId).definition(defintion);
+ }
+
+ Builder(Table table) {
+ this.bigquery = table.bigquery;
+ this.infoBuilder = new TableInfo.BuilderImpl(table);
+ }
+
+ @Override
+ Builder creationTime(Long creationTime) {
+ infoBuilder.creationTime(creationTime);
+ return this;
+ }
+
+ @Override
+ public Builder description(String description) {
+ infoBuilder.description(description);
+ return this;
+ }
+
+ @Override
+ Builder etag(String etag) {
+ infoBuilder.etag(etag);
+ return this;
+ }
+
+ @Override
+ public Builder expirationTime(Long expirationTime) {
+ infoBuilder.expirationTime(expirationTime);
+ return this;
+ }
+
+ @Override
+ public Builder friendlyName(String friendlyName) {
+ infoBuilder.friendlyName(friendlyName);
+ return this;
+ }
+
+ @Override
+ Builder id(String id) {
+ infoBuilder.id(id);
+ return this;
+ }
+
+ @Override
+ Builder lastModifiedTime(Long lastModifiedTime) {
+ infoBuilder.lastModifiedTime(lastModifiedTime);
+ return this;
+ }
+
+ @Override
+ Builder selfLink(String selfLink) {
+ infoBuilder.selfLink(selfLink);
+ return this;
+ }
+
+ @Override
+ public Builder tableId(TableId tableId) {
+ infoBuilder.tableId(tableId);
+ return this;
+ }
+
+ @Override
+ public Builder definition(TableDefinition definition) {
+ infoBuilder.definition(definition);
+ return this;
+ }
+
+ @Override
+ public Table build() {
+ return new Table(bigquery, infoBuilder);
+ }
}
- /**
- * Returns the table's information.
- */
- public TableInfo info() {
- return info;
+ Table(BigQuery bigquery, TableInfo.BuilderImpl infoBuilder) {
+ super(infoBuilder);
+ this.bigquery = checkNotNull(bigquery);
+ this.options = bigquery.options();
}
/**
@@ -95,7 +140,7 @@ public TableInfo info() {
* @throws BigQueryException upon failure
*/
public boolean exists() {
- return bigquery.getTable(info.tableId(), BigQuery.TableOption.fields()) != null;
+ return bigquery.getTable(tableId(), BigQuery.TableOption.fields()) != null;
}
/**
@@ -106,25 +151,19 @@ public boolean exists() {
* @throws BigQueryException upon failure
*/
public Table reload(BigQuery.TableOption... options) {
- return Table.get(bigquery, info.tableId(), options);
+ return bigquery.getTable(tableId(), options);
}
/**
- * Updates the table's information. Dataset's and table's user-defined ids cannot be changed. A
- * new {@code Table} object is returned.
+ * Updates the table's information with this table's information. Dataset's and table's
+ * user-defined ids cannot be changed. A new {@code Table} object is returned.
*
- * @param tableInfo new table's information. Dataset's and table's user-defined ids must match the
- * ones of the current table
* @param options dataset options
* @return a {@code Table} object with updated information
* @throws BigQueryException upon failure
*/
- public Table update(TableInfo tableInfo, BigQuery.TableOption... options) {
- checkArgument(Objects.equals(tableInfo.tableId().dataset(),
- info.tableId().dataset()), "Dataset's user-defined ids must match");
- checkArgument(Objects.equals(tableInfo.tableId().table(),
- info.tableId().table()), "Table's user-defined ids must match");
- return new Table(bigquery, bigquery.update(tableInfo, options));
+ public Table update(BigQuery.TableOption... options) {
+ return bigquery.update(this, options);
}
/**
@@ -134,7 +173,7 @@ public Table update(TableInfo tableInfo, BigQuery.TableOption... options) {
* @throws BigQueryException upon failure
*/
public boolean delete() {
- return bigquery.delete(info.tableId());
+ return bigquery.delete(tableId());
}
/**
@@ -143,8 +182,9 @@ public boolean delete() {
* @param rows rows to be inserted
* @throws BigQueryException upon failure
*/
- InsertAllResponse insert(Iterable rows) throws BigQueryException {
- return bigquery.insertAll(InsertAllRequest.of(info.tableId(), rows));
+ public InsertAllResponse insert(Iterable rows)
+ throws BigQueryException {
+ return bigquery.insertAll(InsertAllRequest.of(tableId(), rows));
}
/**
@@ -158,9 +198,9 @@ InsertAllResponse insert(Iterable rows) throws Big
* to be invalid
* @throws BigQueryException upon failure
*/
- InsertAllResponse insert(Iterable rows, boolean skipInvalidRows,
- boolean ignoreUnknownValues) throws BigQueryException {
- InsertAllRequest request = InsertAllRequest.builder(info.tableId(), rows)
+ public InsertAllResponse insert(Iterable rows,
+ boolean skipInvalidRows, boolean ignoreUnknownValues) throws BigQueryException {
+ InsertAllRequest request = InsertAllRequest.builder(tableId(), rows)
.skipInvalidRows(skipInvalidRows)
.ignoreUnknownValues(ignoreUnknownValues)
.build();
@@ -173,8 +213,9 @@ InsertAllResponse insert(Iterable rows, boolean sk
* @param options table data list options
* @throws BigQueryException upon failure
*/
- Page> list(BigQuery.TableDataListOption... options) throws BigQueryException {
- return bigquery.listTableData(info.tableId(), options);
+ public Page> list(BigQuery.TableDataListOption... options)
+ throws BigQueryException {
+ return bigquery.listTableData(tableId(), options);
}
/**
@@ -186,7 +227,7 @@ Page> list(BigQuery.TableDataListOption... options) throws BigQ
* @param options job options
* @throws BigQueryException upon failure
*/
- Job copy(String destinationDataset, String destinationTable, BigQuery.JobOption... options)
+ public Job copy(String destinationDataset, String destinationTable, BigQuery.JobOption... options)
throws BigQueryException {
return copy(TableId.of(destinationDataset, destinationTable), options);
}
@@ -199,9 +240,10 @@ Job copy(String destinationDataset, String destinationTable, BigQuery.JobOption.
* @param options job options
* @throws BigQueryException upon failure
*/
- Job copy(TableId destinationTable, BigQuery.JobOption... options) throws BigQueryException {
- CopyJobConfiguration configuration = CopyJobConfiguration.of(destinationTable, info.tableId());
- return new Job(bigquery, bigquery.create(JobInfo.of(configuration), options));
+ public Job copy(TableId destinationTable, BigQuery.JobOption... options)
+ throws BigQueryException {
+ CopyJobConfiguration configuration = CopyJobConfiguration.of(destinationTable, tableId());
+ return bigquery.create(JobInfo.of(configuration), options);
}
/**
@@ -214,7 +256,7 @@ Job copy(TableId destinationTable, BigQuery.JobOption... options) throws BigQuer
* @param options job options
* @throws BigQueryException upon failure
*/
- Job extract(String format, String destinationUri, BigQuery.JobOption... options)
+ public Job extract(String format, String destinationUri, BigQuery.JobOption... options)
throws BigQueryException {
return extract(format, ImmutableList.of(destinationUri), options);
}
@@ -229,11 +271,11 @@ Job extract(String format, String destinationUri, BigQuery.JobOption... options)
* @param options job options
* @throws BigQueryException upon failure
*/
- Job extract(String format, List destinationUris, BigQuery.JobOption... options)
+ public Job extract(String format, List destinationUris, BigQuery.JobOption... options)
throws BigQueryException {
ExtractJobConfiguration extractConfiguration =
- ExtractJobConfiguration.of(info.tableId(), destinationUris, format);
- return new Job(bigquery, bigquery.create(JobInfo.of(extractConfiguration), options));
+ ExtractJobConfiguration.of(tableId(), destinationUris, format);
+ return bigquery.create(JobInfo.of(extractConfiguration), options);
}
/**
@@ -246,7 +288,7 @@ Job extract(String format, List destinationUris, BigQuery.JobOption... o
* @param options job options
* @throws BigQueryException upon failure
*/
- Job load(FormatOptions format, String sourceUri, BigQuery.JobOption... options)
+ public Job load(FormatOptions format, String sourceUri, BigQuery.JobOption... options)
throws BigQueryException {
return load(format, ImmutableList.of(sourceUri), options);
}
@@ -261,10 +303,10 @@ Job load(FormatOptions format, String sourceUri, BigQuery.JobOption... options)
* @param options job options
* @throws BigQueryException upon failure
*/
- Job load(FormatOptions format, List sourceUris, BigQuery.JobOption... options)
+ public Job load(FormatOptions format, List sourceUris, BigQuery.JobOption... options)
throws BigQueryException {
- LoadJobConfiguration loadConfig = LoadJobConfiguration.of(info.tableId(), sourceUris, format);
- return new Job(bigquery, bigquery.create(JobInfo.of(loadConfig), options));
+ LoadJobConfiguration loadConfig = LoadJobConfiguration.of(tableId(), sourceUris, format);
+ return bigquery.create(JobInfo.of(loadConfig), options);
}
/**
@@ -273,4 +315,30 @@ Job load(FormatOptions format, List sourceUris, BigQuery.JobOption... op
public BigQuery bigquery() {
return bigquery;
}
+
+ @Override
+ public Builder toBuilder() {
+ return new Builder(this);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return obj instanceof Table
+ && Objects.equals(toPb(), ((Table) obj).toPb())
+ && Objects.equals(options, ((Table) obj).options);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(super.hashCode(), options);
+ }
+
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ this.bigquery = options.service();
+ }
+
+ static Table fromPb(BigQuery bigquery, com.google.api.services.bigquery.model.Table tablePb) {
+ return new Table(bigquery, new TableInfo.BuilderImpl(tablePb));
+ }
}
diff --git a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/TableDataWriteChannel.java b/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/TableDataWriteChannel.java
index bee0340a29a8..9c6a950ca27f 100644
--- a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/TableDataWriteChannel.java
+++ b/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/TableDataWriteChannel.java
@@ -53,6 +53,7 @@ public void run() {
}
}
+ @Override
protected StateImpl.Builder stateBuilder() {
return StateImpl.builder(options(), entity(), uploadId());
}
diff --git a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/TableDefinition.java b/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/TableDefinition.java
index de858f54ac43..26e7bcc76f55 100644
--- a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/TableDefinition.java
+++ b/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/TableDefinition.java
@@ -25,7 +25,7 @@
import java.util.Objects;
/**
- * Base class for a Google BigQuery table type.
+ * Base class for a Google BigQuery table definition.
*/
public abstract class TableDefinition implements Serializable {
@@ -63,10 +63,10 @@ public enum Type {
}
/**
- * Base builder for table types.
+ * Base builder for table definitions.
*
- * @param the table type class
- * @param the table type builder
+ * @param the table definition class
+ * @param the table definition builder
*/
public abstract static class Builder> {
@@ -152,8 +152,8 @@ final int baseHashCode() {
return Objects.hash(type);
}
- final boolean baseEquals(TableDefinition jobConfiguration) {
- return Objects.equals(toPb(), jobConfiguration.toPb());
+ final boolean baseEquals(TableDefinition tableDefinition) {
+ return Objects.equals(toPb(), tableDefinition.toPb());
}
Table toPb() {
diff --git a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/TableInfo.java b/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/TableInfo.java
index 814b8cac1e97..de331350e978 100644
--- a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/TableInfo.java
+++ b/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/TableInfo.java
@@ -23,7 +23,6 @@
import com.google.api.services.bigquery.model.Table;
import com.google.common.base.Function;
import com.google.common.base.MoreObjects;
-import com.google.common.base.MoreObjects.ToStringHelper;
import java.io.Serializable;
import java.math.BigInteger;
@@ -36,7 +35,7 @@
*
* @see Managing Tables
*/
-public final class TableInfo implements Serializable {
+public class TableInfo implements Serializable {
static final Function
FROM_PB_FUNCTION =
new Function
() {
@@ -67,9 +66,55 @@ public Table apply(TableInfo tableInfo) {
private final TableDefinition definition;
/**
- * Builder for tables.
+ * A builder for {@code TableInfo} objects.
*/
- public static class Builder {
+ public abstract static class Builder {
+
+ abstract Builder creationTime(Long creationTime);
+
+ /**
+ * Sets a user-friendly description for the table.
+ */
+ public abstract Builder description(String description);
+
+ abstract Builder etag(String etag);
+
+ /**
+ * Sets the time when this table expires, in milliseconds since the epoch. If not present, the
+ * table will persist indefinitely. Expired tables will be deleted and their storage reclaimed.
+ */
+ public abstract Builder expirationTime(Long expirationTime);
+
+ /**
+ * Sets a user-friendly name for the table.
+ */
+ public abstract Builder friendlyName(String friendlyName);
+
+ abstract Builder id(String id);
+
+ abstract Builder lastModifiedTime(Long lastModifiedTime);
+
+ abstract Builder selfLink(String selfLink);
+
+ /**
+ * Sets the table identity.
+ */
+ public abstract Builder tableId(TableId tableId);
+
+ /**
+ * Sets the table definition. Use {@link StandardTableDefinition} to create simple BigQuery
+ * table. Use {@link ViewDefinition} to create a BigQuery view. Use
+ * {@link ExternalTableDefinition} to create a BigQuery a table backed by external data.
+ */
+ public abstract Builder definition(TableDefinition definition);
+
+ /**
+ * Creates a {@code TableInfo} object.
+ */
+ public abstract TableInfo build();
+ }
+
+ static class BuilderImpl extends Builder {
private String etag;
private String id;
@@ -82,9 +127,9 @@ public static class Builder {
private Long lastModifiedTime;
private TableDefinition definition;
- private Builder() {}
+ BuilderImpl() {}
- private Builder(TableInfo tableInfo) {
+ BuilderImpl(TableInfo tableInfo) {
this.etag = tableInfo.etag;
this.id = tableInfo.id;
this.selfLink = tableInfo.selfLink;
@@ -97,7 +142,7 @@ private Builder(TableInfo tableInfo) {
this.definition = tableInfo.definition;
}
- private Builder(Table tablePb) {
+ BuilderImpl(Table tablePb) {
this.tableId = TableId.fromPb(tablePb.getTableReference());
if (tablePb.getLastModifiedTime() != null) {
this.lastModifiedTime(tablePb.getLastModifiedTime().longValue());
@@ -112,83 +157,73 @@ private Builder(Table tablePb) {
this.definition = TableDefinition.fromPb(tablePb);
}
+ @Override
Builder creationTime(Long creationTime) {
this.creationTime = creationTime;
return this;
}
- /**
- * Sets a user-friendly description for the table.
- */
+ @Override
public Builder description(String description) {
this.description = firstNonNull(description, Data.nullOf(String.class));
return this;
}
+ @Override
Builder etag(String etag) {
this.etag = etag;
return this;
}
- /**
- * Sets the time when this table expires, in milliseconds since the epoch. If not present, the
- * table will persist indefinitely. Expired tables will be deleted and their storage reclaimed.
- */
+ @Override
public Builder expirationTime(Long expirationTime) {
this.expirationTime = firstNonNull(expirationTime, Data.nullOf(Long.class));
return this;
}
- /**
- * Sets a user-friendly name for the table.
- */
+ @Override
public Builder friendlyName(String friendlyName) {
this.friendlyName = firstNonNull(friendlyName, Data.nullOf(String.class));
return this;
}
+ @Override
Builder id(String id) {
this.id = id;
return this;
}
+ @Override
Builder lastModifiedTime(Long lastModifiedTime) {
this.lastModifiedTime = lastModifiedTime;
return this;
}
+ @Override
Builder selfLink(String selfLink) {
this.selfLink = selfLink;
return this;
}
- /**
- * Sets the table identity.
- */
+ @Override
public Builder tableId(TableId tableId) {
this.tableId = checkNotNull(tableId);
return this;
}
- /**
- * Sets the table definition. Use {@link StandardTableDefinition} to create simple BigQuery
- * table. Use {@link ViewDefinition} to create a BigQuery view. Use
- * {@link ExternalTableDefinition} to create a BigQuery a table backed by external data.
- */
+ @Override
public Builder definition(TableDefinition definition) {
this.definition = checkNotNull(definition);
return this;
}
- /**
- * Creates a {@code TableInfo} object.
- */
+ @Override
public TableInfo build() {
return new TableInfo(this);
}
}
- private TableInfo(Builder builder) {
+ TableInfo(BuilderImpl builder) {
this.tableId = checkNotNull(builder.tableId);
this.etag = builder.etag;
this.id = builder.id;
@@ -275,13 +310,14 @@ public T definition() {
}
/**
- * Returns a builder for the object.
+ * Returns a builder for the table object.
*/
public Builder toBuilder() {
- return new Builder(this);
+ return new BuilderImpl(this);
}
- ToStringHelper toStringHelper() {
+ @Override
+ public String toString() {
return MoreObjects.toStringHelper(this)
.add("tableId", tableId)
.add("etag", etag)
@@ -292,12 +328,8 @@ ToStringHelper toStringHelper() {
.add("expirationTime", expirationTime)
.add("creationTime", creationTime)
.add("lastModifiedTime", lastModifiedTime)
- .add("definition", definition);
- }
-
- @Override
- public String toString() {
- return toStringHelper().toString();
+ .add("definition", definition)
+ .toString();
}
@Override
@@ -307,18 +339,26 @@ public int hashCode() {
@Override
public boolean equals(Object obj) {
- return obj instanceof TableInfo && Objects.equals(toPb(), ((TableInfo) obj).toPb());
+ return obj != null
+ && obj.getClass().equals(TableInfo.class)
+ && Objects.equals(toPb(), ((TableInfo) obj).toPb());
}
/**
- * Returns a builder for a {@code TableInfo} object given table identity and definition.
+ * Returns a builder for a {@code TableInfo} object given table identity and definition. Use
+ * {@link StandardTableDefinition} to create simple BigQuery table. Use {@link ViewDefinition} to
+ * create a BigQuery view. Use {@link ExternalTableDefinition} to create a BigQuery a table backed
+ * by external data.
*/
public static Builder builder(TableId tableId, TableDefinition definition) {
- return new Builder().tableId(tableId).definition(definition);
+ return new BuilderImpl().tableId(tableId).definition(definition);
}
/**
- * Returns a {@code TableInfo} object given table identity and definition.
+ * Returns a {@code TableInfo} object given table identity and definition. Use
+ * {@link StandardTableDefinition} to create simple BigQuery table. Use {@link ViewDefinition} to
+ * create a BigQuery view. Use {@link ExternalTableDefinition} to create a BigQuery a table backed
+ * by external data.
*/
public static TableInfo of(TableId tableId, TableDefinition definition) {
return builder(tableId, definition).build();
@@ -345,6 +385,6 @@ Table toPb() {
}
static TableInfo fromPb(Table tablePb) {
- return new Builder(tablePb).build();
+ return new BuilderImpl(tablePb).build();
}
}
diff --git a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/ViewDefinition.java b/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/ViewDefinition.java
index 7065bcc155d2..796dd411b4a1 100644
--- a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/ViewDefinition.java
+++ b/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/ViewDefinition.java
@@ -27,8 +27,9 @@
import java.util.Objects;
/**
- * Google BigQuery view table type. BigQuery's views are logical views, not materialized views,
- * which means that the query that defines the view is re-executed every time the view is queried.
+ * Google BigQuery view table definition. BigQuery's views are logical views, not materialized
+ * views, which means that the query that defines the view is re-executed every time the view is
+ * queried.
*
* @see Views
*/
@@ -168,7 +169,7 @@ Table toPb() {
}
/**
- * Returns a builder for a BigQuery view type.
+ * Returns a builder for a BigQuery view definition.
*
* @param query the query used to generate the view
*/
@@ -177,7 +178,7 @@ public static Builder builder(String query) {
}
/**
- * Returns a builder for a BigQuery view type.
+ * Returns a builder for a BigQuery view definition.
*
* @param query the query used to generate the table
* @param functions user-defined functions that can be used by the query
@@ -187,7 +188,7 @@ public static Builder builder(String query, List functions)
}
/**
- * Returns a builder for a BigQuery view type.
+ * Returns a builder for a BigQuery view definition.
*
* @param query the query used to generate the table
* @param functions user-defined functions that can be used by the query
@@ -197,7 +198,7 @@ public static Builder builder(String query, UserDefinedFunction... functions) {
}
/**
- * Creates a BigQuery view type given the query used to generate the table.
+ * Creates a BigQuery view definition given the query used to generate the table.
*
* @param query the query used to generate the table
*/
@@ -206,7 +207,7 @@ public static ViewDefinition of(String query) {
}
/**
- * Creates a BigQuery view type given a query and some user-defined functions.
+ * Creates a BigQuery view definition given a query and some user-defined functions.
*
* @param query the query used to generate the table
* @param functions user-defined functions that can be used by the query
@@ -216,7 +217,7 @@ public static ViewDefinition of(String query, List function
}
/**
- * Creates a BigQuery view type given a query and some user-defined functions.
+ * Creates a BigQuery view definition given a query and some user-defined functions.
*
* @param query the query used to generate the table
* @param functions user-defined functions that can be used by the query
diff --git a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/WriteChannelConfiguration.java b/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/WriteChannelConfiguration.java
index 18342bac1bff..6cc44ce7d5d6 100644
--- a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/WriteChannelConfiguration.java
+++ b/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/WriteChannelConfiguration.java
@@ -155,6 +155,7 @@ public Builder projectionFields(List projectionFields) {
return this;
}
+ @Override
public WriteChannelConfiguration build() {
return new WriteChannelConfiguration(this);
}
diff --git a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/package-info.java b/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/package-info.java
index a249768f9d8d..db5e956e0a12 100644
--- a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/package-info.java
+++ b/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/package-info.java
@@ -17,30 +17,29 @@
/**
* A client to Google Cloud BigQuery.
*
- *
A simple usage example:
+ *
A simple usage example showing how to create a table if it does not exist and load data into
+ * it. For the complete source code see
+ *
+ * CreateTableAndLoadData.java.
*