// Path: cloud-spanner-r2dbc/src/main/java/com/google/cloud/spanner/r2dbc/SpannerConnectionFactoryMetadata.java
// public class SpannerConnectionFactoryMetadata implements ConnectionFactoryMetadata {
// 
//   /**
//    * The name of Cloud Spanner database product.
//    */
//   public static final String NAME = "Cloud Spanner";
// 
//   public static final SpannerConnectionFactoryMetadata INSTANCE
//       = new SpannerConnectionFactoryMetadata();
// 
//   private SpannerConnectionFactoryMetadata() {
//   }
// 
//   @Override
//   public String getName() {
//     return NAME;
//   }
// 
// }


import com.google.cloud.spanner.r2dbc.SpannerConnectionFactoryMetadata;
import io.r2dbc.spi.ConnectionFactory;
import java.util.Optional;
import org.springframework.data.r2dbc.dialect.DialectResolver.R2dbcDialectProvider;
import org.springframework.data.r2dbc.dialect.R2dbcDialect;
/*
 * Copyright 2019-2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.cloud.spanner.r2dbc.springdata;


/**
 * Provides the {@link SpannerR2dbcDialect} for Spring Data.
 */
public class SpannerR2dbcDialectProvider implements R2dbcDialectProvider {

  @Override
  public Optional<R2dbcDialect> getDialect(ConnectionFactory connectionFactory) {
// Path: cloud-spanner-r2dbc/src/main/java/com/google/cloud/spanner/r2dbc/SpannerConnectionFactoryMetadata.java
// public class SpannerConnectionFactoryMetadata implements ConnectionFactoryMetadata {
// 
//   /**
//    * The name of Cloud Spanner database product.
//    */
//   public static final String NAME = "Cloud Spanner";
// 
//   public static final SpannerConnectionFactoryMetadata INSTANCE
//       = new SpannerConnectionFactoryMetadata();
// 
//   private SpannerConnectionFactoryMetadata() {
//   }
// 
//   @Override
//   public String getName() {
//     return NAME;
//   }
// 
// }


// Path: cloud-spanner-spring-data-r2dbc/src/main/java/com/google/cloud/spanner/r2dbc/springdata/SpannerR2dbcDialectProvider.java
import com.google.cloud.spanner.r2dbc.SpannerConnectionFactoryMetadata;
import io.r2dbc.spi.ConnectionFactory;
import java.util.Optional;
import org.springframework.data.r2dbc.dialect.DialectResolver.R2dbcDialectProvider;
import org.springframework.data.r2dbc.dialect.R2dbcDialect;

/*
 * Copyright 2019-2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.cloud.spanner.r2dbc.springdata;


/**
 * Provides the {@link SpannerR2dbcDialect} for Spring Data.
 */
public class SpannerR2dbcDialectProvider implements R2dbcDialectProvider {

  @Override
  public Optional<R2dbcDialect> getDialect(ConnectionFactory connectionFactory) {
    if (connectionFactory.getMetadata().getName().equals(SpannerConnectionFactoryMetadata.NAME)) {