diff --git a/spring-cql/src/main/java/org/springframework/cassandra/core/ReactiveCqlTemplate.java b/spring-cql/src/main/java/org/springframework/cassandra/core/ReactiveCqlTemplate.java
index aa29e37c0..923f9b070 100644
--- a/spring-cql/src/main/java/org/springframework/cassandra/core/ReactiveCqlTemplate.java
+++ b/spring-cql/src/main/java/org/springframework/cassandra/core/ReactiveCqlTemplate.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 the original author or authors.
+ * Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,6 +15,9 @@
*/
package org.springframework.cassandra.core;
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+
import java.util.Map;
import java.util.function.Function;
@@ -34,9 +37,6 @@ import com.datastax.driver.core.exceptions.DriverException;
import com.datastax.driver.core.policies.RetryPolicy;
import com.datastax.driver.core.querybuilder.QueryBuilder;
-import reactor.core.publisher.Flux;
-import reactor.core.publisher.Mono;
-
/**
* This is the central class in the CQL core package for reactive Cassandra data access. It simplifies the use of
* CQL and helps to avoid common errors. It executes core CQL workflow, leaving application code to provide CQL and
@@ -682,7 +682,7 @@ public class ReactiveCqlTemplate extends ReactiveCassandraAccessor implements Re
*/
protected Flux createFlux(Statement statement, ReactiveStatementCallback callback) {
- Assert.notNull(callback);
+ Assert.notNull(callback, "ReactiveStatementCallback must not be null");
applyStatementSettings(statement);
@@ -699,7 +699,7 @@ public class ReactiveCqlTemplate extends ReactiveCassandraAccessor implements Re
*/
protected Mono createMono(Statement statement, ReactiveStatementCallback callback) {
- Assert.notNull(callback);
+ Assert.notNull(callback, "ReactiveStatementCallback must not be null");
applyStatementSettings(statement);
@@ -716,7 +716,7 @@ public class ReactiveCqlTemplate extends ReactiveCassandraAccessor implements Re
*/
protected Flux createFlux(ReactiveSessionCallback callback) {
- Assert.notNull(callback);
+ Assert.notNull(callback, "ReactiveStatementCallback must not be null");
ReactiveSession session = getSession();
diff --git a/spring-cql/src/main/java/org/springframework/cassandra/core/ReservedKeyword.java b/spring-cql/src/main/java/org/springframework/cassandra/core/ReservedKeyword.java
index f1a5e6ba5..16c04599b 100644
--- a/spring-cql/src/main/java/org/springframework/cassandra/core/ReservedKeyword.java
+++ b/spring-cql/src/main/java/org/springframework/cassandra/core/ReservedKeyword.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2017 the original author or authors.
+ *
+ * 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 org.springframework.cassandra.core;
import org.springframework.util.Assert;
@@ -5,9 +20,9 @@ import org.springframework.util.StringUtils;
/**
* CQL keywords.
- *
- * @see http://cassandra.apache.org/doc/cql3/CQL.html#appendixA
+ *
+ * @see http://cassandra.apache.org/doc/cql3/CQL.html#appendixA
* @author Matthew T. Adams
*/
public enum ReservedKeyword {
@@ -64,7 +79,9 @@ public enum ReservedKeyword {
* @see ReservedKeyword#isReserved(String)
*/
public static boolean isReserved(CharSequence candidate) {
- Assert.notNull(candidate);
+
+ Assert.notNull(candidate, "CharSequence must not be null");
+
return isReserved(candidate.toString());
}
diff --git a/spring-cql/src/main/java/org/springframework/cassandra/core/converter/ResultSetToArrayConverter.java b/spring-cql/src/main/java/org/springframework/cassandra/core/converter/ResultSetToArrayConverter.java
index ef8ac540c..06b4fd09a 100644
--- a/spring-cql/src/main/java/org/springframework/cassandra/core/converter/ResultSetToArrayConverter.java
+++ b/spring-cql/src/main/java/org/springframework/cassandra/core/converter/ResultSetToArrayConverter.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2017 the original author or authors.
+ *
+ * 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 org.springframework.cassandra.core.converter;
import java.util.ArrayList;
@@ -10,6 +25,11 @@ import org.springframework.util.Assert;
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Row;
+/**
+ * {@link Converter} from {@link ResultSet} to {@link Object} array.
+ *
+ * @author Mark Paluch
+ */
public class ResultSetToArrayConverter implements Converter {
protected Converter rowConverter;
@@ -24,7 +44,7 @@ public class ResultSetToArrayConverter implements Converter
public void setRowConverter(Converter rowConverter) {
- Assert.notNull(rowConverter);
+ Assert.notNull(rowConverter, "Converter must not be null");
this.rowConverter = rowConverter;
}
diff --git a/spring-cql/src/main/java/org/springframework/cassandra/core/converter/ResultSetToListConverter.java b/spring-cql/src/main/java/org/springframework/cassandra/core/converter/ResultSetToListConverter.java
index 991603b31..caf466a95 100644
--- a/spring-cql/src/main/java/org/springframework/cassandra/core/converter/ResultSetToListConverter.java
+++ b/spring-cql/src/main/java/org/springframework/cassandra/core/converter/ResultSetToListConverter.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2017 the original author or authors.
+ *
+ * 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 org.springframework.cassandra.core.converter;
import java.util.ArrayList;
@@ -11,6 +26,11 @@ import org.springframework.util.Assert;
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Row;
+/**
+ * {@link Converter} from {@link ResultSet} to {@link Map}.
+ *
+ * @author Mark Paluch
+ */
public class ResultSetToListConverter implements Converter>> {
protected Converter> rowConverter = new RowToMapConverter();
@@ -27,7 +47,8 @@ public class ResultSetToListConverter implements Converter> rowConverter) {
- Assert.notNull(rowConverter);
+ Assert.notNull(rowConverter, "Converter must not be null");
+
this.rowConverter = rowConverter;
}
diff --git a/spring-cql/src/main/java/org/springframework/cassandra/core/cql/KeyspaceIdentifier.java b/spring-cql/src/main/java/org/springframework/cassandra/core/cql/KeyspaceIdentifier.java
index 4d5988cf5..124e07717 100644
--- a/spring-cql/src/main/java/org/springframework/cassandra/core/cql/KeyspaceIdentifier.java
+++ b/spring-cql/src/main/java/org/springframework/cassandra/core/cql/KeyspaceIdentifier.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2017 the original author or authors.
+ *
+ * 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 org.springframework.cassandra.core.cql;
import java.util.regex.Pattern;
@@ -10,7 +25,7 @@ import org.springframework.util.Assert;
*
* Keyspace identifiers are converted to lower case. To render, use any of the methods {@link #toCql()},
* {@link #toCql(StringBuilder)}, or {@link #toString()}.
- *
+ *
* @see #KeyspaceIdentifier(String)
* @see #toCql()
* @see #toCql(StringBuilder)
@@ -50,14 +65,14 @@ public final class KeyspaceIdentifier implements Comparable
*/
private void setIdentifier(CharSequence identifier) {
- Assert.notNull(identifier);
+ Assert.notNull(identifier, "Identifier must not be null");
String string = identifier.toString();
- Assert.hasText(string);
+ Assert.hasText(string, "Identifier must not be empty");
if (!isIdentifier(string)) {
- throw new IllegalArgumentException(String.format("given string [%s] is not a valid keyspace identifier",
- identifier));
+ throw new IllegalArgumentException(
+ String.format("given string [%s] is not a valid keyspace identifier", identifier));
}
this.identifier = string.toLowerCase();
}
diff --git a/spring-cql/src/main/java/org/springframework/cassandra/core/cql/generator/ColumnChangeCqlGenerator.java b/spring-cql/src/main/java/org/springframework/cassandra/core/cql/generator/ColumnChangeCqlGenerator.java
index cae3e82f0..d38ff28e9 100644
--- a/spring-cql/src/main/java/org/springframework/cassandra/core/cql/generator/ColumnChangeCqlGenerator.java
+++ b/spring-cql/src/main/java/org/springframework/cassandra/core/cql/generator/ColumnChangeCqlGenerator.java
@@ -1,12 +1,12 @@
/*
- * Copyright 2013-2014 the original author or authors.
- *
+ * Copyright 2013-2017 the original author or authors.
+ *
* 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.
@@ -20,7 +20,7 @@ import org.springframework.util.Assert;
/**
* Base class for column change CQL generators.
- *
+ *
* @author Matthew T. Adams
* @param The corresponding {@link ColumnChangeSpecification} type for this CQL generator.
*/
@@ -35,7 +35,8 @@ public abstract class ColumnChangeCqlGenerator subtype of {@link IndexNameSpecification}.
+ * @author Mark Paluch
+ */
public abstract class IndexNameCqlGenerator> {
public abstract StringBuilder toCql(StringBuilder cql);
@@ -29,7 +35,8 @@ public abstract class IndexNameCqlGenerator>
}
protected void setSpecification(IndexNameSpecification specification) {
- Assert.notNull(specification);
+
+ Assert.notNull(specification, "IndexNameSpecification must not be null");
this.specification = specification;
}
diff --git a/spring-cql/src/main/java/org/springframework/cassandra/core/cql/generator/KeyspaceCqlGenerator.java b/spring-cql/src/main/java/org/springframework/cassandra/core/cql/generator/KeyspaceCqlGenerator.java
index 3603c503e..685e79ebe 100644
--- a/spring-cql/src/main/java/org/springframework/cassandra/core/cql/generator/KeyspaceCqlGenerator.java
+++ b/spring-cql/src/main/java/org/springframework/cassandra/core/cql/generator/KeyspaceCqlGenerator.java
@@ -1,12 +1,12 @@
/*
- * Copyright 2013-2014 the original author or authors.
- *
+ * Copyright 2013-2017 the original author or authors.
+ *
* 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.
@@ -19,9 +19,9 @@ import org.springframework.cassandra.core.keyspace.KeyspaceSpecification;
/**
* Base class that contains behavior common to CQL generation for table operations.
- *
+ *
* @author Matthew T. Adams
- * @param T The subtype of this class for which this is a CQL generator.
+ * @param subtype of this class for which this is a CQL generator.
*/
public abstract class KeyspaceCqlGenerator> extends
KeyspaceOptionsCqlGenerator> {
diff --git a/spring-cql/src/main/java/org/springframework/cassandra/core/cql/generator/KeyspaceNameCqlGenerator.java b/spring-cql/src/main/java/org/springframework/cassandra/core/cql/generator/KeyspaceNameCqlGenerator.java
index e1b438e07..6834a2016 100644
--- a/spring-cql/src/main/java/org/springframework/cassandra/core/cql/generator/KeyspaceNameCqlGenerator.java
+++ b/spring-cql/src/main/java/org/springframework/cassandra/core/cql/generator/KeyspaceNameCqlGenerator.java
@@ -1,12 +1,12 @@
/*
- * Copyright 2013-2014 the original author or authors.
- *
+ * Copyright 2013-2017 the original author or authors.
+ *
* 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.
@@ -18,6 +18,12 @@ package org.springframework.cassandra.core.cql.generator;
import org.springframework.cassandra.core.keyspace.KeyspaceActionSpecification;
import org.springframework.util.Assert;
+/**
+ * Base class for Keyspace CQL generators.
+ *
+ * @param subtype of {@link KeyspaceActionSpecification}.
+ * @author Mark Paluch
+ */
public abstract class KeyspaceNameCqlGenerator> {
public abstract StringBuilder toCql(StringBuilder cql);
@@ -29,7 +35,8 @@ public abstract class KeyspaceNameCqlGenerator specification) {
- Assert.notNull(specification);
+
+ Assert.notNull(specification, "KeyspaceActionSpecification must not be null");
this.specification = specification;
}
diff --git a/spring-cql/src/main/java/org/springframework/cassandra/core/cql/generator/TableNameCqlGenerator.java b/spring-cql/src/main/java/org/springframework/cassandra/core/cql/generator/TableNameCqlGenerator.java
index 766173370..ca856c0d2 100644
--- a/spring-cql/src/main/java/org/springframework/cassandra/core/cql/generator/TableNameCqlGenerator.java
+++ b/spring-cql/src/main/java/org/springframework/cassandra/core/cql/generator/TableNameCqlGenerator.java
@@ -1,12 +1,12 @@
/*
- * Copyright 2013-2014 the original author or authors.
- *
+ * Copyright 2013-2017 the original author or authors.
+ *
* 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.
@@ -18,6 +18,12 @@ package org.springframework.cassandra.core.cql.generator;
import org.springframework.cassandra.core.keyspace.TableNameSpecification;
import org.springframework.util.Assert;
+/**
+ * Base class for Table CQL generators.
+ *
+ * @param subtype of TableNameSpecification.
+ * @author Mark Paluch
+ */
public abstract class TableNameCqlGenerator> {
public abstract StringBuilder toCql(StringBuilder cql);
@@ -29,7 +35,8 @@ public abstract class TableNameCqlGenerator>
}
protected void setSpecification(TableNameSpecification specification) {
- Assert.notNull(specification);
+
+ Assert.notNull(specification, "TableNameSpecification must not be null");
this.specification = specification;
}
diff --git a/spring-cql/src/main/java/org/springframework/cassandra/core/keyspace/ColumnSpecification.java b/spring-cql/src/main/java/org/springframework/cassandra/core/keyspace/ColumnSpecification.java
index 6be13d7d1..5a39b47c2 100644
--- a/spring-cql/src/main/java/org/springframework/cassandra/core/keyspace/ColumnSpecification.java
+++ b/spring-cql/src/main/java/org/springframework/cassandra/core/keyspace/ColumnSpecification.java
@@ -1,12 +1,12 @@
/*
- * Copyright 2013-2014 the original author or authors.
- *
+ * Copyright 2013-2017 the original author or authors.
+ *
* 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.
@@ -15,11 +15,10 @@
*/
package org.springframework.cassandra.core.keyspace;
-import static org.springframework.cassandra.core.Ordering.ASCENDING;
-import static org.springframework.cassandra.core.PrimaryKeyType.CLUSTERED;
-import static org.springframework.cassandra.core.PrimaryKeyType.PARTITIONED;
-import static org.springframework.cassandra.core.cql.CqlIdentifier.cqlId;
-import static org.springframework.cassandra.core.cql.CqlStringUtils.noNull;
+import static org.springframework.cassandra.core.Ordering.*;
+import static org.springframework.cassandra.core.PrimaryKeyType.*;
+import static org.springframework.cassandra.core.cql.CqlIdentifier.*;
+import static org.springframework.cassandra.core.cql.CqlStringUtils.*;
import org.springframework.cassandra.core.Ordering;
import org.springframework.cassandra.core.PrimaryKeyType;
@@ -35,7 +34,7 @@ import com.datastax.driver.core.DataType;
* a clustered PRIMARY KEY column, use {@link #clustered()} or {@link #clustered(Ordering)}. To specify
* that the PRIMARY KEY column is or is part of the partition key, use {@link #partitioned()} instead of
* {@link #clustered()} or {@link #clustered(Ordering)}.
- *
+ *
* @author Matthew T. Adams
* @author Alex Shvid
*/
@@ -53,7 +52,7 @@ public class ColumnSpecification {
/**
* Sets the column's name.
- *
+ *
* @return this
*/
public ColumnSpecification name(String name) {
@@ -61,14 +60,15 @@ public class ColumnSpecification {
}
public ColumnSpecification name(CqlIdentifier name) {
- Assert.notNull(name);
+
+ Assert.notNull(name, "CqlIdentifier must not be null");
this.name = name;
return this;
}
/**
* Sets the column's type.
- *
+ *
* @return this
*/
public ColumnSpecification type(DataType type) {
@@ -79,7 +79,7 @@ public class ColumnSpecification {
/**
* Identifies this column as a primary key column that is also part of a partition key. Sets the column's
* {@link #keyType} to {@link PrimaryKeyType#PARTITIONED} and its {@link #ordering} to null.
- *
+ *
* @return this
*/
public ColumnSpecification partitioned() {
@@ -90,7 +90,7 @@ public class ColumnSpecification {
* Toggles the identification of this column as a primary key column that also is or is part of a partition key. Sets
* {@link #ordering} to null and, if the given boolean is true, then sets the column's
* {@link #keyType} to {@link PrimaryKeyType#PARTITIONED}, else sets it to null.
- *
+ *
* @return this
*/
public ColumnSpecification partitioned(boolean partitioned) {
@@ -102,7 +102,7 @@ public class ColumnSpecification {
/**
* Identifies this column as a clustered key column with default ordering. Sets the column's {@link #keyType} to
* {@link PrimaryKeyType#CLUSTERED} and its {@link #ordering} to {@link #DEFAULT_ORDERING}.
- *
+ *
* @return this
*/
public ColumnSpecification clustered() {
@@ -112,7 +112,7 @@ public class ColumnSpecification {
/**
* Identifies this column as a clustered key column with the given ordering. Sets the column's {@link #keyType} to
* {@link PrimaryKeyType#CLUSTERED} and its {@link #ordering} to the given {@link Ordering}.
- *
+ *
* @return this
*/
public ColumnSpecification clustered(Ordering order) {
@@ -123,7 +123,7 @@ public class ColumnSpecification {
* Toggles the identification of this column as a clustered key column. If the given boolean is true,
* then sets the column's {@link #keyType} to {@link PrimaryKeyType#PARTITIONED} and {@link #ordering} to the given
* {@link Ordering} , else sets both {@link #keyType} and {@link #ordering} to null.
- *
+ *
* @return this
*/
public ColumnSpecification clustered(Ordering order, boolean primary) {
@@ -134,7 +134,7 @@ public class ColumnSpecification {
/**
* Sets the column's {@link #keyType}.
- *
+ *
* @return this
*/
ColumnSpecification keyType(PrimaryKeyType keyType) {
@@ -144,7 +144,7 @@ public class ColumnSpecification {
/**
* Sets the column's {@link #ordering}.
- *
+ *
* @return this
*/
ColumnSpecification ordering(Ordering ordering) {
diff --git a/spring-cql/src/main/java/org/springframework/cassandra/core/keyspace/CreateIndexSpecification.java b/spring-cql/src/main/java/org/springframework/cassandra/core/keyspace/CreateIndexSpecification.java
index f3d046472..e16356251 100644
--- a/spring-cql/src/main/java/org/springframework/cassandra/core/keyspace/CreateIndexSpecification.java
+++ b/spring-cql/src/main/java/org/springframework/cassandra/core/keyspace/CreateIndexSpecification.java
@@ -1,12 +1,12 @@
/*
- * Copyright 2013-2014 the original author or authors.
- *
+ * Copyright 2013-2017 the original author or authors.
+ *
* 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.
@@ -15,7 +15,7 @@
*/
package org.springframework.cassandra.core.keyspace;
-import static org.springframework.cassandra.core.cql.CqlIdentifier.cqlId;
+import static org.springframework.cassandra.core.cql.CqlIdentifier.*;
import org.springframework.cassandra.core.cql.CqlIdentifier;
import org.springframework.util.Assert;
@@ -23,12 +23,12 @@ import org.springframework.util.StringUtils;
/**
* Builder class to construct a CREATE INDEX specification.
- *
+ *
* @author Matthew T. Adams
* @author David Webb
*/
-public class CreateIndexSpecification extends IndexNameSpecification implements
- IndexDescriptor {
+public class CreateIndexSpecification extends IndexNameSpecification
+ implements IndexDescriptor {
/**
* Entry point into the {@link CreateIndexSpecification}'s fluent API to create a index. Convenient if imported
@@ -62,7 +62,7 @@ public class CreateIndexSpecification extends IndexNameSpecificationIF NOT EXISTS clause.
- *
+ *
* @return this
*/
public CreateIndexSpecification ifNotExists() {
@@ -71,7 +71,7 @@ public class CreateIndexSpecification extends IndexNameSpecificationIF NOT EXISTS clause.
- *
+ *
* @return this
*/
public CreateIndexSpecification ifNotExists(boolean ifNotExists) {
@@ -113,7 +113,7 @@ public class CreateIndexSpecification extends IndexNameSpecification The subtype of the {@link IndexNameSpecification}
* @author David Webb
* @author Matthew T. Adams
+ * @author Mark Paluch
*/
public abstract class IndexNameSpecification> {
@@ -36,7 +37,7 @@ public abstract class IndexNameSpecification
/**
* Sets the index name.
- *
+ *
* @return this
*/
public T name(String name) {
@@ -45,7 +46,8 @@ public abstract class IndexNameSpecification
@SuppressWarnings("unchecked")
public T name(CqlIdentifier name) {
- Assert.notNull(name);
+
+ Assert.notNull(name, "CqlIdentifier must not be null");
this.name = name;
return (T) this;
}
diff --git a/spring-cql/src/main/java/org/springframework/cassandra/core/keyspace/KeyspaceActionSpecification.java b/spring-cql/src/main/java/org/springframework/cassandra/core/keyspace/KeyspaceActionSpecification.java
index 16250b7b2..180e3ca59 100644
--- a/spring-cql/src/main/java/org/springframework/cassandra/core/keyspace/KeyspaceActionSpecification.java
+++ b/spring-cql/src/main/java/org/springframework/cassandra/core/keyspace/KeyspaceActionSpecification.java
@@ -1,12 +1,12 @@
/*
- * Copyright 2013-2014 the original author or authors.
- *
+ * Copyright 2013-2017 the original author or authors.
+ *
* 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.
@@ -15,14 +15,14 @@
*/
package org.springframework.cassandra.core.keyspace;
-import static org.springframework.cassandra.core.cql.KeyspaceIdentifier.ksId;
+import static org.springframework.cassandra.core.cql.KeyspaceIdentifier.*;
import org.springframework.cassandra.core.cql.KeyspaceIdentifier;
import org.springframework.util.Assert;
/**
* Abstract builder class to support the construction of keyspace specifications.
- *
+ *
* @author John McPeek
* @author David Webb
* @param The subtype of the {@link KeyspaceActionSpecification}
@@ -36,7 +36,7 @@ public abstract class KeyspaceActionSpecification The subtype of the {@link TableNameSpecification}
*/
@@ -35,7 +35,7 @@ public abstract class TableNameSpecification
/**
* Sets the table name.
- *
+ *
* @return this
*/
public T name(String name) {
@@ -44,7 +44,8 @@ public abstract class TableNameSpecification
@SuppressWarnings("unchecked")
public T name(CqlIdentifier name) {
- Assert.notNull(name);
+
+ Assert.notNull(name, "CqlIdentifier must not be null");
this.name = name;
return (T) this;
}
diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/convert/BasicCassandraRowValueProvider.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/convert/BasicCassandraRowValueProvider.java
index 47d28244d..713a1b75c 100644
--- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/convert/BasicCassandraRowValueProvider.java
+++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/convert/BasicCassandraRowValueProvider.java
@@ -1,12 +1,12 @@
/*
- * Copyright 2013-2016 the original author or authors
- *
+ * Copyright 2013-2017 the original author or authors
+ *
* 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.
@@ -17,7 +17,6 @@ package org.springframework.data.cassandra.convert;
import org.springframework.data.cassandra.mapping.CassandraPersistentProperty;
import org.springframework.data.mapping.model.DefaultSpELExpressionEvaluator;
-import org.springframework.data.mapping.model.PropertyValueProvider;
import org.springframework.data.mapping.model.SpELExpressionEvaluator;
import org.springframework.util.Assert;
@@ -25,7 +24,7 @@ import com.datastax.driver.core.Row;
/**
* {@link CassandraValueProvider} to read property values from a {@link Row}.
- *
+ *
* @author Alex Shvid
* @author Matthew T. Adams
* @author David Webb
@@ -39,14 +38,14 @@ public class BasicCassandraRowValueProvider implements CassandraRowValueProvider
/**
* Creates a new {@link BasicCassandraRowValueProvider} with the given {@link Row} and
* {@link DefaultSpELExpressionEvaluator}.
- *
+ *
* @param source must not be {@literal null}.
* @param evaluator must not be {@literal null}.
*/
public BasicCassandraRowValueProvider(Row source, DefaultSpELExpressionEvaluator evaluator) {
- Assert.notNull(source);
- Assert.notNull(evaluator);
+ Assert.notNull(source, "Source Row must not be null");
+ Assert.notNull(evaluator, "DefaultSpELExpressionEvaluator must not be null");
this.reader = new ColumnReader(source);
this.evaluator = evaluator;
diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/convert/ConverterRegistration.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/convert/ConverterRegistration.java
index 16b6df9b3..1b99a9832 100644
--- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/convert/ConverterRegistration.java
+++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/convert/ConverterRegistration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 the original author or authors.
+ * Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,7 +40,7 @@ class ConverterRegistration {
*/
public ConverterRegistration(ConvertiblePair convertiblePair, boolean isReading, boolean isWriting) {
- Assert.notNull(convertiblePair);
+ Assert.notNull(convertiblePair, "ConvertiblePair must not be null");
this.convertiblePair = convertiblePair;
this.reading = isReading;
diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/convert/CustomConversions.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/convert/CustomConversions.java
index 01b7d582e..a93a891a6 100644
--- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/convert/CustomConversions.java
+++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/convert/CustomConversions.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 the original author or authors.
+ * Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -83,7 +83,7 @@ public class CustomConversions {
*/
public CustomConversions(List> converters) {
- Assert.notNull(converters);
+ Assert.notNull(converters, "List of converters must not be null");
this.readingPairs = new LinkedHashSet();
this.writingPairs = new LinkedHashSet();
@@ -249,9 +249,9 @@ public class CustomConversions {
}
/**
- * Returns the target type we can inject of the given source type to. The returned type might
- * be a subclass of the given expected type though. If {@code expectedTargetType} is {@literal null} we will simply
- * return the first target type matching or {@literal null} if no conversion can be found.
+ * Returns the target type we can inject of the given source type to. The returned type might be a subclass of the
+ * given expected type though. If {@code expectedTargetType} is {@literal null} we will simply return the first target
+ * type matching or {@literal null} if no conversion can be found.
*
* @param sourceType must not be {@literal null}
* @param requestedTargetType
@@ -274,8 +274,8 @@ public class CustomConversions {
}
/**
- * Returns whether we have a custom conversion registered into a Cassandra native type. The
- * returned type might be a subclass of the given expected type though.
+ * Returns whether we have a custom conversion registered into a Cassandra native type. The returned type might be a
+ * subclass of the given expected type though.
*
* @param sourceType must not be {@literal null}
* @return
@@ -285,8 +285,8 @@ public class CustomConversions {
}
/**
- * Returns whether we have a custom conversion registered to an object of the given source type
- * into an object of the given Cassandra native target type.
+ * Returns whether we have a custom conversion registered to an object of the given source type into an object of the
+ * given Cassandra native target type.
*
* @param sourceType must not be {@literal null}.
* @param requestedTargetType
@@ -297,8 +297,7 @@ public class CustomConversions {
}
/**
- * Returns whether we have a custom conversion registered to the given source into the given target
- * type.
+ * Returns whether we have a custom conversion registered to the given source into the given target type.
*
* @param sourceType must not be {@literal null}
* @param requestedTargetType must not be {@literal null}
@@ -344,8 +343,8 @@ public class CustomConversions {
private static Class> getCustomTarget(Class> sourceType, Class> requestedTargetType,
Collection pairs) {
- Assert.notNull(sourceType);
- Assert.notNull(pairs);
+ Assert.notNull(sourceType, "Source Class must not be null");
+ Assert.notNull(pairs, "Collection of ConvertiblePair must not be null");
if (requestedTargetType != null && pairs.contains(new ConvertiblePair(sourceType, requestedTargetType))) {
return requestedTargetType;
@@ -383,7 +382,7 @@ public class CustomConversions {
Class> type = producer.get();
- cache.put(key, CacheValue.>ofNullable(type));
+ cache.put(key, CacheValue.> ofNullable(type));
return type;
}
diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/CassandraConverterRowCallback.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/CassandraConverterRowCallback.java
index bcd1fb9b4..9c992f4d0 100644
--- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/CassandraConverterRowCallback.java
+++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/CassandraConverterRowCallback.java
@@ -1,12 +1,12 @@
/*
- * Copyright 2013-2014 the original author or authors
- *
+ * Copyright 2013-2017 the original author or authors
+ *
* 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.
@@ -24,7 +24,7 @@ import com.datastax.driver.core.Row;
/**
* Simple {@link RowCallback} that will transform a {@link Row} into the given target type using the given
* {@link CassandraConverter}.
- *
+ *
* @author Alex Shvid
* @author Matthew T. Adams
*/
@@ -35,8 +35,8 @@ public class CassandraConverterRowCallback implements RowCallback {
public CassandraConverterRowCallback(CassandraConverter reader, Class type) {
- Assert.notNull(reader);
- Assert.notNull(type);
+ Assert.notNull(reader, "CassandraConverter must not be null");
+ Assert.notNull(type, "Target class must not be null");
this.reader = reader;
this.type = type;
diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/mapping/BasicCassandraPersistentEntity.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/mapping/BasicCassandraPersistentEntity.java
index 050cadb51..9f6886a81 100644
--- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/mapping/BasicCassandraPersistentEntity.java
+++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/mapping/BasicCassandraPersistentEntity.java
@@ -20,8 +20,6 @@ import static org.springframework.cassandra.core.cql.CqlIdentifier.*;
import java.util.ArrayList;
import java.util.List;
-import com.datastax.driver.core.UserType;
-
import org.springframework.beans.BeansException;
import org.springframework.cassandra.core.cql.CqlIdentifier;
import org.springframework.cassandra.support.exception.UnsupportedCassandraOperationException;
@@ -40,6 +38,8 @@ import org.springframework.expression.spel.support.StandardEvaluationContext;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
+import com.datastax.driver.core.UserType;
+
/**
* Cassandra specific {@link BasicPersistentEntity} implementation that adds Cassandra specific metadata.
*
@@ -51,8 +51,7 @@ import org.springframework.util.StringUtils;
public class BasicCassandraPersistentEntity extends BasicPersistentEntity
implements CassandraPersistentEntity, ApplicationContextAware {
- protected static final CassandraPersistentEntityMetadataVerifier DEFAULT_VERIFIER =
- new CompositeCassandraPersistentEntityMetadataVerifier();
+ protected static final CassandraPersistentEntityMetadataVerifier DEFAULT_VERIFIER = new CompositeCassandraPersistentEntityMetadataVerifier();
protected ApplicationContext context;
@@ -124,8 +123,8 @@ public class BasicCassandraPersistentEntity extends BasicPersistentEntity properties = new ArrayList();
- Assert.state(isCompositePrimaryKey(), String.format("[%s] does not represent a composite primary key class",
- this.getType().getName()));
+ Assert.state(isCompositePrimaryKey(),
+ String.format("[%s] does not represent a composite primary key class", this.getType().getName()));
addCompositePrimaryKeyProperties(this, properties);
@@ -189,7 +188,8 @@ public class BasicCassandraPersistentEntity extends BasicPersistentEntity columnNames) {
- Assert.notNull(columnNames);
+ Assert.notNull(columnNames, "List of column names must not be null");
// force calculation of columnNames if not known yet
getColumnNames();
- Assert.state(this.columnNames.size() == columnNames.size(), String.format(
- "Property [%s] of entity [%s] is mapped to [%s] column%s, but given column name list has size [%s]",
- getName(), getOwner().getType().getName(), this.columnNames.size(), this.columnNames.size() == 1 ? "" : "s",
- columnNames.size()));
+ Assert.state(this.columnNames.size() == columnNames.size(),
+ String.format(
+ "Property [%s] of entity [%s] is mapped to [%s] column%s, but given column name list has size [%s]",
+ getName(), getOwner().getType().getName(), this.columnNames.size(), this.columnNames.size() == 1 ? "" : "s",
+ columnNames.size()));
- this.columnNames = this.explicitColumnNames =
- Collections.unmodifiableList(new ArrayList(columnNames));
+ this.columnNames = this.explicitColumnNames = Collections
+ .unmodifiableList(new ArrayList(columnNames));
}
@Override
diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/mapping/EntityMapping.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/mapping/EntityMapping.java
index 5a93d9641..9d3db786f 100644
--- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/mapping/EntityMapping.java
+++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/mapping/EntityMapping.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2014 the original author or authors
+ * Copyright 2013-2017 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -65,7 +65,8 @@ public class EntityMapping {
}
public void setEntityClassName(String entityClassName) {
- Assert.hasText(entityClassName);
+
+ Assert.hasText(entityClassName, "Entity class name must not be null or empty");
this.entityClassName = entityClassName;
}
@@ -74,7 +75,8 @@ public class EntityMapping {
}
public void setForceQuote(String forceQuote) {
- Assert.notNull(forceQuote);
+
+ Assert.notNull(forceQuote, "Force quote must not be null or empty");
this.forceQuote = forceQuote;
}
@@ -84,7 +86,7 @@ public class EntityMapping {
public void setPropertyMappings(Map propertyMappings) {
this.propertyMappings = (propertyMappings != null ? new HashMap(propertyMappings)
- : Collections.emptyMap());
+ : Collections. emptyMap());
}
public String getTableName() {
@@ -92,7 +94,8 @@ public class EntityMapping {
}
public void setTableName(String tableName) {
- Assert.notNull(tableName);
+
+ Assert.notNull(tableName, "Table name must not be null or empty");
this.tableName = tableName;
}
@@ -112,8 +115,8 @@ public class EntityMapping {
EntityMapping that = (EntityMapping) obj;
return ObjectUtils.nullSafeEquals(this.getEntityClassName(), that.getEntityClassName())
- && ObjectUtils.nullSafeEquals(this.getForceQuote(), that.getForceQuote())
- && ObjectUtils.nullSafeEquals(this.getTableName(), that.getTableName());
+ && ObjectUtils.nullSafeEquals(this.getForceQuote(), that.getForceQuote())
+ && ObjectUtils.nullSafeEquals(this.getTableName(), that.getTableName());
}
/**
@@ -134,9 +137,8 @@ public class EntityMapping {
@Override
public String toString() {
return String.format(
- "{ @type = %1$s, entityClassName = %2$s, tableName = %3$s, forceQuote = %4$s, propertyMappings = %5$s }",
- getClass().getName(), getEntityClassName(), getTableName(), getForceQuote(),
- toString(getPropertyMappings()));
+ "{ @type = %1$s, entityClassName = %2$s, tableName = %3$s, forceQuote = %4$s, propertyMappings = %5$s }",
+ getClass().getName(), getEntityClassName(), getTableName(), getForceQuote(), toString(getPropertyMappings()));
}
/* (non-Javadoc) */
diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/mapping/PropertyMapping.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/mapping/PropertyMapping.java
index fd80ca413..34a411979 100644
--- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/mapping/PropertyMapping.java
+++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/mapping/PropertyMapping.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2014 the original author or authors
+ * Copyright 2013-2017 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -49,7 +49,8 @@ public class PropertyMapping {
}
public void setColumnName(String columnName) {
- Assert.notNull(columnName);
+
+ Assert.notNull(columnName, "Column name must not be null");
this.columnName = columnName;
}
@@ -66,7 +67,8 @@ public class PropertyMapping {
}
public void setPropertyName(String propertyName) {
- Assert.notNull(propertyName);
+
+ Assert.notNull(propertyName, "Property name must not be null");
this.propertyName = propertyName;
}
@@ -86,8 +88,8 @@ public class PropertyMapping {
PropertyMapping that = (PropertyMapping) obj;
return ObjectUtils.nullSafeEquals(this.getPropertyName(), that.getPropertyName())
- && ObjectUtils.nullSafeEquals(this.getColumnName(), that.getColumnName())
- && ObjectUtils.nullSafeEquals(this.getForceQuote(), that.getForceQuote());
+ && ObjectUtils.nullSafeEquals(this.getColumnName(), that.getColumnName())
+ && ObjectUtils.nullSafeEquals(this.getForceQuote(), that.getForceQuote());
}
/**
@@ -108,6 +110,6 @@ public class PropertyMapping {
@Override
public String toString() {
return String.format("{ @type = %1$s, propertyName = %2$s, columnName = %3$s, forceQuote = %4$s }",
- getClass().getName(), getPropertyName(), getColumnName(), getForceQuote());
+ getClass().getName(), getPropertyName(), getColumnName(), getForceQuote());
}
}
diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/BasicMapId.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/BasicMapId.java
index 8f508ba7b..4b4be5f90 100644
--- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/BasicMapId.java
+++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/BasicMapId.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2017 the original author or authors.
+ *
+ * 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 org.springframework.data.cassandra.repository.support;
import java.io.Serializable;
@@ -17,15 +32,16 @@ import org.springframework.util.Assert;
* Note: This could be extended in various cool ways, like one that takes a type and validates that the given
* name corresponds to an actual field or bean property on that type. There could also be another one that uses a
* {@link CassandraPersistentEntity} and {@link CassandraPersistentProperty} instead of a String name.
- *
+ *
* @author Matthew T. Adams
+ * @author Mark Paluch
*/
@SuppressWarnings("serial")
public class BasicMapId implements MapId {
/**
* Factory method. Convenient if imported statically.
- *
+ *
* @return {@link BasicMapId}
*/
public static MapId id() {
@@ -34,7 +50,7 @@ public class BasicMapId implements MapId {
/**
* Factory method. Convenient if imported statically.
- *
+ *
* @return {@link BasicMapId}
*/
public static MapId id(String name, Serializable value) {
@@ -43,7 +59,7 @@ public class BasicMapId implements MapId {
/**
* Factory method. Convenient if imported statically.
- *
+ *
* @return {@link BasicMapId}
*/
public static MapId id(MapId id) {
@@ -56,7 +72,7 @@ public class BasicMapId implements MapId {
public BasicMapId(Map map) {
- Assert.notNull(map);
+ Assert.notNull(map, "Map must not be null");
this.map.putAll(map);
}
diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/CassandraRepositoryFactory.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/CassandraRepositoryFactory.java
index af0a9ea18..5938b671f 100644
--- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/CassandraRepositoryFactory.java
+++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/CassandraRepositoryFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2016 the original author or authors
+ * Copyright 2013-2017 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -62,7 +62,7 @@ public class CassandraRepositoryFactory extends RepositoryFactorySupport {
*/
public CassandraRepositoryFactory(CassandraOperations operations) {
- Assert.notNull(operations);
+ Assert.notNull(operations, "CassandraOperations must not be null");
this.operations = operations;
this.mappingContext = operations.getConverter().getMappingContext();
diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/MapIdFactory.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/MapIdFactory.java
index 9d5626c67..a9d95bd7d 100644
--- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/MapIdFactory.java
+++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/MapIdFactory.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2017 the original author or authors.
+ *
+ * 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 org.springframework.data.cassandra.repository.support;
import java.io.Serializable;
@@ -9,9 +24,10 @@ import org.springframework.util.Assert;
/**
* Factory class for producing implementations of given id interfaces. For restrictions on id interfaces definitions,
* see {@link IdInterfaceValidator#validate(Class)}.
- *
+ *
* @see IdInterfaceValidator#validate(Class)
* @author Matthew T. Adams
+ * @author Mark Paluch
*/
@SuppressWarnings("unchecked")
public class MapIdFactory {
@@ -20,13 +36,14 @@ public class MapIdFactory {
* Produces an implementation of the given id interface type using the type's class loader. For restrictions on id
* interfaces definitions, see {@link IdInterfaceValidator#validate(Class)}. Returns an implementation of the given
* interface that also implements {@link MapId} and {@link Serializable}, so it can be cast as such if necessary.
- *
+ *
* @param idInterface The type of the id interface.
* @return An implementation of the given interface that also implements {@link MapId} and {@link Serializable}.
* @see IdInterfaceValidator#validate(Class)
*/
public static T id(Class idInterface) {
- Assert.notNull(idInterface);
+
+ Assert.notNull(idInterface, "Interface class must not be null");
return id(idInterface, idInterface.getClassLoader());
}
@@ -34,7 +51,7 @@ public class MapIdFactory {
* Produces an implementation of the given class loader. For restrictions on id interfaces definitions, see
* {@link IdInterfaceValidator#validate(Class)}. Returns an implementation of the given interface that also implements
* {@link MapId} and {@link Serializable}, so it can be cast as such if necessary.
- *
+ *
* @param idInterface The type of the id interface.
* @return An implementation of the given interface that also implements {@link MapId} and {@link Serializable}.
* @see IdInterfaceValidator#validate(Class)
diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/MappingCassandraEntityInformation.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/MappingCassandraEntityInformation.java
index 320759d40..066903dcb 100644
--- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/MappingCassandraEntityInformation.java
+++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/MappingCassandraEntityInformation.java
@@ -1,12 +1,12 @@
/*
- * Copyright 2013-2014 the original author or authors
- *
+ * Copyright 2013-2017 the original author or authors
+ *
* 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.
@@ -30,7 +30,7 @@ import org.springframework.util.Assert;
* {@link CassandraEntityInformation} implementation using a {@link CassandraPersistentEntity} instance to lookup the
* necessary information. Can be configured with a custom collection to be returned which will trump the one returned by
* the {@link CassandraPersistentEntity} if given.
- *
+ *
* @author Alex Shvid
* @author Matthew T. Adams
*/
@@ -42,7 +42,7 @@ public class MappingCassandraEntityInformation exten
/**
* Creates a new {@link MappingCassandraEntityInformation} for the given {@link CassandraPersistentEntity}.
- *
+ *
* @param entity must not be {@literal null}.
*/
public MappingCassandraEntityInformation(CassandraPersistentEntity entity, CassandraConverter converter) {
@@ -57,7 +57,7 @@ public class MappingCassandraEntityInformation exten
@Override
public ID getId(T entity) {
- Assert.notNull(entity);
+ Assert.notNull(entity, "Entity must not be null");
CassandraPersistentProperty idProperty = entityMetadata.getIdProperty();
diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/ReactiveCassandraRepositoryFactory.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/ReactiveCassandraRepositoryFactory.java
index 3ac1f478a..4044eadcb 100644
--- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/ReactiveCassandraRepositoryFactory.java
+++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/ReactiveCassandraRepositoryFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 the original author or authors.
+ * Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -58,7 +58,7 @@ public class ReactiveCassandraRepositoryFactory extends ReactiveRepositoryFactor
*/
public ReactiveCassandraRepositoryFactory(ReactiveCassandraOperations cassandraOperations) {
- Assert.notNull(cassandraOperations);
+ Assert.notNull(cassandraOperations, "ReactiveCassandraOperations must not be null");
this.operations = cassandraOperations;
this.mappingContext = cassandraOperations.getConverter().getMappingContext();
diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/SimpleCassandraRepository.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/SimpleCassandraRepository.java
index 35ad1ee8f..43aefc45d 100644
--- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/SimpleCassandraRepository.java
+++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/SimpleCassandraRepository.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2016 the original author or authors
+ * Copyright 2013-2017 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,9 +18,6 @@ package org.springframework.data.cassandra.repository.support;
import java.io.Serializable;
import java.util.List;
-import com.datastax.driver.core.querybuilder.QueryBuilder;
-import com.datastax.driver.core.querybuilder.Select;
-
import org.springframework.cassandra.core.util.CollectionUtils;
import org.springframework.data.cassandra.core.CassandraOperations;
import org.springframework.data.cassandra.core.CassandraTemplate;
@@ -28,6 +25,9 @@ import org.springframework.data.cassandra.repository.TypedIdCassandraRepository;
import org.springframework.data.cassandra.repository.query.CassandraEntityInformation;
import org.springframework.util.Assert;
+import com.datastax.driver.core.querybuilder.QueryBuilder;
+import com.datastax.driver.core.querybuilder.Select;
+
/**
* Repository base implementation for Cassandra.
*
@@ -49,8 +49,8 @@ public class SimpleCassandraRepository implements Ty
*/
public SimpleCassandraRepository(CassandraEntityInformation metadata, CassandraOperations operations) {
- Assert.notNull(operations);
- Assert.notNull(metadata);
+ Assert.notNull(metadata, "CassandraEntityInformation must not be null");
+ Assert.notNull(operations, "CassandraOperations must not be null");
this.entityInformation = metadata;
this.operations = operations;
diff --git a/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/test/integration/composites/Comment.java b/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/test/integration/composites/Comment.java
index a602e9355..3452ddd1b 100644
--- a/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/test/integration/composites/Comment.java
+++ b/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/test/integration/composites/Comment.java
@@ -40,7 +40,7 @@ public class Comment {
}
public Comment(CommentKey pk) {
- Assert.notNull(pk);
+ Assert.notNull(pk, "CommentKey must not be null");
this.pk = pk;
}
diff --git a/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/test/integration/repository/querymethods/datekey/DateThing.java b/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/test/integration/repository/querymethods/datekey/DateThing.java
index faf710c29..ad8a455bf 100644
--- a/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/test/integration/repository/querymethods/datekey/DateThing.java
+++ b/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/test/integration/repository/querymethods/datekey/DateThing.java
@@ -41,7 +41,8 @@ public class DateThing {
}
public void setDate(Date date) {
- Assert.notNull(date);
+
+ Assert.notNull(date, "Date must not be null");
this.date = new Date(date.getTime());
}
}