DATACASS-576 - Formatting.

Reorder methods for consistent method ordering.
This commit is contained in:
Mark Paluch
2019-01-30 21:13:00 +01:00
committed by John Blum
parent 7a8f91ade3
commit 16268f101f
7 changed files with 40 additions and 58 deletions

View File

@@ -778,7 +778,6 @@ public class AsyncCassandraTemplate implements AsyncCassandraOperations, Applica
return session.getCluster().getConfiguration().getQueryOptions().getFetchSize();
}
@SuppressWarnings("ConstantConditions")
private int getEffectiveFetchSize(Statement statement) {
if (statement.getFetchSize() > 0) {

View File

@@ -801,6 +801,24 @@ public class ReactiveCassandraTemplate implements ReactiveCassandraOperations, A
return getMappingContext().getRequiredPersistentEntity(ClassUtils.getUserClass(entityType));
}
@SuppressWarnings("ConstantConditions")
private Mono<Integer> getEffectiveFetchSize(Statement statement) {
if (statement.getFetchSize() > 0) {
return Mono.just(statement.getFetchSize());
}
if (getReactiveCqlOperations() instanceof CassandraAccessor) {
CassandraAccessor accessor = (CassandraAccessor) getReactiveCqlOperations();
if (accessor.getFetchSize() != -1) {
return Mono.just(accessor.getFetchSize());
}
}
return getReactiveCqlOperations().execute((ReactiveSessionCallback<Integer>) session -> Mono
.just(session.getCluster().getConfiguration().getQueryOptions().getFetchSize())).single();
}
@SuppressWarnings("unchecked")
private <T> Function<Row, T> getMapper(Class<?> entityType, Class<T> targetType, CqlIdentifier tableName) {
@@ -840,24 +858,6 @@ public class ReactiveCassandraTemplate implements ReactiveCassandraOperations, A
return converter;
}
@SuppressWarnings("ConstantConditions")
private Mono<Integer> getEffectiveFetchSize(Statement statement) {
if (statement.getFetchSize() > 0) {
return Mono.just(statement.getFetchSize());
}
if (getReactiveCqlOperations() instanceof CassandraAccessor) {
CassandraAccessor accessor = (CassandraAccessor) getReactiveCqlOperations();
if (accessor.getFetchSize() != -1) {
return Mono.just(accessor.getFetchSize());
}
}
return getReactiveCqlOperations().execute((ReactiveSessionCallback<Integer>) session -> Mono
.just(session.getCluster().getConfiguration().getQueryOptions().getFetchSize())).single();
}
@Value
static class StatementCallback implements ReactiveSessionCallback<WriteResult>, CqlProvider {

View File

@@ -132,9 +132,8 @@ public class QueryMapper {
Object value = predicate.getValue();
Object mappedValue = value != null
? getConverter().convertToColumnType(value, getTypeInformation(field, value))
: null;
Object mappedValue = value != null ? getConverter().convertToColumnType(value, getTypeInformation(field, value))
: null;
Predicate mappedPredicate = new Predicate(predicate.getOperator(), mappedValue);
@@ -166,9 +165,8 @@ public class QueryMapper {
Field field = createPropertyField(entity, column);
columns.getSelector(column).ifPresent(selector ->
getCqlIdentifier(column, field).ifPresent(cqlIdentifier ->
selectors.add(getMappedSelector(selector, cqlIdentifier))));
columns.getSelector(column).ifPresent(selector -> getCqlIdentifier(column, field)
.ifPresent(cqlIdentifier -> selectors.add(getMappedSelector(selector, cqlIdentifier))));
}
if (columns.isEmpty()) {
@@ -255,10 +253,8 @@ public class QueryMapper {
field.getProperty().ifPresent(seen::add);
columns.getSelector(column)
.filter(selector -> selector instanceof ColumnSelector)
.ifPresent(columnSelector ->
getCqlIdentifier(column, field).map(CqlIdentifier::toCql).ifPresent(columnNames::add));
columns.getSelector(column).filter(selector -> selector instanceof ColumnSelector).ifPresent(
columnSelector -> getCqlIdentifier(column, field).map(CqlIdentifier::toCql).ifPresent(columnNames::add));
}
if (columns.isEmpty()) {
@@ -333,7 +329,7 @@ public class QueryMapper {
Field createPropertyField(@Nullable CassandraPersistentEntity<?> entity, ColumnName key) {
return Optional.ofNullable(entity).<Field>map(e -> new MetadataBackedField(key, e, getMappingContext()))
return Optional.ofNullable(entity).<Field> map(e -> new MetadataBackedField(key, e, getMappingContext()))
.orElseGet(() -> new Field(key));
}
@@ -464,8 +460,8 @@ public class QueryMapper {
PropertyPath propertyPath = PropertyPath.from(pathExpression.replaceAll("\\.\\d", ""),
this.entity.getTypeInformation());
PersistentPropertyPath<CassandraPersistentProperty> persistentPropertyPath =
this.mappingContext.getPersistentPropertyPath(propertyPath);
PersistentPropertyPath<CassandraPersistentProperty> persistentPropertyPath = this.mappingContext
.getPersistentPropertyPath(propertyPath);
return Optional.of(persistentPropertyPath);
} catch (PropertyReferenceException e) {
@@ -473,18 +469,16 @@ public class QueryMapper {
}
}
/*
* (non-Javadoc)
* @see org.springframework.data.mongodb.core.convert.QueryMapper.Field#with(java.lang.String)
/* (non-Javadoc)
* @see org.springframework.data.cassandra.core.convert.QueryMapper.Field#with(org.springframework.data.cassandra.core.query.ColumnName)
*/
@Override
public MetadataBackedField with(ColumnName name) {
return new MetadataBackedField(name, entity, mappingContext, property);
}
/*
* (non-Javadoc)
* @see org.springframework.data.mongodb.core.convert.QueryMapper.Field#getProperty()
/* (non-Javadoc)
* @see org.springframework.data.cassandra.core.convert.QueryMapper.Field#getProperty()
*/
@Override
public Optional<CassandraPersistentProperty> getProperty() {

View File

@@ -43,7 +43,7 @@ abstract class SerializationUtils {
/**
* Serializes the given object into pseudo-CQL meaning it's trying to create a CQL representation as far as possible
* but falling back to the given object's {@link Object#toString()} method if it's not serializable. Useful for
* printing raw {@link Criteria}s containing complex values before actually converting them into Mongo native types.
* printing raw {@link Criteria}s containing complex values before actually converting them into CQL native types.
*
* @param criteria may be {@literal null}.
* @return may be {@literal null}.
@@ -64,7 +64,7 @@ abstract class SerializationUtils {
/**
* Serializes the given object into pseudo-CQL meaning it's trying to create a CQL representation as far as possible
* but falling back to the given object's {@link Object#toString()} method if it's not serializable. Useful for
* printing raw {@link Criteria}s containing complex values before actually converting them into Mongo native types.
* printing raw {@link Criteria}s containing complex values before actually converting them into CQL native types.
*
* @param value value to serialize to CQL, may be {@literal null}.
* @return the value as a serialized CQL {@link String}, may be {@literal null}.

View File

@@ -66,8 +66,7 @@ public class CassandraParametersParameterAccessor extends ParametersParameterAcc
: CassandraSimpleTypeHolder.getDataTypeFor(getParameterType(index)));
}
/*
* (non-Javadoc)
/* (non-Javadoc)
* @see org.springframework.data.cassandra.repository.query.CassandraParameterAccessor#findCassandraType(int)
*/
@Nullable
@@ -75,8 +74,7 @@ public class CassandraParametersParameterAccessor extends ParametersParameterAcc
return getParameters().getParameter(index).getCassandraType();
}
/*
* (non-Javadoc)
/* (non-Javadoc)
* @see org.springframework.data.cassandra.repository.query.CassandraParameterAccessor#getParameterType(int)
*/
@Override
@@ -84,8 +82,7 @@ public class CassandraParametersParameterAccessor extends ParametersParameterAcc
return getParameters().getParameter(index).getType();
}
/*
* (non-Javadoc)
/* (non-Javadoc)
* @see org.springframework.data.repository.query.ParametersParameterAccessor#getParameters()
*/
@Override
@@ -93,18 +90,16 @@ public class CassandraParametersParameterAccessor extends ParametersParameterAcc
return (CassandraParameters) super.getParameters();
}
/*
* (non-Javadoc)
* @see org.springframework.data.mongodb.repository.query.CassandraParameterAccessor#getValues()
/* (non-Javadoc)
* @see org.springframework.data.cassandra.repository.query.CassandraParameterAccessor#getValues()
*/
@Override
public Object[] getValues() {
return this.values.toArray();
}
/*
* (non-Javadoc)
* @see org.springframework.data.mongodb.repository.query.CassandraParameterAccessor#getQueryOptions()
/* (non-Javadoc)
* @see org.springframework.data.cassandra.repository.query.CassandraParameterAccessor#getQueryOptions()
*/
@Nullable
@Override

View File

@@ -43,11 +43,8 @@ import org.springframework.data.repository.Repository;
public class CassandraRepositoryFactoryUnitTests {
@Mock CassandraConverter converter;
@Mock CassandraMappingContext mappingContext;
@Mock BasicCassandraPersistentEntity entity;
@Mock CassandraTemplate template;
@Before

View File

@@ -43,11 +43,8 @@ import org.springframework.data.repository.Repository;
public class ReactiveCassandraRepositoryFactoryUnitTests {
@Mock CassandraConverter converter;
@Mock CassandraMappingContext mappingContext;
@Mock BasicCassandraPersistentEntity entity;
@Mock ReactiveCassandraTemplate template;
@Before