Skip to content

Commit

Permalink
style: fix at checkstyle
Browse files Browse the repository at this point in the history
Signed-off-by: Otavio Santana <otaviopolianasantana@gmail.com>
  • Loading branch information
otaviojava committed Sep 24, 2024
1 parent 0c85eaa commit 5450791
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import org.eclipse.jnosql.communication.Configurations;
import org.eclipse.jnosql.communication.Settings;

import java.util.Arrays;
import java.util.List;

import static java.util.Arrays.asList;
Expand Down Expand Up @@ -62,7 +61,7 @@ static void load(Settings settings, ArangoDBBuilder arangoDB) {
settings.get(ArangoDBConfigurations.PROTOCOL).map(Object::toString).map(Protocol::valueOf)
.ifPresent(arangoDB::protocol);

settings.prefixSupplier(Arrays.asList(ArangoDBConfigurations.HOST, Configurations.HOST))
settings.prefixSupplier(asList(ArangoDBConfigurations.HOST, Configurations.HOST))
.stream()
.map(Object::toString)
.map(ArangoDBHost::new)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.arangodb.entity.BaseDocument;
import com.arangodb.entity.CollectionEntity;
import org.eclipse.jnosql.communication.Value;

import org.eclipse.jnosql.communication.ValueUtil;
import org.eclipse.jnosql.communication.semistructured.CommunicationEntity;
import org.eclipse.jnosql.communication.semistructured.Element;
Expand All @@ -33,8 +32,6 @@
import java.util.function.Function;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;

import static java.util.Collections.singletonMap;
import static java.util.stream.Collectors.toList;
Expand Down Expand Up @@ -85,7 +82,7 @@ static CommunicationEntity toEntity(BaseDocument document) {
Map<String, Object> properties = document.getProperties();
List<Element> documents = properties.keySet().stream()
.map(k -> toDocument(k, properties))
.collect(Collectors.toList());
.collect(toList());

documents.add(Element.of(KEY, document.getKey()));
documents.add(Element.of(ID, document.getId()));
Expand All @@ -110,7 +107,7 @@ private static Element toDocument(String key, Map<String, Object> properties) {
if (value instanceof Map map) {
return Element.of(key, map.keySet()
.stream().map(k -> toDocument(k.toString(), map))
.collect(Collectors.toList()));
.collect(toList()));
}
if (isADocumentIterable(value)) {
List<List<Element>> documents = new ArrayList<>();
Expand Down Expand Up @@ -141,7 +138,7 @@ private static Object convert(Value value) {
return getMap(val);
}
if (isSudDocumentList(val)) {
return StreamSupport.stream(Iterable.class.cast(val).spliterator(), false)
return stream(Iterable.class.cast(val).spliterator(), false)
.map(ArangoDBUtil::getMap).collect(toList());
}
return val;
Expand All @@ -158,12 +155,12 @@ private static Object getMap(Object val) {
}

private static boolean isSudDocumentList(Object value) {
return value instanceof Iterable && StreamSupport.stream(Iterable.class.cast(value).spliterator(), false).
return value instanceof Iterable && stream(Iterable.class.cast(value).spliterator(), false).
allMatch(d -> d instanceof Iterable && isSudDocument(d));
}

private static boolean isSudDocument(Object value) {
return value instanceof Iterable && StreamSupport.stream(Iterable.class.cast(value).spliterator(), false).
return value instanceof Iterable && stream(Iterable.class.cast(value).spliterator(), false).
allMatch(Element.class::isInstance);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

import java.time.Duration;
import java.util.Map;
import java.util.Objects;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -61,7 +60,7 @@ public String name() {

@Override
public CommunicationEntity insert(CommunicationEntity entity) {
Objects.requireNonNull(entity, "entity is required");
requireNonNull(entity, "entity is required");
String collectionName = entity.name();
checkCollection(collectionName);
BaseDocument baseDocument = ArangoDBUtil.getBaseDocument(entity);
Expand All @@ -73,7 +72,7 @@ public CommunicationEntity insert(CommunicationEntity entity) {

@Override
public CommunicationEntity update(CommunicationEntity entity) {
Objects.requireNonNull(entity, "entity is required");
requireNonNull(entity, "entity is required");
String collectionName = entity.name();
checkCollection(collectionName);
String id = entity.find(ID, String.class)
Expand All @@ -90,7 +89,7 @@ public CommunicationEntity update(CommunicationEntity entity) {

@Override
public Iterable<CommunicationEntity> update(Iterable<CommunicationEntity> entities) {
Objects.requireNonNull(entities, "entities is required");
requireNonNull(entities, "entities is required");
return StreamSupport.stream(entities.spliterator(), false)
.map(this::update)
.collect(Collectors.toList());
Expand Down Expand Up @@ -135,7 +134,7 @@ public Stream<CommunicationEntity> select(SelectQuery query) throws NullPointerE

@Override
public long count(String documentCollection) {
Objects.requireNonNull(documentCollection, "document collection is required");
requireNonNull(documentCollection, "document collection is required");
String aql = "RETURN LENGTH(" + documentCollection + ")";
ArangoCursor<Object> query = arangoDB.db(database).query(aql, Object.class, emptyMap(), null);
return StreamSupport.stream(query.spliterator(), false).findFirst().map(Number.class::cast)
Expand Down Expand Up @@ -188,16 +187,16 @@ public CommunicationEntity insert(CommunicationEntity entity, Duration ttl) {

@Override
public Iterable<CommunicationEntity> insert(Iterable<CommunicationEntity> entities) {
Objects.requireNonNull(entities, "entities is required");
requireNonNull(entities, "entities is required");
return StreamSupport.stream(entities.spliterator(), false)
.map(this::insert)
.collect(Collectors.toList());
}

@Override
public Iterable<CommunicationEntity> insert(Iterable<CommunicationEntity> entities, Duration ttl) {
Objects.requireNonNull(entities, "entities is required");
Objects.requireNonNull(ttl, "ttl is required");
requireNonNull(entities, "entities is required");
requireNonNull(ttl, "ttl is required");
return StreamSupport.stream(entities.spliterator(), false)
.map(e -> this.insert(e, ttl))
.collect(Collectors.toList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private static void definesCondition(CriteriaCondition condition,
if (isFirstCondition(aql, counter)) {
aql.append(AND);
}
definesCondition(dc, aql, params, entity, ++counter);
definesCondition(dc, aql, params, entity, counter +1);
}
return;
case OR:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void onAfterBeanDiscovery(@Observes final AfterBeanDiscovery afterBeanDiscovery)

LOGGER.info("Starting the onAfterBeanDiscovery with elements number: " + crudTypes.size());

crudTypes.forEach(type -> afterBeanDiscovery.addBean(new ArangoDBRepositoryBean(type)));
crudTypes.forEach(type -> afterBeanDiscovery.addBean(new ArangoDBRepositoryBean<>(type)));

LOGGER.info("Finished the onAfterBeanDiscovery");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@ enum DefaultJsonbSupplier implements JsonbSupplier {

INSTANCE;

{
JsonbConfig config = new JsonbConfig().withPropertyVisibilityStrategy(new PrivateVisibilityStrategy());
this.json = JsonbBuilder.newBuilder().withConfig(config).build();
}

private final Jsonb json;

DefaultJsonbSupplier() {
JsonbConfig config = new JsonbConfig()
.withPropertyVisibilityStrategy(new PrivateVisibilityStrategy());
this.json = JsonbBuilder.newBuilder()
.withConfig(config)
.build();
}

@Override
public Jsonb get() {
return json;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;

/**
* Default representation of {@link EntityAttachment} for in-memory data.
Expand All @@ -33,7 +34,8 @@ public ByteArrayEntityAttachment(String name, String contentType, long lastModif
this.name = name;
this.contentType = contentType;
this.lastModified = lastModified;
this.data = data;
this.data = data != null ? Arrays.copyOf(data, data.length) : new byte[0];

}

@Override
Expand Down

0 comments on commit 5450791

Please sign in to comment.