Skip to content

Commit d9cc633

Browse files
javier-godoypaodb
authored andcommitted
style: apply code formatter
1 parent 00adb85 commit d9cc633

File tree

99 files changed

+1424
-1488
lines changed

Some content is hidden

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

99 files changed

+1424
-1488
lines changed

src/main/java/com/flowingcode/vaadin/jsonmigration/ClassInstrumentationJacksonHelper.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
* Licensed under the Apache License, Version 2.0 (the "License");
88
* you may not use this file except in compliance with the License.
99
* You may obtain a copy of the License at
10-
*
10+
*
1111
* http://www.apache.org/licenses/LICENSE-2.0
12-
*
12+
*
1313
* Unless required by applicable law or agreed to in writing, software
1414
* distributed under the License is distributed on an "AS IS" BASIS,
1515
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -51,5 +51,4 @@ public static String getConvertedTypeDescriptor(Class<?> type) {
5151
}
5252
return Type.getDescriptor(type);
5353
}
54-
5554
}

src/main/java/com/flowingcode/vaadin/jsonmigration/ClassInstrumentationUtil.java

Lines changed: 149 additions & 110 deletions
Large diffs are not rendered by default.

src/main/java/com/flowingcode/vaadin/jsonmigration/ElementalArrayNode.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,4 @@ private static List<JsonNode> children(JsonArray a) {
5454
public JsonType getType() {
5555
return JsonType.ARRAY;
5656
}
57-
5857
}
59-

src/main/java/com/flowingcode/vaadin/jsonmigration/ElementalBooleanNode.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,4 @@ public ElementalBooleanNode(boolean value) {
3333
public JsonType getType() {
3434
return JsonType.BOOLEAN;
3535
}
36-
3736
}
38-
39-
40-
41-
42-
43-
44-

src/main/java/com/flowingcode/vaadin/jsonmigration/ElementalNullNode.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,4 @@ public String toJson() {
3838
public JsonType getType() {
3939
return JsonType.NULL;
4040
}
41-
4241
}
43-

src/main/java/com/flowingcode/vaadin/jsonmigration/ElementalNumberNode.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,4 @@ public String toJson() {
4343
public JsonType getType() {
4444
return JsonType.NUMBER;
4545
}
46-
4746
}
48-

src/main/java/com/flowingcode/vaadin/jsonmigration/ElementalObjectNode.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
package com.flowingcode.vaadin.jsonmigration;
2121

2222
import static com.flowingcode.vaadin.jsonmigration.JsonMigrationHelper25.convertToJsonNode;
23+
2324
import elemental.json.JsonObject;
2425
import elemental.json.JsonType;
2526
import java.util.Collections;
@@ -56,7 +57,4 @@ private static Map<String, JsonNode> children(JsonObject o) {
5657
public JsonType getType() {
5758
return JsonType.OBJECT;
5859
}
59-
6060
}
61-
62-

src/main/java/com/flowingcode/vaadin/jsonmigration/ElementalPendingJavaScriptResult.java

