Search in sources :

Example 1 with Type

use of com.google.cloud.retail.v2.Product.Type in project java-retail by googleapis.

the class SetupCleanup method getGson.

public static Gson getGson() {
    JsonDeserializer<LegacySQLTypeName> typeDeserializer = (jsonElement, type, deserializationContext) -> {
        return LegacySQLTypeName.valueOf(jsonElement.getAsString());
    };
    JsonDeserializer<FieldList> subFieldsDeserializer = (jsonElement, type, deserializationContext) -> {
        Field[] fields = deserializationContext.deserialize(jsonElement.getAsJsonArray(), Field[].class);
        return FieldList.of(fields);
    };
    return new GsonBuilder().registerTypeAdapter(LegacySQLTypeName.class, typeDeserializer).registerTypeAdapter(FieldList.class, subFieldsDeserializer).create();
}
Also used : FormatOptions(com.google.cloud.bigquery.FormatOptions) Arrays(java.util.Arrays) DatasetDeleteOption(com.google.cloud.bigquery.BigQuery.DatasetDeleteOption) StandardTableDefinition(com.google.cloud.bigquery.StandardTableDefinition) NotFoundException(com.google.api.gax.rpc.NotFoundException) TableId(com.google.cloud.bigquery.TableId) STANDARD(com.google.cloud.storage.StorageClass.STANDARD) BigQueryException(com.google.cloud.bigquery.BigQueryException) BlobId(com.google.cloud.storage.BlobId) StorageOptions(com.google.cloud.storage.StorageOptions) DatasetId(com.google.cloud.bigquery.DatasetId) GsonBuilder(com.google.gson.GsonBuilder) BigQuery(com.google.cloud.bigquery.BigQuery) BigQueryOptions(com.google.cloud.bigquery.BigQueryOptions) Dataset(com.google.cloud.bigquery.Dataset) Blob(com.google.cloud.storage.Blob) Gson(com.google.gson.Gson) Schema(com.google.cloud.bigquery.Schema) FulfillmentInfo(com.google.cloud.retail.v2.FulfillmentInfo) Product(com.google.cloud.retail.v2.Product) Job(com.google.cloud.bigquery.Job) LegacySQLTypeName(com.google.cloud.bigquery.LegacySQLTypeName) Field(com.google.cloud.bigquery.Field) TableDefinition(com.google.cloud.bigquery.TableDefinition) DeleteProductRequest(com.google.cloud.retail.v2.DeleteProductRequest) Type(com.google.cloud.retail.v2.Product.Type) Bucket(com.google.cloud.storage.Bucket) Page(com.google.api.gax.paging.Page) Availability(com.google.cloud.retail.v2.Product.Availability) BlobInfo(com.google.cloud.storage.BlobInfo) JobInfo(com.google.cloud.bigquery.JobInfo) LoadJobConfiguration(com.google.cloud.bigquery.LoadJobConfiguration) Files(java.nio.file.Files) BucketInfo(com.google.cloud.storage.BucketInfo) IOException(java.io.IOException) FieldList(com.google.cloud.bigquery.FieldList) GetProductRequest(com.google.cloud.retail.v2.GetProductRequest) Paths(java.nio.file.Paths) CreateProductRequest(com.google.cloud.retail.v2.CreateProductRequest) ProductServiceClient(com.google.cloud.retail.v2.ProductServiceClient) StorageException(com.google.cloud.storage.StorageException) JsonDeserializer(com.google.gson.JsonDeserializer) DatasetInfo(com.google.cloud.bigquery.DatasetInfo) TableInfo(com.google.cloud.bigquery.TableInfo) PriceInfo(com.google.cloud.retail.v2.PriceInfo) Storage(com.google.cloud.storage.Storage) LegacySQLTypeName(com.google.cloud.bigquery.LegacySQLTypeName) GsonBuilder(com.google.gson.GsonBuilder) FieldList(com.google.cloud.bigquery.FieldList)

Aggregations

Page (com.google.api.gax.paging.Page)1 NotFoundException (com.google.api.gax.rpc.NotFoundException)1 BigQuery (com.google.cloud.bigquery.BigQuery)1 DatasetDeleteOption (com.google.cloud.bigquery.BigQuery.DatasetDeleteOption)1 BigQueryException (com.google.cloud.bigquery.BigQueryException)1 BigQueryOptions (com.google.cloud.bigquery.BigQueryOptions)1 Dataset (com.google.cloud.bigquery.Dataset)1 DatasetId (com.google.cloud.bigquery.DatasetId)1 DatasetInfo (com.google.cloud.bigquery.DatasetInfo)1 Field (com.google.cloud.bigquery.Field)1 FieldList (com.google.cloud.bigquery.FieldList)1 FormatOptions (com.google.cloud.bigquery.FormatOptions)1 Job (com.google.cloud.bigquery.Job)1 JobInfo (com.google.cloud.bigquery.JobInfo)1 LegacySQLTypeName (com.google.cloud.bigquery.LegacySQLTypeName)1 LoadJobConfiguration (com.google.cloud.bigquery.LoadJobConfiguration)1 Schema (com.google.cloud.bigquery.Schema)1 StandardTableDefinition (com.google.cloud.bigquery.StandardTableDefinition)1 TableDefinition (com.google.cloud.bigquery.TableDefinition)1 TableId (com.google.cloud.bigquery.TableId)1