Skip to content

Commit 2634644

Browse files
committed
update code style
1 parent 9528f98 commit 2634644

File tree

44 files changed

+108
-207
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+108
-207
lines changed

core/src/main/java/com/javaaidev/agenticpatterns/core/AbstractAgenticWorkflow.java

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ public abstract class AbstractAgenticWorkflow<Request, Response> implements
1616

1717
protected AbstractAgenticWorkflow(@Nullable String name,
1818
@Nullable ObservationRegistry observationRegistry) {
19-
this.name = Objects.requireNonNullElseGet(name,
20-
() -> this.getClass().getSimpleName());
19+
this.name = Objects.requireNonNullElseGet(name, () -> this.getClass().getSimpleName());
2120
this.observationRegistry = observationRegistry;
2221
}
2322

@@ -31,15 +30,13 @@ public Response execute(@Nullable Request request) {
3130
if (observationRegistry == null || observationRegistry.isNoop()) {
3231
return doExecute(request);
3332
}
34-
var observationContext = new WorkflowExecutionObservationContext(
35-
getName(), request);
36-
var observation =
37-
WorkflowExecutionObservationDocumentation.WORKFLOW_EXECUTION.observation(
38-
null,
39-
new DefaultWorkflowExecutionObservationConvention(),
40-
() -> observationContext,
41-
observationRegistry
42-
).start();
33+
var observationContext = new WorkflowExecutionObservationContext(getName(), request);
34+
var observation = WorkflowExecutionObservationDocumentation.WORKFLOW_EXECUTION.observation(
35+
null,
36+
new DefaultWorkflowExecutionObservationConvention(),
37+
() -> observationContext,
38+
observationRegistry
39+
).start();
4340
try (var ignored = observation.openScope()) {
4441
var response = doExecute(request);
4542
observationContext.setResponse(response);

core/src/main/java/com/javaaidev/agenticpatterns/core/AbstractAgenticWorkflowBuilder.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ public T name(String name) {
2121
return self();
2222
}
2323

24-
public T observationRegistry(
25-
ObservationRegistry observationRegistry) {
24+
public T observationRegistry(ObservationRegistry observationRegistry) {
2625
this.observationRegistry = observationRegistry;
2726
return self();
2827
}

core/src/main/java/com/javaaidev/agenticpatterns/core/Agent.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ protected Agent(ChatClient chatClient) {
1818
this.observationRegistry = null;
1919
}
2020

21-
protected Agent(ChatClient chatClient,
22-
@Nullable ObservationRegistry observationRegistry) {
21+
protected Agent(ChatClient chatClient, @Nullable ObservationRegistry observationRegistry) {
2322
this.chatClient = chatClient;
2423
this.observationRegistry = observationRegistry;
2524
}

core/src/main/java/com/javaaidev/agenticpatterns/core/AgentUtils.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ public class AgentUtils {
2626
*/
2727
public static String loadPromptTemplateFromClasspath(String resource) {
2828
try {
29-
return new ClassPathResource(resource).getContentAsString(
30-
StandardCharsets.UTF_8);
29+
return new ClassPathResource(resource).getContentAsString(StandardCharsets.UTF_8);
3130
} catch (IOException e) {
3231
throw new AgentExecutionException(
3332
"Prompt template not found: " + resource, e);
@@ -41,8 +40,7 @@ public static String loadPromptTemplateFromClasspath(String resource) {
4140
* @param map2 Second map
4241
* @return Merged map
4342
*/
44-
public static Map<String, Object> mergeMap(
45-
@Nullable Map<String, Object> map1,
43+
public static Map<String, Object> mergeMap(@Nullable Map<String, Object> map1,
4644
@Nullable Map<String, Object> map2) {
4745
var m1 = Optional.ofNullable(map1)
4846
.orElseGet(HashMap::new);
@@ -54,8 +52,7 @@ public static Map<String, Object> mergeMap(
5452
return result;
5553
}
5654

57-
public static <T, R> R safeGet(@Nullable T obj, Function<T, R> extractor,
58-
R defaultValue) {
55+
public static <T, R> R safeGet(@Nullable T obj, Function<T, R> extractor, R defaultValue) {
5956
return Optional.ofNullable(obj).map(extractor).orElse(defaultValue);
6057
}
6158

core/src/main/java/com/javaaidev/agenticpatterns/core/CustomWorkflowBuilder.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ public class CustomWorkflowBuilder<Request, Response> extends
2222
* @param action Action to run
2323
* @return Current builder
2424
*/
25-
public CustomWorkflowBuilder<Request, Response> action(
26-
Function<Request, Response> action) {
25+
public CustomWorkflowBuilder<Request, Response> action(Function<Request, Response> action) {
2726
this.action = Objects.requireNonNull(action, "Action cannot be null");
2827
return this;
2928
}

core/src/main/java/com/javaaidev/agenticpatterns/core/McpClientConfiguration.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ public record StdioClientProperties(Map<String, Parameters> connections) {
1717
public Map<String, ServerParameters> toServerParameters() {
1818
Map<String, ServerParameters> serverParameters = new HashMap<>();
1919
for (Map.Entry<String, Parameters> entry : this.connections.entrySet()) {
20-
serverParameters.put(entry.getKey(),
21-
entry.getValue().toServerParameters());
20+
serverParameters.put(entry.getKey(), entry.getValue().toServerParameters());
2221
}
2322
return serverParameters;
2423
}

core/src/main/java/com/javaaidev/agenticpatterns/core/ParameterizedTypeImpl.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66

77
public record ParameterizedTypeImpl(@Nullable Type rawType,
88
Type[] actualTypeArguments,
9-
@Nullable Type ownerType) implements
10-
ParameterizedType {
9+
@Nullable Type ownerType) implements ParameterizedType {
1110

1211
@Override
1312
public Type[] getActualTypeArguments() {

core/src/main/java/com/javaaidev/agenticpatterns/core/TypeResolver.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ private static Type doResolveType(final ResolvableType type) {
2424
return Object.class;
2525
}
2626
var generics = type.getGenerics();
27-
var paraType = new ParameterizedTypeImpl(type.resolve(),
28-
new Type[generics.length],
29-
null);
27+
var paraType = new ParameterizedTypeImpl(type.resolve(), new Type[generics.length], null);
3028
for (int i = 0; i < generics.length; i++) {
3129
var nestedType = generics[i];
3230
paraType.getActualTypeArguments()[i] = doResolveType(nestedType);

core/src/main/java/com/javaaidev/agenticpatterns/core/observation/AgentExecutionObservationContext.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22

33
import io.micrometer.observation.transport.RequestReplySenderContext;
44

5-
public class AgentExecutionObservationContext extends
6-
RequestReplySenderContext<Object, Object> {
5+
public class AgentExecutionObservationContext extends RequestReplySenderContext<Object, Object> {
76

87
private final String agentName;
98

10-
public AgentExecutionObservationContext(
11-
String agentName, Object input) {
9+
public AgentExecutionObservationContext(String agentName, Object input) {
1210
super((carrier, key, value) -> {
1311

1412
});

core/src/main/java/com/javaaidev/agenticpatterns/core/observation/AgentExecutionObservationDocumentation.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
import io.micrometer.observation.ObservationConvention;
66
import io.micrometer.observation.docs.ObservationDocumentation;
77

8-
public enum AgentExecutionObservationDocumentation implements
9-
ObservationDocumentation {
8+
public enum AgentExecutionObservationDocumentation implements ObservationDocumentation {
109
AGENT_EXECUTION {
1110
@Override
1211
public Class<? extends ObservationConvention<? extends Context>> getDefaultConvention() {

0 commit comments

Comments
 (0)