Lines changed: 97 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* #L%
1919
*/
2020
package com.flowingcode.vaadin.jsonmigration;
21+
2122
/*
2223
* Copyright 2000-2025 Vaadin Ltd.
2324
*
@@ -51,132 +52,107 @@
5152
*/
5253
public interface ElementalPendingJavaScriptResult extends Serializable {
5354

54-
/**
55-
* Adds an untyped handler that will be run for a successful execution and a
56-
* handler that will be run for a failed execution. One of the handlers will
57-
* be invoked asynchronously when the result of the execution is sent back
58-
* to the server. It is not possible to synchronously wait for the result of
59-
* the execution while holding the session lock since the request handling
60-
* thread that makes the result available will also need to lock the
61-
* session.
62-
* <p>
63-
* Handlers can only be added before the execution has been sent to the
64-
* browser.
65-
*
66-
* @param resultHandler
67-
* a handler for the JSON representation of the value from a
68-
* successful execution, not <code>null</code>
69-
* @param errorHandler
70-
* a handler for an error message in case the execution failed,
71-
* or <code>null</code> to ignore errors
72-
*/
73-
void then(SerializableConsumer<JsonValue> resultHandler,
74-
SerializableConsumer<String> errorHandler);
75-
76-
/**
77-
* Adds an untyped handler that will be run for a successful execution. The
78-
* handler will be invoked asynchronously if the execution was successful.
79-
* In case of a failure, no handler will be run.
80-
* <p>
81-
* A handler can only be added before the execution has been sent to the
82-
* browser.
83-
*
84-
* @param resultHandler
85-
* a handler for the JSON representation of the return value from
86-
* a successful execution, not <code>null</code>
87-
*/
88-
default void then(SerializableConsumer<JsonValue> resultHandler) {
89-
then(resultHandler, null);
90-
}
91-
92-
/**
93-
* Adds a typed handler that will be run for a successful execution and a
94-
* handler that will be run for a failed execution. One of the handlers will
95-
* be invoked asynchronously when the result of the execution is sent back
96-
* to the server.
97-
* <p>
98-
* Handlers can only be added before the execution has been sent to the
99-
* browser.
100-
*
101-
* @param targetType
102-
* the type to convert the JavaScript return value to, not
103-
* <code>null</code>
104-
* @param resultHandler
105-
* a handler for the return value from a successful execution,
106-
* not <code>null</code>
107-
* @param errorHandler
108-
* a handler for an error message in case the execution failed,
109-
* or <code>null</code> to ignore errors
110-
*/
111-
default <T> void then(Class<T> targetType,
112-
SerializableConsumer<T> resultHandler,
113-
SerializableConsumer<String> errorHandler) {
114-
if (targetType == null) {
115-
throw new IllegalArgumentException("Target type cannot be null");
116-
}
117-
if (resultHandler == null) {
118-
throw new IllegalArgumentException("Result handler cannot be null");
119-
}
55+
/**
56+
* Adds an untyped handler that will be run for a successful execution and a handler that will be
57+
* run for a failed execution. One of the handlers will be invoked asynchronously when the result
58+
* of the execution is sent back to the server. It is not possible to synchronously wait for the
59+
* result of the execution while holding the session lock since the request handling thread that
60+
* makes the result available will also need to lock the session.
61+
*
62+
* <p>Handlers can only be added before the execution has been sent to the browser.
63+
*
64+
* @param resultHandler a handler for the JSON representation of the value from a successful
65+
* execution, not <code>null</code>
66+
* @param errorHandler a handler for an error message in case the execution failed, or <code>null
67+
* </code> to ignore errors
68+
*/
69+
void then(
70+
SerializableConsumer<JsonValue> resultHandler, SerializableConsumer<String> errorHandler);
12071

121-
SerializableConsumer<JsonValue> convertingResultHandler = value -> resultHandler
122-
.accept(JsonCodec.decodeAs(value, targetType));
72+
/**
73+
* Adds an untyped handler that will be run for a successful execution. The handler will be
74+
* invoked asynchronously if the execution was successful. In case of a failure, no handler will
75+
* be run.
76+
*
77+
* <p>A handler can only be added before the execution has been sent to the browser.
78+
*
79+
* @param resultHandler a handler for the JSON representation of the return value from a
80+
* successful execution, not <code>null</code>
81+
*/
82+
default void then(SerializableConsumer<JsonValue> resultHandler) {
83+
then(resultHandler, null);
84+
}
12385

124-
then(convertingResultHandler, errorHandler);
86+
/**
87+
* Adds a typed handler that will be run for a successful execution and a handler that will be run
88+
* for a failed execution. One of the handlers will be invoked asynchronously when the result of
89+
* the execution is sent back to the server.
90+
*
91+
* <p>Handlers can only be added before the execution has been sent to the browser.
92+
*
93+
* @param targetType the type to convert the JavaScript return value to, not <code>null</code>
94+
* @param resultHandler a handler for the return value from a successful execution, not <code>null
95+
* </code>
96+
* @param errorHandler a handler for an error message in case the execution failed, or <code>null
97+
* </code> to ignore errors
98+
*/
99+
default <T> void then(
100+
Class<T> targetType,
101+
SerializableConsumer<T> resultHandler,
102+
SerializableConsumer<String> errorHandler) {
103+
if (targetType == null) {
104+
throw new IllegalArgumentException("Target type cannot be null");
125105
}
126-
127-
/**
128-
* Adds a typed handler that will be run for a successful execution. The
129-
* handler will be invoked asynchronously if the execution was successful.
130-
* In case of a failure, no handler will be run.
131-
* <p>
132-
* A handler can only be added before the execution has been sent to the
133-
* browser.
134-
*
135-
* @param targetType
136-
* the type to convert the JavaScript return value to, not
137-
* <code>null</code>
138-
* @param resultHandler
139-
* a handler for the return value from a successful execution,
140-
* not <code>null</code>
141-
*/
142-
default <T> void then(Class<T> targetType,
143-
SerializableConsumer<T> resultHandler) {
144-
then(targetType, resultHandler, null);
106+
if (resultHandler == null) {
107+
throw new IllegalArgumentException("Result handler cannot be null");
145108
}
146109

147-
/**
148-
* Creates a typed completable future that will be completed with the result
149-
* of the execution. It will be completed asynchronously when the result of
150-
* the execution is sent back to the server. It is not possible to
151-
* synchronously wait for the result of the execution while holding the
152-
* session lock since the request handling thread that makes the result
153-
* available will also need to lock the session.
154-
* <p>
155-
* A completable future can only be created before the execution has been
156-
* sent to the browser.
157-
*
158-
* @param targetType
159-
* the type to convert the JavaScript return value to, not
160-
* <code>null</code>
161-
*
162-
* @return a completable future that will be completed based on the
163-
* execution results, not <code>null</code>
164-
*/
165-
<T> CompletableFuture<T> toCompletableFuture(Class<T> targetType);
110+
SerializableConsumer<JsonValue> convertingResultHandler =
111+
value -> resultHandler.accept(JsonCodec.decodeAs(value, targetType));
166112

167-
/**
168-
* Creates an untyped completable future that will be completed with the
169-
* result of the execution. It will be completed asynchronously when the
170-
* result of the execution is sent back to the server.
171-
* <p>
172-
* A completable future can only be created before the execution has been
173-
* sent to the browser.
174-
*
175-
* @return a completable future that will be completed based on the
176-
* execution results, not <code>null</code>
177-
*/
178-
default CompletableFuture<JsonValue> toCompletableFuture() {
179-
return toCompletableFuture(JsonValue.class);
180-
}
113+
then(convertingResultHandler, errorHandler);
114+
}
115+
116+
/**
117+
* Adds a typed handler that will be run for a successful execution. The handler will be invoked
118+
* asynchronously if the execution was successful. In case of a failure, no handler will be run.
119+
*
120+
* <p>A handler can only be added before the execution has been sent to the browser.
121+
*
122+
* @param targetType the type to convert the JavaScript return value to, not <code>null</code>
123+
* @param resultHandler a handler for the return value from a successful execution, not <code>null
124+
* </code>
125+
*/
126+
default <T> void then(Class<T> targetType, SerializableConsumer<T> resultHandler) {
127+
then(targetType, resultHandler, null);
128+
}
129+
130+
/**
131+
* Creates a typed completable future that will be completed with the result of the execution. It
132+
* will be completed asynchronously when the result of the execution is sent back to the server.
133+
* It is not possible to synchronously wait for the result of the execution while holding the
134+
* session lock since the request handling thread that makes the result available will also need
135+
* to lock the session.
136+
*
137+
* <p>A completable future can only be created before the execution has been sent to the browser.
138+
*
139+
* @param targetType the type to convert the JavaScript return value to, not <code>null</code>
140+
* @return a completable future that will be completed based on the execution results, not <code>
141+
* null</code>
142+
*/
143+
<T> CompletableFuture<T> toCompletableFuture(Class<T> targetType);
181144

145+
/**
146+
* Creates an untyped completable future that will be completed with the result of the execution.
147+
* It will be completed asynchronously when the result of the execution is sent back to the
148+
* server.
149+
*
150+
* <p>A completable future can only be created before the execution has been sent to the browser.
151+
*
152+
* @return a completable future that will be completed based on the execution results, not <code>
153+
* null</code>
154+
*/
155+
default CompletableFuture<JsonValue> toCompletableFuture() {
156+
return toCompletableFuture(JsonValue.class);
157+
}
182158
}

src/main/java/com/flowingcode/vaadin/jsonmigration/ElementalStringNode.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,4 @@ public ElementalStringNode(String value) {
3333
public JsonType getType() {
3434
return JsonType.STRING;
3535
}
36-
37-
}
36+
}

src/main/java/com/flowingcode/vaadin/jsonmigration/InstrumentationViewInitializer.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525

2626
/**
2727
* Abstract base class for Vaadin service initializers that register instrumented views. Subclasses
28-
* should implement {@link #serviceInit(com.vaadin.flow.server.ServiceInitEvent)} and call
29-
* {@link #registerInstrumentedRoute(Class)} to register views with instrumented routes.
28+
* should implement {@link #serviceInit(com.vaadin.flow.server.ServiceInitEvent)} and call {@link
29+
* #registerInstrumentedRoute(Class)} to register views with instrumented routes.
3030
*
3131
* @author Javier Godoy / Flowing Code
3232
*/
@@ -35,26 +35,26 @@ public abstract class InstrumentationViewInitializer implements VaadinServiceIni
3535

3636
/**
3737
* Registers an instrumented route for the given navigation target. The navigation target must be
38-
* annotated with {@link InstrumentedRoute} to specify the route path. This method calls
39-
* {@link JsonMigration#instrumentClass(Class)} to get the instrumented class and registers it as
40-
* a Vaadin view with the route derived from the annotation.
38+
* annotated with {@link InstrumentedRoute} to specify the route path. This method calls {@link
39+
* JsonMigration#instrumentClass(Class)} to get the instrumented class and registers it as a
40+
* Vaadin view with the route derived from the annotation.
4141
*
4242
* @param navigationTarget the component class to instrument and register, must be annotated with
43-
* {@link InstrumentedRoute}
44-
* @throws IllegalArgumentException if the navigationTarget is not annotated with
45-
* {@link InstrumentedRoute}
43+
* {@link InstrumentedRoute}
44+
* @throws IllegalArgumentException if the navigationTarget is not annotated with {@link
45+
* InstrumentedRoute}
4646
*/
4747
protected final void registerInstrumentedRoute(Class<? extends Component> navigationTarget) {
4848
InstrumentedRoute annotation = navigationTarget.getAnnotation(InstrumentedRoute.class);
4949
if (annotation == null) {
5050
throw new IllegalArgumentException(
51-
navigationTarget.getName() + " must be annotated with @"
51+
navigationTarget.getName()
52+
+ " must be annotated with @"
5253
+ InstrumentedRoute.class.getSimpleName());
5354
}
5455

5556
String route = annotation.value();
5657
navigationTarget = JsonMigration.instrumentClass(navigationTarget);
5758
RouteConfiguration.forApplicationScope().setRoute(route, navigationTarget);
5859
}
59-
6060
}

0 commit comments

Comments
 (0)