DATACASS-764 - Delombok source files.

This commit is contained in:
Mark Paluch
2020-05-14 16:30:34 +02:00
parent 1c4b675a36
commit 3f8b0a7335
121 changed files with 1162 additions and 565 deletions

View File

@@ -15,7 +15,6 @@
*/
package org.springframework.data.cassandra.config;
import lombok.RequiredArgsConstructor;
import java.util.ArrayList;
import java.util.HashMap;
@@ -41,7 +40,6 @@ import com.datastax.oss.driver.api.core.CqlIdentifier;
* @author Mark Paluch
* @since 2.0
*/
@RequiredArgsConstructor
class KeyspaceActionSpecificationFactory {
private final CqlIdentifier name;
@@ -54,6 +52,16 @@ class KeyspaceActionSpecificationFactory {
private final boolean durableWrites;
KeyspaceActionSpecificationFactory(CqlIdentifier name, List<DataCenterReplication> replications,
ReplicationStrategy replicationStrategy, long replicationFactor, boolean durableWrites) {
this.name = name;
this.replications = replications;
this.replicationStrategy = replicationStrategy;
this.replicationFactor = replicationFactor;
this.durableWrites = durableWrites;
}
/**
* Create a new {@link KeyspaceActionSpecificationFactoryBuilder} to configure a new
* {@link KeyspaceActionSpecificationFactory}.

View File

@@ -15,12 +15,11 @@
*/
package org.springframework.data.cassandra.config;
import lombok.Value;
import java.util.Arrays;
import java.util.List;
import org.springframework.data.cassandra.core.cql.keyspace.KeyspaceActionSpecification;
import org.springframework.util.ObjectUtils;
/**
* Collection of {@link KeyspaceActionSpecification}s. Wraps none, one or multiple keyspace actions (creates, drops).
@@ -28,8 +27,7 @@ import org.springframework.data.cassandra.core.cql.keyspace.KeyspaceActionSpecif
* @author Mark Paluch
* @since 2.0
*/
@Value
public class KeyspaceActions {
public final class KeyspaceActions {
private final List<KeyspaceActionSpecification> actions;
@@ -40,4 +38,45 @@ public class KeyspaceActions {
public KeyspaceActions(List<KeyspaceActionSpecification> actions) {
this.actions = actions;
}
public List<KeyspaceActionSpecification> getActions() {
return this.actions;
}
/*
* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof KeyspaceActions)) {
return false;
}
KeyspaceActions that = (KeyspaceActions) o;
return ObjectUtils.nullSafeEquals(actions, that.actions);
}
/*
* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public int hashCode() {
return ObjectUtils.nullSafeHashCode(actions);
}
/*
* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "KeyspaceActions(actions=" + this.getActions() + ")";
}
}

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.cassandra.core;
import lombok.Value;
import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;
@@ -929,16 +927,16 @@ public class AsyncCassandraTemplate
}
}
@Value
class AsyncStatementCallback implements AsyncSessionCallback<AsyncResultSet>, CqlProvider {
@lombok.NonNull SimpleStatement statement;
SimpleStatement statement;
AsyncStatementCallback(SimpleStatement statement) {
this.statement = statement;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
* @see org.springframework.data.cassandra.core.cql.AsyncSessionCallback#doInSession(com.datastax.oss.driver.api.core.CqlSession)
*/
@Override
@@ -949,7 +947,8 @@ public class AsyncCassandraTemplate
: exceptionTranslator.translateExceptionIfPossible(e));
}
/* (non-Javadoc)
/*
* (non-Javadoc)
* @see org.springframework.data.cassandra.core.cql.CqlProvider#getCql()
*/
@Override

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.cassandra.core;
import lombok.Value;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Function;
@@ -964,12 +962,16 @@ public class CassandraTemplate implements CassandraOperations, ApplicationEventP
return object;
}
@Value
static class StatementCallback implements SessionCallback<WriteResult>, CqlProvider {
@lombok.NonNull SimpleStatement statement;
private final SimpleStatement statement;
/* (non-Javadoc)
StatementCallback(SimpleStatement statement) {
this.statement = statement;
}
/*
* (non-Javadoc)
* @see org.springframework.data.cassandra.core.cql.SessionCallback#doInSession(org.springframework.data.cassandra.Session)
*/
@Override
@@ -977,7 +979,8 @@ public class CassandraTemplate implements CassandraOperations, ApplicationEventP
return WriteResult.of(session.execute(this.statement));
}
/* (non-Javadoc)
/*
* (non-Javadoc)
* @see org.springframework.data.cassandra.core.cql.CqlProvider#getCql()
*/
@Override

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.cassandra.core;
import lombok.EqualsAndHashCode;
import java.time.Duration;
import java.time.Instant;
import java.util.concurrent.TimeUnit;
@@ -27,6 +25,7 @@ import org.springframework.data.cassandra.core.query.CriteriaDefinition;
import org.springframework.data.cassandra.core.query.Filter;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import com.datastax.oss.driver.api.core.ConsistencyLevel;
@@ -36,7 +35,6 @@ import com.datastax.oss.driver.api.core.ConsistencyLevel;
* @author Mark Paluch
* @since 2.2
*/
@EqualsAndHashCode(callSuper = true)
public class DeleteOptions extends WriteOptions {
private static final DeleteOptions EMPTY = new DeleteOptionsBuilder().build();
@@ -99,6 +97,45 @@ public class DeleteOptions extends WriteOptions {
return ifCondition;
}
/*
* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof DeleteOptions)) {
return false;
}
if (!super.equals(o)) {
return false;
}
DeleteOptions that = (DeleteOptions) o;
if (ifExists != that.ifExists) {
return false;
}
return ObjectUtils.nullSafeEquals(ifCondition, that.ifCondition);
}
/*
* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (ifExists ? 1 : 0);
result = 31 * result + ObjectUtils.nullSafeHashCode(ifCondition);
return result;
}
/**
* Builder for {@link DeleteOptions}.
*

View File

@@ -15,11 +15,6 @@
*/
package org.springframework.data.cassandra.core;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import org.springframework.core.convert.ConversionService;
import org.springframework.data.cassandra.core.cql.util.StatementBuilder;
import org.springframework.data.cassandra.core.mapping.CassandraPersistentEntity;
@@ -46,10 +41,14 @@ import com.datastax.oss.driver.api.querybuilder.update.Update;
* @see ReactiveCassandraTemplate
* @since 2.2
*/
@RequiredArgsConstructor
class EntityOperations {
@NonNull @Getter(AccessLevel.PROTECTED) private final MappingContext<? extends CassandraPersistentEntity<?>, CassandraPersistentProperty> mappingContext;
private final MappingContext<? extends CassandraPersistentEntity<?>, CassandraPersistentProperty> mappingContext;
public EntityOperations(
MappingContext<? extends CassandraPersistentEntity<?>, CassandraPersistentProperty> mappingContext) {
this.mappingContext = mappingContext;
}
/**
* Creates a new {@link Entity} for the given bean.
@@ -100,6 +99,11 @@ class EntityOperations {
return getRequiredPersistentEntity(entityClass).getTableName();
}
protected MappingContext<? extends CassandraPersistentEntity<?>, CassandraPersistentProperty> getMappingContext() {
return this.mappingContext;
}
/**
* A representation of information about an entity.
*/
@@ -196,11 +200,15 @@ class EntityOperations {
}
@RequiredArgsConstructor(access = AccessLevel.PROTECTED)
private static class MappedEntity<T> implements Entity<T> {
private final @NonNull CassandraPersistentEntity<?> entity;
private final @NonNull PersistentPropertyAccessor<T> propertyAccessor;
private final CassandraPersistentEntity<?> entity;
private final PersistentPropertyAccessor<T> propertyAccessor;
protected MappedEntity(CassandraPersistentEntity<?> entity, PersistentPropertyAccessor<T> propertyAccessor) {
this.entity = entity;
this.propertyAccessor = propertyAccessor;
}
private static <T> MappedEntity<T> of(T bean,
MappingContext<? extends CassandraPersistentEntity<?>, CassandraPersistentProperty> context) {

View File

@@ -15,11 +15,6 @@
*/
package org.springframework.data.cassandra.core;
import lombok.AccessLevel;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.experimental.FieldDefaults;
import org.springframework.data.cassandra.core.query.Query;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
@@ -34,10 +29,13 @@ import com.datastax.oss.driver.api.core.CqlIdentifier;
* @see org.springframework.data.cassandra.core.query.Query
* @since 2.1
*/
@RequiredArgsConstructor
class ExecutableDeleteOperationSupport implements ExecutableDeleteOperation {
private final @NonNull CassandraTemplate template;
private final CassandraTemplate template;
public ExecutableDeleteOperationSupport(CassandraTemplate template) {
this.template = template;
}
/* (non-Javadoc)
* @see org.springframework.data.cassandra.core.ExecutableDeleteOperation#remove(java.lang.Class)
@@ -50,17 +48,23 @@ class ExecutableDeleteOperationSupport implements ExecutableDeleteOperation {
return new ExecutableDeleteSupport(this.template, domainType, Query.empty(), null);
}
@RequiredArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
static class ExecutableDeleteSupport implements ExecutableDelete, TerminatingDelete {
@NonNull CassandraTemplate template;
private final CassandraTemplate template;
@NonNull Class<?> domainType;
private final Class<?> domainType;
@NonNull Query query;
private final Query query;
@Nullable CqlIdentifier tableName;
@Nullable private final CqlIdentifier tableName;
public ExecutableDeleteSupport(CassandraTemplate template, Class<?> domainType, Query query,
CqlIdentifier tableName) {
this.template = template;
this.domainType = domainType;
this.query = query;
this.tableName = tableName;
}
/* (non-Javadoc)
* @see org.springframework.data.cassandra.core.ExecutableDeleteOperation.DeleteWithTable#inTable(org.springframework.data.cassandra.core.cql.CqlIdentifier)

View File

@@ -15,10 +15,6 @@
*/
package org.springframework.data.cassandra.core;
import lombok.AccessLevel;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.experimental.FieldDefaults;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
@@ -32,10 +28,13 @@ import com.datastax.oss.driver.api.core.CqlIdentifier;
* @see org.springframework.data.cassandra.core.ExecutableInsertOperation
* @since 2.1
*/
@RequiredArgsConstructor
class ExecutableInsertOperationSupport implements ExecutableInsertOperation {
private final @NonNull CassandraTemplate template;
private final CassandraTemplate template;
ExecutableInsertOperationSupport(CassandraTemplate template) {
this.template = template;
}
/* (non-Javadoc)
* @see org.springframework.data.cassandra.core.ExecutableInsertOperation#insert(java.lang.Class)
@@ -48,17 +47,23 @@ class ExecutableInsertOperationSupport implements ExecutableInsertOperation {
return new ExecutableInsertSupport<>(this.template, domainType, InsertOptions.empty(), null);
}
@RequiredArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
static class ExecutableInsertSupport<T> implements ExecutableInsert<T> {
@NonNull CassandraTemplate template;
private final CassandraTemplate template;
@NonNull Class<T> domainType;
private final Class<T> domainType;
@NonNull InsertOptions insertOptions;
private final InsertOptions insertOptions;
@Nullable CqlIdentifier tableName;
@Nullable private final CqlIdentifier tableName;
public ExecutableInsertSupport(CassandraTemplate template, Class<T> domainType, InsertOptions insertOptions,
CqlIdentifier tableName) {
this.template = template;
this.domainType = domainType;
this.insertOptions = insertOptions;
this.tableName = tableName;
}
/* (non-Javadoc)
* @see org.springframework.data.cassandra.core.ExecutableInsertOperation.InsertWithTable#inTable(org.springframework.data.cassandra.core.cql.CqlIdentifier)

View File

@@ -15,11 +15,6 @@
*/
package org.springframework.data.cassandra.core;
import lombok.AccessLevel;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.experimental.FieldDefaults;
import java.util.List;
import java.util.stream.Stream;
@@ -39,10 +34,13 @@ import com.datastax.oss.driver.api.core.CqlIdentifier;
* @see org.springframework.data.cassandra.core.query.Query
* @since 2.1
*/
@RequiredArgsConstructor
class ExecutableSelectOperationSupport implements ExecutableSelectOperation {
private final @NonNull CassandraTemplate template;
private final CassandraTemplate template;
public ExecutableSelectOperationSupport(CassandraTemplate template) {
this.template = template;
}
/* (non-Javadoc)
* @see org.springframework.data.cassandra.core.ExecutableSelectOperation#query(java.lang.Class)
@@ -55,19 +53,26 @@ class ExecutableSelectOperationSupport implements ExecutableSelectOperation {
return new ExecutableSelectSupport<>(this.template, domainType, domainType, Query.empty(), null);
}
@RequiredArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
static class ExecutableSelectSupport<T> implements ExecutableSelect<T> {
@NonNull CassandraTemplate template;
private final CassandraTemplate template;
@NonNull Class<?> domainType;
private final Class<?> domainType;
@NonNull Class<T> returnType;
private final Class<T> returnType;
@NonNull Query query;
private final Query query;
@Nullable CqlIdentifier tableName;
private final @Nullable CqlIdentifier tableName;
public ExecutableSelectSupport(CassandraTemplate template, Class<?> domainType, Class<T> returnType, Query query,
CqlIdentifier tableName) {
this.template = template;
this.domainType = domainType;
this.returnType = returnType;
this.query = query;
this.tableName = tableName;
}
/* (non-Javadoc)
* @see org.springframework.data.cassandra.core.ExecutableSelectOperation.SelectWithTable#inTable(org.springframework.data.cassandra.core.cql.CqlIdentifier)

View File

@@ -15,11 +15,6 @@
*/
package org.springframework.data.cassandra.core;
import lombok.AccessLevel;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.experimental.FieldDefaults;
import org.springframework.data.cassandra.core.query.Query;
import org.springframework.data.cassandra.core.query.Update;
import org.springframework.lang.Nullable;
@@ -36,10 +31,13 @@ import com.datastax.oss.driver.api.core.CqlIdentifier;
* @see org.springframework.data.cassandra.core.query.Update
* @since 2.1
*/
@RequiredArgsConstructor
class ExecutableUpdateOperationSupport implements ExecutableUpdateOperation {
private final @NonNull CassandraTemplate template;
private final CassandraTemplate template;
public ExecutableUpdateOperationSupport(CassandraTemplate template) {
this.template = template;
}
/* (non-Javadoc)
* @see org.springframework.data.cassandra.core.ExecutableUpdateOperation#update(java.lang.Class)
@@ -52,17 +50,23 @@ class ExecutableUpdateOperationSupport implements ExecutableUpdateOperation {
return new ExecutableUpdateSupport(this.template, domainType, Query.empty(), null);
}
@RequiredArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
static class ExecutableUpdateSupport implements ExecutableUpdate, TerminatingUpdate {
@NonNull CassandraTemplate template;
private final CassandraTemplate template;
@NonNull Class<?> domainType;
private final Class<?> domainType;
@NonNull Query query;
private final Query query;
@Nullable CqlIdentifier tableName;
private final @Nullable CqlIdentifier tableName;
public ExecutableUpdateSupport(CassandraTemplate template, Class<?> domainType, Query query,
CqlIdentifier tableName) {
this.template = template;
this.domainType = domainType;
this.query = query;
this.tableName = tableName;
}
/* (non-Javadoc)
* @see org.springframework.data.cassandra.core.ExecutableUpdateOperation.UpdateWithTable#inTable(org.springframework.data.cassandra.core.cql.CqlIdentifier)

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.cassandra.core;
import lombok.EqualsAndHashCode;
import java.time.Duration;
import java.time.Instant;
import java.util.concurrent.TimeUnit;
@@ -34,7 +32,6 @@ import com.datastax.oss.driver.api.core.ConsistencyLevel;
* @author Lukasz Antoniak
* @since 2.0
*/
@EqualsAndHashCode(callSuper = true)
public class InsertOptions extends WriteOptions {
private static final InsertOptions EMPTY = new InsertOptionsBuilder().build();
@@ -98,6 +95,46 @@ public class InsertOptions extends WriteOptions {
return this.insertNulls;
}
/*
* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof InsertOptions)) {
return false;
}
if (!super.equals(o)) {
return false;
}
InsertOptions that = (InsertOptions) o;
if (ifNotExists != that.ifNotExists) {
return false;
}
return insertNulls == that.insertNulls;
}
/*
* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (ifNotExists ? 1 : 0);
result = 31 * result + (insertNulls ? 1 : 0);
return result;
}
/**
* Builder for {@link InsertOptions}.
*

View File

@@ -15,7 +15,6 @@
*/
package org.springframework.data.cassandra.core;
import lombok.Value;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.core.publisher.SynchronousSink;
@@ -914,12 +913,16 @@ public class ReactiveCassandraTemplate
return Mono.just(object);
}
@Value
static class StatementCallback implements ReactiveSessionCallback<WriteResult>, CqlProvider {
@lombok.NonNull SimpleStatement statement;
private final SimpleStatement statement;
/* (non-Javadoc)
StatementCallback(SimpleStatement statement) {
this.statement = statement;
}
/*
* (non-Javadoc)
* @see org.springframework.data.cassandra.core.cql.ReactiveSessionCallback#doInSession(org.springframework.data.cassandra.ReactiveSession)
*/
@Override
@@ -927,7 +930,8 @@ public class ReactiveCassandraTemplate
return session.execute(this.statement).flatMap(StatementCallback::toWriteResult);
}
/* (non-Javadoc)
/*
* (non-Javadoc)
* @see org.springframework.data.cassandra.core.cql.CqlProvider#getCql()
*/
@Override

View File

@@ -15,10 +15,6 @@
*/
package org.springframework.data.cassandra.core;
import lombok.AccessLevel;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.experimental.FieldDefaults;
import reactor.core.publisher.Mono;
import org.springframework.data.cassandra.core.query.Query;
@@ -35,10 +31,13 @@ import com.datastax.oss.driver.api.core.CqlIdentifier;
* @see org.springframework.data.cassandra.core.query.Query
* @since 2.1
*/
@RequiredArgsConstructor
class ReactiveDeleteOperationSupport implements ReactiveDeleteOperation {
private final @NonNull ReactiveCassandraTemplate template;
private final ReactiveCassandraTemplate template;
public ReactiveDeleteOperationSupport(ReactiveCassandraTemplate template) {
this.template = template;
}
/* (non-Javadoc)
* @see org.springframework.data.cassandra.core.ReactiveDeleteOperation#remove(java.lang.Class)
@@ -51,17 +50,23 @@ class ReactiveDeleteOperationSupport implements ReactiveDeleteOperation {
return new ReactiveDeleteSupport(this.template, domainType, Query.empty(), null);
}
@RequiredArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
static class ReactiveDeleteSupport implements ReactiveDelete, TerminatingDelete {
@NonNull ReactiveCassandraTemplate template;
private final ReactiveCassandraTemplate template;
@NonNull Class<?> domainType;
private final Class<?> domainType;
@NonNull Query query;
private final Query query;
@Nullable CqlIdentifier tableName;
private final @Nullable CqlIdentifier tableName;
public ReactiveDeleteSupport(ReactiveCassandraTemplate template, Class<?> domainType, Query query,
CqlIdentifier tableName) {
this.template = template;
this.domainType = domainType;
this.query = query;
this.tableName = tableName;
}
/* (non-Javadoc)
* @see org.springframework.data.cassandra.core.ReactiveDeleteOperation.DeleteWithTable#inTable(org.springframework.data.cassandra.core.cql.CqlIdentifier)

View File

@@ -15,10 +15,6 @@
*/
package org.springframework.data.cassandra.core;
import lombok.AccessLevel;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.experimental.FieldDefaults;
import reactor.core.publisher.Mono;
import org.springframework.lang.Nullable;
@@ -32,10 +28,13 @@ import com.datastax.oss.driver.api.core.CqlIdentifier;
* @author Mark Paluch
* @since 2.1
*/
@RequiredArgsConstructor
class ReactiveInsertOperationSupport implements ReactiveInsertOperation {
private final @NonNull ReactiveCassandraTemplate template;
private final ReactiveCassandraTemplate template;
public ReactiveInsertOperationSupport(ReactiveCassandraTemplate template) {
this.template = template;
}
/* (non-Javadoc)
* @see org.springframework.data.cassandra.core.ReactiveInsertOperation#insert(java.lang.Class)
@@ -48,17 +47,23 @@ class ReactiveInsertOperationSupport implements ReactiveInsertOperation {
return new ReactiveInsertSupport<>(this.template, domainType, InsertOptions.empty(), null);
}
@RequiredArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
static class ReactiveInsertSupport<T> implements ReactiveInsert<T> {
@NonNull ReactiveCassandraTemplate template;
private final ReactiveCassandraTemplate template;
@NonNull Class<T> domainType;
private final Class<T> domainType;
@NonNull InsertOptions insertOptions;
private final InsertOptions insertOptions;
@Nullable CqlIdentifier tableName;
private final @Nullable CqlIdentifier tableName;
public ReactiveInsertSupport(ReactiveCassandraTemplate template, Class<T> domainType, InsertOptions insertOptions,
CqlIdentifier tableName) {
this.template = template;
this.domainType = domainType;
this.insertOptions = insertOptions;
this.tableName = tableName;
}
/* (non-Javadoc)
* @see org.springframework.data.cassandra.core.ReactiveInsertOperation.InsertWithTable#inTable(org.springframework.data.cassandra.core.cql.CqlIdentifier)

View File

@@ -15,10 +15,6 @@
*/
package org.springframework.data.cassandra.core;
import lombok.AccessLevel;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.experimental.FieldDefaults;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -37,10 +33,13 @@ import com.datastax.oss.driver.api.core.CqlIdentifier;
* @see org.springframework.data.cassandra.core.query.Query
* @since 2.1
*/
@RequiredArgsConstructor
class ReactiveSelectOperationSupport implements ReactiveSelectOperation {
private final @NonNull ReactiveCassandraTemplate template;
private final ReactiveCassandraTemplate template;
public ReactiveSelectOperationSupport(ReactiveCassandraTemplate template) {
this.template = template;
}
/* (non-Javadoc)
* @see org.springframework.data.cassandra.core.ReactiveSelectOperation#query(java.lang.Class)
@@ -53,19 +52,26 @@ class ReactiveSelectOperationSupport implements ReactiveSelectOperation {
return new ReactiveSelectSupport<>(this.template, domainType, domainType, Query.empty(), null);
}
@RequiredArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
static class ReactiveSelectSupport<T> implements ReactiveSelect<T> {
@NonNull ReactiveCassandraTemplate template;
private final ReactiveCassandraTemplate template;
@NonNull Class<?> domainType;
private final Class<?> domainType;
@NonNull Class<T> returnType;
private final Class<T> returnType;
@NonNull Query query;
private final Query query;
@Nullable CqlIdentifier tableName;
private final @Nullable CqlIdentifier tableName;
public ReactiveSelectSupport(ReactiveCassandraTemplate template, Class<?> domainType, Class<T> returnType,
Query query, CqlIdentifier tableName) {
this.template = template;
this.domainType = domainType;
this.returnType = returnType;
this.query = query;
this.tableName = tableName;
}
/* (non-Javadoc)
* @see org.springframework.data.cassandra.core.ReactiveSelectOperation.SelectWithTable#inTable(org.springframework.data.cassandra.core.cql.CqlIdentifier)

View File

@@ -15,10 +15,6 @@
*/
package org.springframework.data.cassandra.core;
import lombok.AccessLevel;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.experimental.FieldDefaults;
import reactor.core.publisher.Mono;
import org.springframework.data.cassandra.core.query.Query;
@@ -37,10 +33,13 @@ import com.datastax.oss.driver.api.core.CqlIdentifier;
* @see org.springframework.data.cassandra.core.query.Update
* @since 2.1
*/
@RequiredArgsConstructor
class ReactiveUpdateOperationSupport implements ReactiveUpdateOperation {
private final @NonNull ReactiveCassandraTemplate template;
private final ReactiveCassandraTemplate template;
public ReactiveUpdateOperationSupport(ReactiveCassandraTemplate template) {
this.template = template;
}
/* (non-Javadoc)
* @see org.springframework.data.cassandra.core.ReactiveUpdateOperation#update(java.lang.Class)
@@ -53,17 +52,23 @@ class ReactiveUpdateOperationSupport implements ReactiveUpdateOperation {
return new ReactiveUpdateSupport(this.template, domainType, Query.empty(), null);
}
@RequiredArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
static class ReactiveUpdateSupport implements ReactiveUpdate, TerminatingUpdate {
@NonNull ReactiveCassandraTemplate template;
private final ReactiveCassandraTemplate template;
@NonNull Class<?> domainType;
private final Class<?> domainType;
@NonNull Query query;
private final Query query;
@Nullable CqlIdentifier tableName;
private final @Nullable CqlIdentifier tableName;
public ReactiveUpdateSupport(ReactiveCassandraTemplate template, Class<?> domainType, Query query,
CqlIdentifier tableName) {
this.template = template;
this.domainType = domainType;
this.query = query;
this.tableName = tableName;
}
/* (non-Javadoc)
* @see org.springframework.data.cassandra.core.ReactiveUpdateOperation.UpdateWithTable#inTable(org.springframework.data.cassandra.core.cql.CqlIdentifier)

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.cassandra.core;
import lombok.EqualsAndHashCode;
import java.time.Duration;
import java.time.Instant;
import java.util.concurrent.TimeUnit;
@@ -27,6 +25,7 @@ import org.springframework.data.cassandra.core.query.CriteriaDefinition;
import org.springframework.data.cassandra.core.query.Filter;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import com.datastax.oss.driver.api.core.ConsistencyLevel;
@@ -37,7 +36,6 @@ import com.datastax.oss.driver.api.core.ConsistencyLevel;
* @author Lukasz Antoniak
* @since 2.0
*/
@EqualsAndHashCode(callSuper = true)
public class UpdateOptions extends WriteOptions {
private static final UpdateOptions EMPTY = new UpdateOptionsBuilder().build();
@@ -102,6 +100,46 @@ public class UpdateOptions extends WriteOptions {
return ifCondition;
}
/*
* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof UpdateOptions)) {
return false;
}
if (!super.equals(o)) {
return false;
}
UpdateOptions that = (UpdateOptions) o;
if (ifExists != that.ifExists) {
return false;
}
return ObjectUtils.nullSafeEquals(ifCondition, that.ifCondition);
}
/*
* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (ifExists ? 1 : 0);
result = 31 * result + ObjectUtils.nullSafeHashCode(ifCondition);
return result;
}
/**
* Builder for {@link UpdateOptions}.
*

View File

@@ -15,7 +15,6 @@
*/
package org.springframework.data.cassandra.core.convert;
import lombok.NonNull;
import java.util.Collections;
@@ -66,7 +65,7 @@ public abstract class AbstractCassandraConverter implements CassandraConverter,
this.instantiators = instantiators;
}
@NonNull
@Override
public ConversionService getConversionService() {
return this.conversionService;

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.cassandra.core.convert;
import lombok.AllArgsConstructor;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -27,6 +25,7 @@ import java.util.function.Function;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanClassLoaderAware;
import org.springframework.context.ApplicationContext;
@@ -1156,11 +1155,14 @@ public class MappingCassandraConverter extends AbstractCassandraConverter
* @author Mark Paluch
* @since 1.5.1
*/
@AllArgsConstructor
class MappingAndConvertingValueProvider implements CassandraValueProvider {
private final CassandraValueProvider parent;
public MappingAndConvertingValueProvider(CassandraValueProvider parent) {
this.parent = parent;
}
/* (non-Javadoc)
* @see org.springframework.data.cassandra.core.convert.CassandraValueProvider#hasProperty(org.springframework.data.cassandra.core.mapping.CassandraPersistentProperty)
*/

View File

@@ -15,12 +15,12 @@
*/
package org.springframework.data.cassandra.core.cql;
import org.springframework.lang.Nullable;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.driver.api.core.cql.BoundStatement;
import com.datastax.oss.driver.api.core.cql.PreparedStatement;
import org.springframework.lang.Nullable;
/**
* Simple adapter for {@link PreparedStatementBinder} that applies a given array of arguments.
*

View File

@@ -18,16 +18,16 @@ package org.springframework.data.cassandra.core.cql;
import java.util.List;
import java.util.Map;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.IncorrectResultSizeDataAccessException;
import org.springframework.lang.Nullable;
import org.springframework.util.concurrent.ListenableFuture;
import com.datastax.oss.driver.api.core.cql.AsyncResultSet;
import com.datastax.oss.driver.api.core.cql.PreparedStatement;
import com.datastax.oss.driver.api.core.cql.ResultSet;
import com.datastax.oss.driver.api.core.cql.Statement;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.IncorrectResultSizeDataAccessException;
import org.springframework.lang.Nullable;
import org.springframework.util.concurrent.ListenableFuture;
/**
* Interface specifying a basic set of CQL asynchronously executed operations. Exposes similar methods as
* {@link CqlTemplate}, but returns result handles or accepts callbacks as opposed to concrete results. Implemented by

View File

@@ -22,6 +22,13 @@ import java.util.concurrent.CompletionStage;
import java.util.concurrent.ExecutionException;
import java.util.function.Function;
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.driver.api.core.cql.AsyncResultSet;
import com.datastax.oss.driver.api.core.cql.PreparedStatement;
import com.datastax.oss.driver.api.core.cql.ResultSet;
import com.datastax.oss.driver.api.core.cql.Statement;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.support.DataAccessUtils;
import org.springframework.dao.support.PersistenceExceptionTranslator;
@@ -32,13 +39,6 @@ import org.springframework.util.Assert;
import org.springframework.util.concurrent.ListenableFuture;
import org.springframework.util.concurrent.SettableListenableFuture;
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.driver.api.core.cql.AsyncResultSet;
import com.datastax.oss.driver.api.core.cql.PreparedStatement;
import com.datastax.oss.driver.api.core.cql.ResultSet;
import com.datastax.oss.driver.api.core.cql.Statement;
/**
* <b>This is the central class in the CQL core package for asynchronous Cassandra data access.</b> It simplifies the
* use of CQL and helps to avoid common errors. It executes core CQL workflow, leaving application code to provide CQL

View File

@@ -15,12 +15,12 @@
*/
package org.springframework.data.cassandra.core.cql;
import org.springframework.util.concurrent.ListenableFuture;
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.driver.api.core.cql.PreparedStatement;
import org.springframework.util.concurrent.ListenableFuture;
/**
* One of the two central callback interfaces used by the {@link AsyncCqlTemplate} class. This interface prepares a CQL
* statement returning a {@link org.springframework.util.concurrent.ListenableFuture} given a {@link CqlSession},

View File

@@ -15,13 +15,13 @@
*/
package org.springframework.data.cassandra.core.cql;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.driver.api.core.cql.AsyncResultSet;
import org.springframework.dao.DataAccessException;
import org.springframework.lang.Nullable;
import org.springframework.util.concurrent.ListenableFuture;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.driver.api.core.cql.AsyncResultSet;
/**
* Callback interface used by {@link AsyncCqlTemplate}'s query methods. Implementations of this interface perform the
* actual work of extracting results from a {@link AsyncResultSet}, but don't need to worry about exception handling.

View File

@@ -20,13 +20,13 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Consumer;
import java.util.stream.Collector;
import com.datastax.oss.driver.api.core.cql.AsyncResultSet;
import com.datastax.oss.driver.api.core.cql.Row;
import org.springframework.util.Assert;
import org.springframework.util.concurrent.ListenableFuture;
import org.springframework.util.concurrent.SettableListenableFuture;
import com.datastax.oss.driver.api.core.cql.AsyncResultSet;
import com.datastax.oss.driver.api.core.cql.Row;
/**
* Asynchronous supplied sequence of elements supporting sequential operations over a {@link AsyncResultSet a result
* set}. An asynchronous stream represents a pipeline of operations to process a {@link AsyncResultSet}.

View File

@@ -18,13 +18,13 @@ package org.springframework.data.cassandra.core.cql;
import java.util.List;
import java.util.stream.Collectors;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.driver.api.core.cql.AsyncResultSet;
import org.springframework.dao.DataAccessException;
import org.springframework.util.Assert;
import org.springframework.util.concurrent.ListenableFuture;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.driver.api.core.cql.AsyncResultSet;
/**
* Adapter implementation of the {@link ResultSetExtractor} interface that delegates to a {@link RowMapper} which is
* supposed to create an object for each row. Each object is added to the results List of this

View File

@@ -15,12 +15,12 @@
*/
package org.springframework.data.cassandra.core.cql;
import org.springframework.dao.DataAccessException;
import org.springframework.util.concurrent.ListenableFuture;
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.DriverException;
import org.springframework.dao.DataAccessException;
import org.springframework.util.concurrent.ListenableFuture;
/**
* Generic callback interface for code that operates asynchronously on a Cassandra {@link CqlSession}. Allows to execute
* any number of operations on a single session, using any type and number of statements.

View File

@@ -18,15 +18,14 @@ package org.springframework.data.cassandra.core.cql;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.Assert;
import com.datastax.oss.driver.api.core.CqlIdentifier;
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.driver.api.core.cql.PreparedStatement;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.Assert;
/**
* This {@link PreparedStatementCreator} maintains a static cache of all prepared statements for the duration of the JVM

View File

@@ -18,6 +18,11 @@ package org.springframework.data.cassandra.core.cql;
import java.util.Map;
import java.util.Optional;
import com.datastax.oss.driver.api.core.ConsistencyLevel;
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.cql.SimpleStatement;
import com.datastax.oss.driver.api.core.cql.Statement;
import com.datastax.oss.driver.api.core.retry.RetryPolicy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -28,12 +33,6 @@ import org.springframework.data.cassandra.core.cql.session.DefaultSessionFactory
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import com.datastax.oss.driver.api.core.ConsistencyLevel;
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.cql.SimpleStatement;
import com.datastax.oss.driver.api.core.cql.Statement;
import com.datastax.oss.driver.api.core.retry.RetryPolicy;
/**
* {@link CassandraAccessor} provides access to a Cassandra {@link SessionFactory} and the
* {@link CassandraExceptionTranslator}.

View File

@@ -21,6 +21,12 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import com.datastax.oss.driver.api.core.AllNodesFailedException;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.driver.api.core.auth.AuthenticationException;
import com.datastax.oss.driver.api.core.metadata.Node;
import com.datastax.oss.driver.api.core.servererrors.*;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.DataAccessResourceFailureException;
import org.springframework.dao.TransientDataAccessResourceException;
@@ -30,12 +36,6 @@ import org.springframework.lang.Nullable;
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;
import com.datastax.oss.driver.api.core.AllNodesFailedException;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.driver.api.core.auth.AuthenticationException;
import com.datastax.oss.driver.api.core.metadata.Node;
import com.datastax.oss.driver.api.core.servererrors.*;
/**
* Simple {@link PersistenceExceptionTranslator} for Cassandra.
* <p>

View File

@@ -17,13 +17,13 @@ package org.springframework.data.cassandra.core.cql;
import java.util.Map;
import org.springframework.lang.Nullable;
import org.springframework.util.LinkedCaseInsensitiveMap;
import com.datastax.oss.driver.api.core.cql.ColumnDefinition;
import com.datastax.oss.driver.api.core.cql.ColumnDefinitions;
import com.datastax.oss.driver.api.core.cql.Row;
import org.springframework.lang.Nullable;
import org.springframework.util.LinkedCaseInsensitiveMap;
/**
* {@link RowMapper} implementation that creates a {@code java.util.Map} for each row, representing all columns as
* key-value pairs: one entry for each column, with the column name as key.

View File

@@ -15,10 +15,10 @@
*/
package org.springframework.data.cassandra.core.cql;
import static org.springframework.data.cassandra.core.cql.CqlConstantType.Regex.*;
import java.util.regex.Pattern;
import static org.springframework.data.cassandra.core.cql.CqlConstantType.Regex.*;
public enum CqlConstantType {
STRING(STRING_PATTERN), INTEGER(INTEGER_PATTERN), FLOAT(FLOAT_PATTERN), BOOLEAN(BOOLEAN_PATTERN), UUID(

View File

@@ -15,13 +15,13 @@
*/
package org.springframework.data.cassandra.core.cql;
import com.datastax.oss.driver.api.core.DriverException;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.support.PersistenceExceptionTranslator;
import org.springframework.data.cassandra.core.mapping.UnsupportedCassandraOperationException;
import org.springframework.lang.Nullable;
import com.datastax.oss.driver.api.core.DriverException;
/**
* Strategy interface for translating between {@link RuntimeException driver exceptions} and Spring's data access
* strategy-agnostic {@link DataAccessException} hierarchy.

View File

@@ -249,12 +249,12 @@ public final class CqlIdentifier implements Comparable<CqlIdentifier>, Serializa
return identifier.equals(that.identifier);
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
/*
* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public int hashCode() {
int result = identifier.hashCode();
result = 31 * result + (quoted ? 1 : 0);
return result;

View File

@@ -19,15 +19,15 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.IncorrectResultSizeDataAccessException;
import org.springframework.lang.Nullable;
import com.datastax.oss.driver.api.core.cql.PreparedStatement;
import com.datastax.oss.driver.api.core.cql.ResultSet;
import com.datastax.oss.driver.api.core.cql.Row;
import com.datastax.oss.driver.api.core.cql.Statement;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.IncorrectResultSizeDataAccessException;
import org.springframework.lang.Nullable;
/**
* Interface specifying a basic set of CQL operations. Implemented by {@link CqlTemplate}. Not often used directly, but
* a useful option to enhance testability, as it can easily be mocked or stubbed.

View File

@@ -21,12 +21,6 @@ import java.util.Map;
import java.util.function.Function;
import java.util.stream.StreamSupport;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.support.DataAccessUtils;
import org.springframework.data.cassandra.SessionFactory;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.driver.api.core.cql.PreparedStatement;
@@ -35,6 +29,12 @@ import com.datastax.oss.driver.api.core.cql.Row;
import com.datastax.oss.driver.api.core.cql.Statement;
import com.datastax.oss.driver.api.core.metadata.Node;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.support.DataAccessUtils;
import org.springframework.data.cassandra.SessionFactory;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
* <b>This is the central class in the CQL core package.</b> It simplifies the use of CQL and helps to avoid common
* errors. It executes core CQL workflow, leaving application code to provide CQL and extract results. This class

View File

@@ -15,11 +15,11 @@
*/
package org.springframework.data.cassandra.core.cql;
import org.springframework.util.Assert;
import com.datastax.oss.driver.api.core.config.DriverExecutionProfile;
import com.datastax.oss.driver.api.core.cql.Statement;
import org.springframework.util.Assert;
/**
* Resolver for a {@link com.datastax.oss.driver.api.core.config.DriverExecutionProfile} used with
* {@link com.datastax.oss.driver.api.core.cql.Statement#setExecutionProfileName(String)} or

View File

@@ -17,10 +17,10 @@ package org.springframework.data.cassandra.core.cql;
import java.util.regex.Pattern;
import org.springframework.util.Assert;
import com.datastax.oss.driver.api.core.CqlIdentifier;
import org.springframework.util.Assert;
/**
* This encapsulates the logic for keyspace identifiers.
* <p/>
@@ -107,6 +107,10 @@ public final class KeyspaceIdentifier implements Comparable<KeyspaceIdentifier>
return toCql();
}
/*
* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public int hashCode() {
return identifier.hashCode();

View File

@@ -15,13 +15,13 @@
*/
package org.springframework.data.cassandra.core.cql;
import org.springframework.dao.DataAccessException;
import org.springframework.lang.Nullable;
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.driver.api.core.cql.PreparedStatement;
import org.springframework.dao.DataAccessException;
import org.springframework.lang.Nullable;
/**
* Generic callback interface for code that operates on a {@link PreparedStatement}. Allows to execute any number of
* operations on a single {@link PreparedStatement}, for example a single {@link Session#execute(Statement).

View File

@@ -15,13 +15,12 @@
*/
package org.springframework.data.cassandra.core.cql;
import lombok.EqualsAndHashCode;
import java.time.Duration;
import java.util.concurrent.TimeUnit;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import com.datastax.oss.driver.api.core.ConsistencyLevel;
import com.datastax.oss.driver.api.core.config.DriverExecutionProfile;
@@ -33,7 +32,6 @@ import com.datastax.oss.driver.api.core.config.DriverExecutionProfile;
* @author David Webb
* @author Mark Paluch
*/
@EqualsAndHashCode
public class QueryOptions {
private static final QueryOptions EMPTY = QueryOptions.builder().build();
@@ -156,6 +154,61 @@ public class QueryOptions {
return this.tracing;
}
/*
* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof QueryOptions)) {
return false;
}
QueryOptions options = (QueryOptions) o;
if (!ObjectUtils.nullSafeEquals(consistencyLevel, options.consistencyLevel)) {
return false;
}
if (!ObjectUtils.nullSafeEquals(executionProfileResolver, options.executionProfileResolver)) {
return false;
}
if (!ObjectUtils.nullSafeEquals(pageSize, options.pageSize)) {
return false;
}
if (!ObjectUtils.nullSafeEquals(serialConsistencyLevel, options.serialConsistencyLevel)) {
return false;
}
if (!ObjectUtils.nullSafeEquals(timeout, options.timeout)) {
return false;
}
return ObjectUtils.nullSafeEquals(tracing, options.tracing);
}
/*
* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public int hashCode() {
int result = ObjectUtils.nullSafeHashCode(consistencyLevel);
result = 31 * result + ObjectUtils.nullSafeHashCode(executionProfileResolver);
result = 31 * result + ObjectUtils.nullSafeHashCode(pageSize);
result = 31 * result + ObjectUtils.nullSafeHashCode(serialConsistencyLevel);
result = 31 * result + ObjectUtils.nullSafeHashCode(timeout);
result = 31 * result + ObjectUtils.nullSafeHashCode(tracing);
return result;
}
/**
* Builder for {@link QueryOptions}.
*

View File

@@ -17,8 +17,6 @@ package org.springframework.data.cassandra.core.cql;
import java.time.Duration;
import org.springframework.util.Assert;
import com.datastax.oss.driver.api.core.cql.Statement;
import com.datastax.oss.driver.api.querybuilder.delete.Delete;
import com.datastax.oss.driver.api.querybuilder.delete.DeleteSelection;
@@ -26,6 +24,8 @@ import com.datastax.oss.driver.api.querybuilder.insert.Insert;
import com.datastax.oss.driver.api.querybuilder.update.Update;
import com.datastax.oss.driver.api.querybuilder.update.UpdateStart;
import org.springframework.util.Assert;
/**
* Utility class to associate {@link QueryOptions} and {@link WriteOptions} with QueryBuilder {@link Statement}s.
*

View File

@@ -15,22 +15,20 @@
*/
package org.springframework.data.cassandra.core.cql;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import java.util.Map;
import com.datastax.oss.driver.api.core.cql.PreparedStatement;
import com.datastax.oss.driver.api.core.cql.Row;
import com.datastax.oss.driver.api.core.cql.Statement;
import org.reactivestreams.Publisher;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.IncorrectResultSizeDataAccessException;
import org.springframework.data.cassandra.ReactiveResultSet;
import org.springframework.lang.Nullable;
import com.datastax.oss.driver.api.core.cql.PreparedStatement;
import com.datastax.oss.driver.api.core.cql.Row;
import com.datastax.oss.driver.api.core.cql.Statement;
/**
* Interface specifying a basic set of CQL operations executed in a reactive fashion. Implemented by
* {@link ReactiveCqlTemplate}. Not often used directly, but a useful option to enhance testability, as it can easily be

View File

@@ -15,24 +15,10 @@
*/
package org.springframework.data.cassandra.core.cql;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
import org.reactivestreams.Publisher;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.support.DataAccessUtils;
import org.springframework.data.cassandra.ReactiveResultSet;
import org.springframework.data.cassandra.ReactiveSession;
import org.springframework.data.cassandra.ReactiveSessionFactory;
import org.springframework.data.cassandra.core.cql.session.DefaultReactiveSessionFactory;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import com.datastax.oss.driver.api.core.ConsistencyLevel;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.driver.api.core.cql.BoundStatement;
@@ -41,6 +27,18 @@ import com.datastax.oss.driver.api.core.cql.Row;
import com.datastax.oss.driver.api.core.cql.SimpleStatement;
import com.datastax.oss.driver.api.core.cql.Statement;
import com.datastax.oss.driver.api.core.retry.RetryPolicy;
import org.reactivestreams.Publisher;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.support.DataAccessUtils;
import org.springframework.data.cassandra.ReactiveResultSet;
import org.springframework.data.cassandra.ReactiveSession;
import org.springframework.data.cassandra.ReactiveSessionFactory;
import org.springframework.data.cassandra.core.cql.session.DefaultReactiveSessionFactory;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
* <b>This is the central class in the CQL core package for reactive Cassandra data access.</b> It simplifies the use of

View File

@@ -15,14 +15,13 @@
*/
package org.springframework.data.cassandra.core.cql;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.driver.api.core.cql.PreparedStatement;
import org.reactivestreams.Publisher;
import org.springframework.dao.DataAccessException;
import org.springframework.data.cassandra.ReactiveSession;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.driver.api.core.cql.PreparedStatement;
/**
* Generic callback interface for code that operates on a {@link PreparedStatement}. Allows to execute any number of
* operations on a single {@link PreparedStatement}, for example a single {@link ReactiveSession#execute(Statement).

View File

@@ -15,13 +15,12 @@
*/
package org.springframework.data.cassandra.core.cql;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.driver.api.core.cql.PreparedStatement;
import reactor.core.publisher.Mono;
import org.springframework.data.cassandra.ReactiveSession;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.driver.api.core.cql.PreparedStatement;
/**
* One of the two central callback interfaces used by the {@link ReactiveCqlTemplate} class. This interface creates a
* {@link PreparedStatement} given a {@link ReactiveSession}, provided by the {@link ReactiveCqlTemplate} class.

View File

@@ -15,13 +15,12 @@
*/
package org.springframework.data.cassandra.core.cql;
import com.datastax.oss.driver.api.core.DriverException;
import org.reactivestreams.Publisher;
import org.springframework.dao.DataAccessException;
import org.springframework.data.cassandra.ReactiveResultSet;
import com.datastax.oss.driver.api.core.DriverException;
/**
* Callback interface used by {@link ReactiveCqlTemplate}'s query methods. Implementations of this interface perform the
* actual work of extracting results from a {@link ReactiveResultSet}, but don't need to worry about exception handling.

View File

@@ -15,14 +15,13 @@
*/
package org.springframework.data.cassandra.core.cql;
import com.datastax.oss.driver.api.core.DriverException;
import org.reactivestreams.Publisher;
import org.springframework.dao.DataAccessException;
import org.springframework.data.cassandra.ReactiveResultSet;
import org.springframework.util.Assert;
import com.datastax.oss.driver.api.core.DriverException;
/**
* Adapter implementation of the {@link ReactiveResultSetExtractor} interface that delegates to a {@link RowMapper}
* which is supposed to create an object for each row. Each object is emitted through the {@link Publisher} of this

View File

@@ -15,14 +15,13 @@
*/
package org.springframework.data.cassandra.core.cql;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.driver.api.core.cql.Statement;
import org.reactivestreams.Publisher;
import org.springframework.dao.DataAccessException;
import org.springframework.data.cassandra.ReactiveSession;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.driver.api.core.cql.Statement;
/**
* Generic callback interface for code that operates on a CQL {@link ReactiveSession}. Allows to execute any number of
* operations on a single {@link ReactiveSession}, using any type and number of Statements.

View File

@@ -15,14 +15,13 @@
*/
package org.springframework.data.cassandra.core.cql;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.driver.api.core.cql.Statement;
import org.reactivestreams.Publisher;
import org.springframework.dao.DataAccessException;
import org.springframework.data.cassandra.ReactiveSession;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.driver.api.core.cql.Statement;
/**
* Generic callback interface for code that operates on a CQL {@link Statement}. Allows to execute any number of
* operations on a single {@link Statement}, for example a single {@link ReactiveSession#execute(Statement)}.

View File

@@ -15,12 +15,12 @@
*/
package org.springframework.data.cassandra.core.cql;
import org.springframework.dao.DataAccessException;
import org.springframework.lang.Nullable;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.driver.api.core.cql.ResultSet;
import org.springframework.dao.DataAccessException;
import org.springframework.lang.Nullable;
/**
* Callback interface used by {@link CqlTemplate}'s query methods. Implementations of this interface perform the actual
* work of extracting results from a {@link ResultSet}, but don't need to worry about exception handling.

View File

@@ -19,10 +19,10 @@ import java.io.Serializable;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import org.springframework.util.Assert;
import com.datastax.oss.driver.api.core.metadata.Node;
import org.springframework.util.Assert;
/**
* Domain object representing a Cassandra host.
*

View File

@@ -19,11 +19,11 @@ import java.util.Collection;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
import org.springframework.util.Assert;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.driver.api.core.metadata.Node;
import org.springframework.util.Assert;
/**
* {@link HostMapper} to to map hosts into {@link RingMember} objects.
*

View File

@@ -15,11 +15,11 @@
*/
package org.springframework.data.cassandra.core.cql;
import org.springframework.lang.Nullable;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.driver.api.core.cql.Row;
import org.springframework.lang.Nullable;
/**
* An interface used by {@link CqlTemplate} for mapping rows of a {@link com.datastax.driver.core.ResultSet} on a
* per-row basis. Implementations of this interface perform the actual work of mapping each row to a result object, but

View File

@@ -18,13 +18,13 @@ package org.springframework.data.cassandra.core.cql;
import java.util.ArrayList;
import java.util.List;
import org.springframework.dao.DataAccessException;
import org.springframework.util.Assert;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.driver.api.core.cql.ResultSet;
import com.datastax.oss.driver.api.core.cql.Row;
import org.springframework.dao.DataAccessException;
import org.springframework.util.Assert;
/**
* Adapter implementation of the {@link ResultSetExtractor} interface that delegates to a {@link RowMapper} which is
* supposed to create an object for each row. Each object is added to the results List of this

View File

@@ -23,12 +23,12 @@ import java.time.LocalTime;
import java.util.Date;
import java.util.UUID;
import org.springframework.lang.Nullable;
import com.datastax.oss.driver.api.core.cql.Row;
import com.datastax.oss.driver.api.core.data.TupleValue;
import com.datastax.oss.driver.api.core.data.UdtValue;
import org.springframework.lang.Nullable;
/**
* Generic utility methods for working with Cassandra. Mainly for internal use within the framework, but also useful for
* custom CQL access code.

View File

@@ -15,11 +15,11 @@
*/
package org.springframework.data.cassandra.core.cql;
import org.springframework.dao.DataAccessException;
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.DriverException;
import org.springframework.dao.DataAccessException;
/**
* Generic callback interface for code that operates on a Cassandra {@link CqlSession}. Allows to execute any number of
* operations on a single session, using any type and number of statements.

View File

@@ -15,12 +15,12 @@
*/
package org.springframework.data.cassandra.core.cql;
import org.springframework.util.Assert;
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.driver.api.core.cql.PreparedStatement;
import org.springframework.util.Assert;
/**
* Trivial implementation of {@link PreparedStatementCreator}. This prepared statement creator simply prepares a
* statement from the CQL string.

View File

@@ -15,16 +15,16 @@
*/
package org.springframework.data.cassandra.core.cql;
import org.springframework.dao.TypeMismatchDataAccessException;
import org.springframework.lang.Nullable;
import org.springframework.util.ClassUtils;
import org.springframework.util.NumberUtils;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.driver.api.core.cql.ColumnDefinition;
import com.datastax.oss.driver.api.core.cql.ColumnDefinitions;
import com.datastax.oss.driver.api.core.cql.Row;
import org.springframework.dao.TypeMismatchDataAccessException;
import org.springframework.lang.Nullable;
import org.springframework.util.ClassUtils;
import org.springframework.util.NumberUtils;
/**
* {@link RowMapper} implementation that converts a single column into a single result value per row. Expects to operate
* on a {@link com.datastax.driver.core.Row} that just contains a single column.

View File

@@ -15,16 +15,15 @@
*/
package org.springframework.data.cassandra.core.cql;
import lombok.EqualsAndHashCode;
import java.time.Duration;
import java.time.Instant;
import java.util.concurrent.TimeUnit;
import com.datastax.oss.driver.api.core.ConsistencyLevel;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import com.datastax.oss.driver.api.core.ConsistencyLevel;
import org.springframework.util.ObjectUtils;
/**
* Cassandra Write Options are an extension to {@link QueryOptions} for write operations. {@link WriteOptions} allow
@@ -35,7 +34,6 @@ import com.datastax.oss.driver.api.core.ConsistencyLevel;
* @author Lukasz Antoniak
* @see QueryOptions
*/
@EqualsAndHashCode(callSuper = true)
public class WriteOptions extends QueryOptions {
private static final WriteOptions EMPTY = new WriteOptionsBuilder().build();
@@ -100,6 +98,46 @@ public class WriteOptions extends QueryOptions {
return this.timestamp;
}
/*
* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof WriteOptions)) {
return false;
}
if (!super.equals(o)) {
return false;
}
WriteOptions that = (WriteOptions) o;
if (!ObjectUtils.nullSafeEquals(ttl, that.ttl)) {
return false;
}
return ObjectUtils.nullSafeEquals(timestamp, that.timestamp);
}
/*
* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + ObjectUtils.nullSafeHashCode(ttl);
result = 31 * result + ObjectUtils.nullSafeHashCode(timestamp);
return result;
}
/**
* Builder for {@link WriteOptions}.
*

View File

@@ -18,11 +18,11 @@ package org.springframework.data.cassandra.core.cql.converter;
import java.util.List;
import java.util.Map;
import com.datastax.oss.driver.api.core.cql.ResultSet;
import org.springframework.core.convert.converter.Converter;
import org.springframework.lang.Nullable;
import com.datastax.oss.driver.api.core.cql.ResultSet;
/**
* Convenient converter that can be used to convert a single-row-single-column, single-row-multi-column, or multi-row
* {@link ResultSet} into the a value of a given type. The majority of the expected usage is to convert a

View File

@@ -17,7 +17,6 @@ package org.springframework.data.cassandra.core.cql.converter;
import org.springframework.core.convert.ConversionService;
import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.core.convert.support.GenericConversionService;
/**
* Thin wrapper that allows subclasses to delegate conversion of the given value to a {@link DefaultConversionService}.

View File

@@ -18,12 +18,12 @@ package org.springframework.data.cassandra.core.cql.converter;
import java.util.ArrayList;
import java.util.List;
import org.springframework.core.convert.converter.Converter;
import org.springframework.util.Assert;
import com.datastax.oss.driver.api.core.cql.ResultSet;
import com.datastax.oss.driver.api.core.cql.Row;
import org.springframework.core.convert.converter.Converter;
import org.springframework.util.Assert;
/**
* {@link Converter} from {@link ResultSet} to {@link Object} array.
*

View File

@@ -17,10 +17,10 @@ package org.springframework.data.cassandra.core.cql.converter;
import java.math.BigDecimal;
import org.springframework.core.convert.converter.Converter;
import com.datastax.oss.driver.api.core.cql.ResultSet;
import org.springframework.core.convert.converter.Converter;
/**
* {@link Converter} from {@link ResultSet} to a single {@link BigDecimal} value.
*

View File

@@ -17,10 +17,10 @@ package org.springframework.data.cassandra.core.cql.converter;
import java.math.BigInteger;
import org.springframework.core.convert.converter.Converter;
import com.datastax.oss.driver.api.core.cql.ResultSet;
import org.springframework.core.convert.converter.Converter;
/**
* {@link Converter} from {@link ResultSet} to a single {@link BigInteger} value.
*

View File

@@ -15,10 +15,10 @@
*/
package org.springframework.data.cassandra.core.cql.converter;
import org.springframework.core.convert.converter.Converter;
import com.datastax.oss.driver.api.core.cql.ResultSet;
import org.springframework.core.convert.converter.Converter;
/**
* {@link Converter} from {@link ResultSet} to a single {@link Boolean} value.
*

View File

@@ -17,10 +17,10 @@ package org.springframework.data.cassandra.core.cql.converter;
import java.nio.ByteBuffer;
import org.springframework.core.convert.converter.Converter;
import com.datastax.oss.driver.api.core.cql.ResultSet;
import org.springframework.core.convert.converter.Converter;
/**
* {@link Converter} from {@link ResultSet} to a single {@link ByteBuffer} value.
*

View File

@@ -17,10 +17,10 @@ package org.springframework.data.cassandra.core.cql.converter;
import java.util.Date;
import org.springframework.core.convert.converter.Converter;
import com.datastax.oss.driver.api.core.cql.ResultSet;
import org.springframework.core.convert.converter.Converter;
/**
* {@link Converter} from {@link ResultSet} to a single {@link Date} value.
*

View File

@@ -15,10 +15,10 @@
*/
package org.springframework.data.cassandra.core.cql.converter;
import org.springframework.core.convert.converter.Converter;
import com.datastax.oss.driver.api.core.cql.ResultSet;
import org.springframework.core.convert.converter.Converter;
/**
* {@link Converter} from {@link ResultSet} to a single {@link Double} value.
*

View File

@@ -15,10 +15,10 @@
*/
package org.springframework.data.cassandra.core.cql.converter;
import org.springframework.core.convert.converter.Converter;
import com.datastax.oss.driver.api.core.cql.ResultSet;
import org.springframework.core.convert.converter.Converter;
/**
* {@link Converter} from {@link ResultSet} to a single {@link Float} value.
*

View File

@@ -17,10 +17,10 @@ package org.springframework.data.cassandra.core.cql.converter;
import java.net.InetAddress;
import org.springframework.core.convert.converter.Converter;
import com.datastax.oss.driver.api.core.cql.ResultSet;
import org.springframework.core.convert.converter.Converter;
/**
* {@link Converter} from {@link ResultSet} to a single {@link InetAddress} value.
*

View File

@@ -15,10 +15,10 @@
*/
package org.springframework.data.cassandra.core.cql.converter;
import org.springframework.core.convert.converter.Converter;
import com.datastax.oss.driver.api.core.cql.ResultSet;
import org.springframework.core.convert.converter.Converter;
/**
* {@link Converter} from {@link ResultSet} to a single {@link Integer} value.
*

View File

@@ -19,12 +19,12 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.springframework.core.convert.converter.Converter;
import org.springframework.util.Assert;
import com.datastax.oss.driver.api.core.cql.ResultSet;
import com.datastax.oss.driver.api.core.cql.Row;
import org.springframework.core.convert.converter.Converter;
import org.springframework.util.Assert;
/**
* {@link Converter} from {@link ResultSet} to {@link Map}.
*

View File

@@ -20,11 +20,11 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.datastax.oss.driver.api.core.cql.ResultSet;
import org.springframework.core.convert.converter.Converter;
import org.springframework.util.StringUtils;
import com.datastax.oss.driver.api.core.cql.ResultSet;
/**
* {@link Converter} from {@link ResultSet} to a {@link List} of {@link String}.
*

View File

@@ -15,10 +15,10 @@
*/
package org.springframework.data.cassandra.core.cql.converter;
import org.springframework.core.convert.converter.Converter;
import com.datastax.oss.driver.api.core.cql.ResultSet;
import org.springframework.core.convert.converter.Converter;
/**
* {@link Converter} from {@link ResultSet} to a single {@link Long} value.
*

View File

@@ -18,10 +18,10 @@ package org.springframework.data.cassandra.core.cql.converter;
import java.util.List;
import java.util.Map;
import org.springframework.core.convert.converter.Converter;
import com.datastax.oss.driver.api.core.cql.ResultSet;
import org.springframework.core.convert.converter.Converter;
/**
* {@link Converter} from {@link ResultSet} to a single {@link String} value.
*

View File

@@ -17,10 +17,10 @@ package org.springframework.data.cassandra.core.cql.converter;
import java.util.UUID;
import org.springframework.core.convert.converter.Converter;
import com.datastax.oss.driver.api.core.cql.ResultSet;
import org.springframework.core.convert.converter.Converter;
/**
* {@link Converter} from {@link ResultSet} to a single {@link UUID} value.
*

View File

@@ -17,10 +17,10 @@ package org.springframework.data.cassandra.core.cql.converter;
import java.util.List;
import org.springframework.core.convert.converter.Converter;
import com.datastax.oss.driver.api.core.cql.Row;
import org.springframework.core.convert.converter.Converter;
/**
* Converter to convert {@link Row} to {@link Object} array.
*

View File

@@ -18,12 +18,12 @@ package org.springframework.data.cassandra.core.cql.converter;
import java.util.ArrayList;
import java.util.List;
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.convert.ReadingConverter;
import com.datastax.oss.driver.api.core.cql.ColumnDefinitions;
import com.datastax.oss.driver.api.core.cql.Row;
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.convert.ReadingConverter;
/**
* Converter to convert {@link Row}s to a {@link List} of {@link Object} representation.
*

View File

@@ -18,12 +18,12 @@ package org.springframework.data.cassandra.core.cql.converter;
import java.util.HashMap;
import java.util.Map;
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.convert.ReadingConverter;
import com.datastax.oss.driver.api.core.cql.ColumnDefinitions;
import com.datastax.oss.driver.api.core.cql.Row;
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.convert.ReadingConverter;
/**
* Converter to convert {@link Row}s to a {@link Map} of {@link String}/{@link Object} representation.
*

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.cassandra.core.cql.generator;
import static org.springframework.data.cassandra.core.cql.PrimaryKeyType.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -27,6 +25,8 @@ import org.springframework.data.cassandra.core.cql.keyspace.Option;
import org.springframework.data.cassandra.core.cql.keyspace.TableSpecification;
import org.springframework.util.StringUtils;
import static org.springframework.data.cassandra.core.cql.PrimaryKeyType.*;
/**
* CQL generator for generating a {@code CREATE TABLE} statement.
*

View File

@@ -15,12 +15,12 @@
*/
package org.springframework.data.cassandra.core.cql.generator;
import static org.springframework.data.cassandra.core.cql.keyspace.CqlStringUtils.*;
import java.util.Map;
import org.springframework.data.cassandra.core.cql.keyspace.Option;
import static org.springframework.data.cassandra.core.cql.keyspace.CqlStringUtils.*;
/**
* @author Mark Paluch
* @since 2.0

View File

@@ -16,16 +16,12 @@
package org.springframework.data.cassandra.core.cql.keyspace;
import com.datastax.oss.driver.api.core.CqlIdentifier;
import lombok.EqualsAndHashCode;
import org.springframework.data.cassandra.core.cql.KeyspaceIdentifier;
/**
* Object to configure a {@code ALTER KEYSPACE} specification.
*
* @author Mark Paluch
*/
@EqualsAndHashCode(callSuper = true)
public class AlterKeyspaceSpecification extends KeyspaceOptionsSpecification<AlterKeyspaceSpecification> {
private AlterKeyspaceSpecification(CqlIdentifier name) {

View File

@@ -205,7 +205,8 @@ public class ColumnSpecification {
return cql.append(name.asCql(true)).append(" ").append(type.asCql(true, true));
}
/* (non-Javadoc)
/*
* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override

View File

@@ -15,11 +15,11 @@
*/
package org.springframework.data.cassandra.core.cql.keyspace;
import org.springframework.util.Assert;
import com.datastax.oss.driver.api.core.CqlIdentifier;
import com.datastax.oss.driver.api.core.type.DataType;
import org.springframework.util.Assert;
/**
* Base value object class for column changes that include {@link DataType} information.
*

View File

@@ -20,12 +20,12 @@ import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
import com.datastax.oss.driver.api.core.CqlIdentifier;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import com.datastax.oss.driver.api.core.CqlIdentifier;
/**
* Object to configure a {@code CREATE INDEX} specification.
*

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.cassandra.core.cql.keyspace;
import lombok.EqualsAndHashCode;
import org.springframework.data.cassandra.core.cql.KeyspaceIdentifier;
import org.springframework.data.cassandra.core.cql.keyspace.KeyspaceOption.ReplicationStrategy;
import org.springframework.data.cassandra.util.MapBuilder;
@@ -29,7 +27,6 @@ import com.datastax.oss.driver.api.core.CqlIdentifier;
*
* @author Mark Paluch
*/
@EqualsAndHashCode(callSuper = true)
public class CreateKeyspaceSpecification extends KeyspaceOptionsSpecification<CreateKeyspaceSpecification>
implements KeyspaceDescriptor {
@@ -162,4 +159,38 @@ public class CreateKeyspaceSpecification extends KeyspaceOptionsSpecification<Cr
public CreateKeyspaceSpecification with(String name, @Nullable Object value, boolean escape, boolean quote) {
return super.with(name, value, escape, quote);
}
/*
* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof CreateKeyspaceSpecification)) {
return false;
}
if (!super.equals(o)) {
return false;
}
CreateKeyspaceSpecification that = (CreateKeyspaceSpecification) o;
return ifNotExists == that.ifNotExists;
}
/*
* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (ifNotExists ? 1 : 0);
return result;
}
}

View File

@@ -16,6 +16,7 @@
package org.springframework.data.cassandra.core.cql.keyspace;
import com.datastax.oss.driver.api.core.CqlIdentifier;
import org.springframework.lang.Nullable;
/**

View File

@@ -15,14 +15,11 @@
*/
package org.springframework.data.cassandra.core.cql.keyspace;
import lombok.ToString;
/**
* Value object representing replication factor for a given data center.
*
* @author Mark Paluch
*/
@ToString
public class DataCenterReplication {
private final String dataCenter;
@@ -59,4 +56,14 @@ public class DataCenterReplication {
public long getReplicationFactor() {
return replicationFactor;
}
/*
* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "DataCenterReplication(dataCenter=" + this.getDataCenter() + ", replicationFactor="
+ this.getReplicationFactor() + ")";
}
}

View File

@@ -179,7 +179,8 @@ public class DefaultOption implements Option {
return string;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.cassandra.core.cql.keyspace;
import lombok.EqualsAndHashCode;
import org.springframework.data.cassandra.core.cql.KeyspaceIdentifier;
import com.datastax.oss.driver.api.core.CqlIdentifier;
@@ -26,7 +24,6 @@ import com.datastax.oss.driver.api.core.CqlIdentifier;
*
* @author Mark Paluch
*/
@EqualsAndHashCode(callSuper = true)
public class DropKeyspaceSpecification extends KeyspaceActionSpecification {
private boolean ifExists;
@@ -92,4 +89,38 @@ public class DropKeyspaceSpecification extends KeyspaceActionSpecification {
public boolean getIfExists() {
return ifExists;
}
/*
* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof DropKeyspaceSpecification)) {
return false;
}
if (!super.equals(o)) {
return false;
}
DropKeyspaceSpecification that = (DropKeyspaceSpecification) o;
return ifExists == that.ifExists;
}
/*
* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (ifExists ? 1 : 0);
return result;
}
}

View File

@@ -15,11 +15,11 @@
*/
package org.springframework.data.cassandra.core.cql.keyspace;
import org.springframework.util.Assert;
import com.datastax.oss.driver.api.core.CqlIdentifier;
import com.datastax.oss.driver.api.core.type.DataType;
import org.springframework.util.Assert;
/**
* Base value object class to specify user type fields.
* <p/>

View File

@@ -16,6 +16,7 @@
package org.springframework.data.cassandra.core.cql.keyspace;
import com.datastax.oss.driver.api.core.CqlIdentifier;
import org.springframework.lang.Nullable;
/**

View File

@@ -16,6 +16,7 @@
package org.springframework.data.cassandra.core.cql.keyspace;
import com.datastax.oss.driver.api.core.CqlIdentifier;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;

View File

@@ -15,9 +15,8 @@
*/
package org.springframework.data.cassandra.core.cql.keyspace;
import lombok.EqualsAndHashCode;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import com.datastax.oss.driver.api.core.CqlIdentifier;
@@ -28,7 +27,6 @@ import com.datastax.oss.driver.api.core.CqlIdentifier;
* @author David Webb
* @param <T> The subtype of the {@link KeyspaceActionSpecification}
*/
@EqualsAndHashCode
public abstract class KeyspaceActionSpecification {
/**
@@ -46,4 +44,36 @@ public abstract class KeyspaceActionSpecification {
public CqlIdentifier getName() {
return name;
}
protected boolean canEqual(final Object other) {
return other instanceof KeyspaceActionSpecification;
}
/*
* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof KeyspaceActionSpecification)) {
return false;
}
KeyspaceActionSpecification that = (KeyspaceActionSpecification) o;
return ObjectUtils.nullSafeEquals(name, that.name);
}
/*
* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public int hashCode() {
return ObjectUtils.nullSafeHashCode(name);
}
}

View File

@@ -17,13 +17,12 @@ package org.springframework.data.cassandra.core.cql.keyspace;
import static org.springframework.data.cassandra.core.cql.keyspace.CqlStringUtils.*;
import lombok.EqualsAndHashCode;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
import org.springframework.lang.Nullable;
import org.springframework.util.ObjectUtils;
import com.datastax.oss.driver.api.core.CqlIdentifier;
@@ -40,7 +39,6 @@ import com.datastax.oss.driver.api.core.CqlIdentifier;
* @author John McPeek
* @param <T> The subtype of the {@link KeyspaceOptionsSpecification}.
*/
@EqualsAndHashCode(callSuper = true)
public abstract class KeyspaceOptionsSpecification<T extends KeyspaceOptionsSpecification<T>>
extends KeyspaceActionSpecification {
@@ -109,4 +107,38 @@ public abstract class KeyspaceOptionsSpecification<T extends KeyspaceOptionsSpec
public Map<String, Object> getOptions() {
return Collections.unmodifiableMap(options);
}
/*
* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof KeyspaceOptionsSpecification)) {
return false;
}
if (!super.equals(o)) {
return false;
}
KeyspaceOptionsSpecification<?> that = (KeyspaceOptionsSpecification<?>) o;
return ObjectUtils.nullSafeEquals(options, that.options);
}
/*
* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + ObjectUtils.nullSafeHashCode(options);
return result;
}
}

View File

@@ -16,6 +16,7 @@
package org.springframework.data.cassandra.core.cql.keyspace;
import com.datastax.oss.driver.api.core.CqlIdentifier;
import org.springframework.util.Assert;
/**

View File

@@ -16,6 +16,7 @@
package org.springframework.data.cassandra.core.cql.keyspace;
import com.datastax.oss.driver.api.core.CqlIdentifier;
import org.springframework.util.Assert;
/**

View File

@@ -15,15 +15,16 @@
*/
package org.springframework.data.cassandra.core.cql.keyspace;
import static org.springframework.data.cassandra.core.cql.keyspace.CqlStringUtils.*;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
import com.datastax.oss.driver.api.core.CqlIdentifier;
import org.springframework.lang.Nullable;
import static org.springframework.data.cassandra.core.cql.keyspace.CqlStringUtils.*;
/**
* Abstract builder class to support the construction of table specifications that have table options, that is, those
* options normally specified by {@code WITH ... AND ...}.

View File

@@ -15,19 +15,19 @@
*/
package org.springframework.data.cassandra.core.cql.keyspace;
import static org.springframework.data.cassandra.core.cql.PrimaryKeyType.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import com.datastax.oss.driver.api.core.CqlIdentifier;
import com.datastax.oss.driver.api.core.type.DataType;
import org.springframework.data.cassandra.core.cql.Ordering;
import org.springframework.data.cassandra.core.cql.PrimaryKeyType;
import org.springframework.util.Assert;
import com.datastax.oss.driver.api.core.CqlIdentifier;
import com.datastax.oss.driver.api.core.type.DataType;
import static org.springframework.data.cassandra.core.cql.PrimaryKeyType.*;
/**
* Object to support the configuration of table specifications that have columns. This class can also be used as a

View File

@@ -15,10 +15,10 @@
*/
package org.springframework.data.cassandra.core.cql.keyspace;
import org.springframework.util.Assert;
import com.datastax.oss.driver.api.core.CqlIdentifier;
import org.springframework.util.Assert;
/**
* Base value object builder class to construction of user type specifications.
*

Some files were not shown because too many files have changed in this diff Show More