deps: Refactor dependencies (#3224)

* remove spring dep
move junit, logging, mockito under dep mgmt

* upgrade anti-corruption-layer deps

* async method invocation

* balking, bloc

* bridge to bytecode

* caching

* callback - cqrs

* component - health check

* hexagonal - metadata mapping

* rest of the patterns

* remove checkstyle, take spotless into use
This commit is contained in:
Ilkka Seppälä
2025-03-29 19:34:27 +02:00
committed by GitHub
parent 371439aeaa
commit 0ca162a55c
1863 changed files with 14408 additions and 17637 deletions
@@ -31,9 +31,7 @@ import java.util.Objects;
import java.util.function.Function;
import java.util.stream.Stream;
/**
* Abstract implementation of Document interface.
*/
/** Abstract implementation of Document interface. */
public abstract class AbstractDocument implements Document {
private final Map<String, Object> documentProperties;
@@ -57,12 +55,12 @@ public abstract class AbstractDocument implements Document {
@Override
public <T> Stream<T> children(String key, Function<Map<String, Object>, T> childConstructor) {
return Stream.ofNullable(get(key))
.filter(Objects::nonNull)
.map(el -> (List<Map<String, Object>>) el)
.findAny()
.stream()
.flatMap(Collection::stream)
.map(childConstructor);
.filter(Objects::nonNull)
.map(el -> (List<Map<String, Object>>) el)
.findAny()
.stream()
.flatMap(Collection::stream)
.map(childConstructor);
}
@Override
@@ -100,5 +98,4 @@ public abstract class AbstractDocument implements Document {
builder.append("]");
return builder.toString();
}
}
@@ -49,20 +49,26 @@ public class App {
public static void main(String[] args) {
LOGGER.info("Constructing parts and car");
var wheelProperties = Map.of(
Property.TYPE.toString(), "wheel",
Property.MODEL.toString(), "15C",
Property.PRICE.toString(), 100L);
var wheelProperties =
Map.of(
Property.TYPE.toString(), "wheel",
Property.MODEL.toString(), "15C",
Property.PRICE.toString(), 100L);
var doorProperties = Map.of(
Property.TYPE.toString(), "door",
Property.MODEL.toString(), "Lambo",
Property.PRICE.toString(), 300L);
var doorProperties =
Map.of(
Property.TYPE.toString(), "door",
Property.MODEL.toString(), "Lambo",
Property.PRICE.toString(), 300L);
var carProperties = Map.of(
Property.MODEL.toString(), "300SL",
Property.PRICE.toString(), 10000L,
Property.PARTS.toString(), List.of(wheelProperties, doorProperties));
var carProperties =
Map.of(
Property.MODEL.toString(),
"300SL",
Property.PRICE.toString(),
10000L,
Property.PARTS.toString(),
List.of(wheelProperties, doorProperties));
var car = new Car(carProperties);
@@ -70,10 +76,13 @@ public class App {
LOGGER.info("-> model: {}", car.getModel().orElseThrow());
LOGGER.info("-> price: {}", car.getPrice().orElseThrow());
LOGGER.info("-> parts: ");
car.getParts().forEach(p -> LOGGER.info("\t{}/{}/{}",
p.getType().orElse(null),
p.getModel().orElse(null),
p.getPrice().orElse(null))
);
car.getParts()
.forEach(
p ->
LOGGER.info(
"\t{}/{}/{}",
p.getType().orElse(null),
p.getModel().orElse(null),
p.getPrice().orElse(null)));
}
}
@@ -28,15 +28,13 @@ import java.util.Map;
import java.util.function.Function;
import java.util.stream.Stream;
/**
* Document interface.
*/
/** Document interface. */
public interface Document {
/**
* Puts the value related to the key.
*
* @param key element key
* @param key element key
* @param value element value
* @return Void
*/
@@ -53,7 +51,7 @@ public interface Document {
/**
* Gets the stream of child documents.
*
* @param key element key
* @param key element key
* @param constructor constructor of child class
* @return child documents
*/
@@ -27,13 +27,10 @@ package com.iluwatar.abstractdocument.domain;
import com.iluwatar.abstractdocument.AbstractDocument;
import java.util.Map;
/**
* Car entity.
*/
/** Car entity. */
public class Car extends AbstractDocument implements HasModel, HasPrice, HasParts {
public Car(Map<String, Object> properties) {
super(properties);
}
}
@@ -28,13 +28,10 @@ import com.iluwatar.abstractdocument.Document;
import com.iluwatar.abstractdocument.domain.enums.Property;
import java.util.Optional;
/**
* HasModel trait for static access to 'model' property.
*/
/** HasModel trait for static access to 'model' property. */
public interface HasModel extends Document {
default Optional<String> getModel() {
return Optional.ofNullable((String) get(Property.MODEL.toString()));
}
}
@@ -28,13 +28,10 @@ import com.iluwatar.abstractdocument.Document;
import com.iluwatar.abstractdocument.domain.enums.Property;
import java.util.stream.Stream;
/**
* HasParts trait for static access to 'parts' property.
*/
/** HasParts trait for static access to 'parts' property. */
public interface HasParts extends Document {
default Stream<Part> getParts() {
return children(Property.PARTS.toString(), Part::new);
}
}
@@ -28,13 +28,10 @@ import com.iluwatar.abstractdocument.Document;
import com.iluwatar.abstractdocument.domain.enums.Property;
import java.util.Optional;
/**
* HasPrice trait for static access to 'price' property.
*/
/** HasPrice trait for static access to 'price' property. */
public interface HasPrice extends Document {
default Optional<Number> getPrice() {
return Optional.ofNullable((Number) get(Property.PRICE.toString()));
}
}
@@ -28,13 +28,10 @@ import com.iluwatar.abstractdocument.Document;
import com.iluwatar.abstractdocument.domain.enums.Property;
import java.util.Optional;
/**
* HasType trait for static access to 'type' property.
*/
/** HasType trait for static access to 'type' property. */
public interface HasType extends Document {
default Optional<String> getType() {
return Optional.ofNullable((String) get(Property.TYPE.toString()));
}
}
@@ -27,13 +27,10 @@ package com.iluwatar.abstractdocument.domain;
import com.iluwatar.abstractdocument.AbstractDocument;
import java.util.Map;
/**
* Part entity.
*/
/** Part entity. */
public class Part extends AbstractDocument implements HasType, HasModel, HasPrice {
public Part(Map<String, Object> properties) {
super(properties);
}
}
@@ -24,10 +24,10 @@
*/
package com.iluwatar.abstractdocument.domain.enums;
/**
* Enum To Describe Property type.
*/
/** Enum To Describe Property type. */
public enum Property {
PARTS, TYPE, PRICE, MODEL
PARTS,
TYPE,
PRICE,
MODEL
}