Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanClassLoaderAware;
import org.springframework.context.ApplicationContext;
Expand Down Expand Up @@ -85,6 +84,7 @@
* @author Antoine Toulme
* @author John Blum
* @author Christoph Strobl
* @author Frank Spitulski
*/
public class MappingCassandraConverter extends AbstractCassandraConverter
implements ApplicationContextAware, BeanClassLoaderAware {
Expand Down Expand Up @@ -521,7 +521,7 @@ private void writeWhereFromObject(Object source, Where sink, CassandraPersistent

Object id = extractId(source, entity);

Assert.notNull(id, String.format("No Id value found in object %s", source));
Assert.notNull(id, () -> String.format("No Id value found in object %s", source));

CassandraPersistentProperty idProperty = entity.getIdProperty();
CassandraPersistentProperty compositeIdProperty = null;
Expand Down Expand Up @@ -600,7 +600,7 @@ private void writeWhere(MapId id, Where sink, CassandraPersistentEntity<?> entit
private void writeWhere(ConvertingPropertyAccessor<?> accessor, Where sink, CassandraPersistentEntity<?> entity) {

Assert.isTrue(entity.isCompositePrimaryKey(),
String.format("Entity [%s] is not a composite primary key", entity.getName()));
() -> String.format("Entity [%s] is not a composite primary key", entity.getName()));

for (CassandraPersistentProperty property : entity) {
TypeCodec<Object> codec = getCodec(property);
Expand Down Expand Up @@ -684,7 +684,7 @@ public Object getId(Object object, CassandraPersistentEntity<?> entity) {
ConvertingPropertyAccessor<?> propertyAccessor = newConvertingPropertyAccessor(object, entity);

Assert.isTrue(entity.getType().isAssignableFrom(object.getClass()),
String.format("Given instance of type [%s] is not compatible with expected type [%s]",
() -> String.format("Given instance of type [%s] is not compatible with expected type [%s]",
object.getClass().getName(), entity.getType().getName()));

if (object instanceof MapIdentifiable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
* Helpful class to read a column's value from a row, with possible type conversion.
*
* @author Mark Paluch
* @author Frank Spitulski
* @since 3.0
*/
class RowReader {
Expand Down Expand Up @@ -165,7 +166,7 @@ private int getColumnIndex(String columnName) {

int index = columns.firstIndexOf(columnName);

Assert.isTrue(index > -1, String.format("Column [%s] does not exist in table", columnName));
Assert.isTrue(index > -1, () -> String.format("Column [%s] does not exist in table", columnName));

return index;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
*
* @author Fabio J. Mendes
* @author Mark Paluch
* @author Frank Spitulski
* @since 1.5
* @see AlterUserTypeSpecification
* @see AddColumnSpecification
Expand Down Expand Up @@ -58,7 +59,7 @@ public StringBuilder toCql(StringBuilder cql) {
Assert.notNull(getSpecification().getName(), "User type name must not be null");

Assert.isTrue(!getSpecification().getChanges().isEmpty(),
String.format("User type [%s] does not contain fields", getSpecification().getName()));
() -> String.format("User type [%s] does not contain fields", getSpecification().getName()));

return changesCql(preambleCql(cql)).append(";");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*
* @author Fabio J. Mendes
* @author Mark Paluch
* @author Frank Spitulski
* @since 1.5
* @see CreateUserTypeSpecification
*/
Expand Down Expand Up @@ -52,7 +53,7 @@ public StringBuilder toCql(StringBuilder cql) {
Assert.notNull(getSpecification().getName(), "User type name must not be null");

Assert.isTrue(!getSpecification().getFields().isEmpty(),
String.format("User type [%s] does not contain fields", getSpecification().getName().asCql(true)));
() -> String.format("User type [%s] does not contain fields", getSpecification().getName().asCql(true)));

return columns(preambleCql(cql)).append(";");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
* Cassandra Tuple specific {@link CassandraPersistentProperty} implementation.
*
* @author Mark Paluch
* @author Frank Spitulski
* @since 2.1
* @see Element
*/
Expand Down Expand Up @@ -68,7 +69,8 @@ private Integer findOrdinal() {
}

Assert.isTrue(ordinal >= 0,
String.format("Element ordinal must be greater or equal to zero for property [%s] in entity [%s]", getName(),
() -> String.format("Element ordinal must be greater or equal to zero for property [%s] in entity [%s]",
getName(),
getOwner().getName()));

return ordinal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
* @author Mark Paluch
* @author John Blum
* @author Christoph Strobl
* @author Frank Spitulski
*/
public interface CassandraPersistentProperty
extends PersistentProperty<CassandraPersistentProperty>, ApplicationContextAware {
Expand Down Expand Up @@ -81,8 +82,8 @@ default CqlIdentifier getRequiredColumnName() {

CqlIdentifier columnName = getColumnName();

Assert.state(columnName != null, String.format("No column name available for this persistent property [%1$s.%2$s]",
getOwner().getName(), getName()));
Assert.state(columnName != null, () -> String
.format("No column name available for this persistent property [%1$s.%2$s]", getOwner().getName(), getName()));

return columnName;
}
Expand Down Expand Up @@ -115,7 +116,7 @@ default int getRequiredOrdinal() {

Integer ordinal = getOrdinal();

Assert.state(ordinal != null, String.format("No ordinal available for this persistent property [%1$s.%2$s]",
Assert.state(ordinal != null, () -> String.format("No ordinal available for this persistent property [%1$s.%2$s]",
getOwner().getName(), getName()));

return ordinal;
Expand Down