com.datastax.driver.core.SanityChecks Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cassandra-driver Show documentation
Show all versions of cassandra-driver Show documentation
Shaded version of DataStax Java Driver for Apache Cassandra
/*
* Copyright (C) 2012-2015 DataStax Inc.
*
* 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
*
* http://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.datastax.driver.core;
import com.datastax.driver.$internal.com.google.common.reflect.TypeToken;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.Map;
class SanityChecks {
/**
* Performs a series of runtime checks to ensure the environment does not have any
* incompatible libraries or configurations. Depending on the severity of an
* incompatibility an {@link IllegalStateException} may be thrown or an ERROR or
* WARNING is logged.
*
* @throws IllegalStateException If an environment incompatibility is detected.
* @see #checkGuava
*/
static void check() {
checkGuava();
}
/**
* Detects if a version of guava older than 16.01 is present by attempting to create
* a {@link TypeToken} instance for Map<String,String>
and ensures that the
* value type argument is of instance {@link String}. If using an older version of guava
* this will resolve to {@link Object} instead. In this case an {@link IllegalStateException}
* is thrown.
*
* @throws IllegalStateException if version of guava less than 16.01 is detected.
*/
static void checkGuava() {
boolean resolved = false;
TypeToken
© 2015 - 2024 Weber Informatics LLC | Privacy Policy