Skip to content

Commit ef55ca2

Browse files
javier-godoypaodb
authored andcommitted
refactor: use lombok extension mechanism
1 parent 1a79ca5 commit ef55ca2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/main/java/com/flowingcode/vaadin/addons/chipfield/ChipField.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import elemental.json.JsonArray;
5151
import elemental.json.JsonObject;
5252
import elemental.json.impl.JreJsonFactory;
53+
import lombok.experimental.ExtensionMethod;
5354

5455
@SuppressWarnings("serial")
5556
@Tag("paper-chip-input-autocomplete")
@@ -64,6 +65,7 @@
6465
@NpmPackage(value = "@polymer/paper-ripple", version = "3.0.1")
6566
@NpmPackage(value = "@polymer/paper-styles", version = "3.0.1")
6667
@JsModule("./paper-chip-input-autocomplete.js")
68+
@ExtensionMethod(value = JsonMigration.class, suppressBaseMethods = true)
6769
public class ChipField<T> extends AbstractField<ChipField<T>, List<T>>
6870
implements HasStyle, HasItemsAndComponents<T>, HasDataProvider<T>, HasSize, HasTheme {
6971

@@ -152,7 +154,7 @@ private void configure() {
152154
.addEventListener(
153155
"chip-created",
154156
e -> {
155-
JsonObject eventData = JsonMigration.getEventData(e);
157+
JsonObject eventData = e.getEventData();
156158
String chipLabel = eventData.get(CHIP_LABEL).asString();
157159
T newItem =
158160
findItemByLabel(chipLabel)
@@ -179,7 +181,7 @@ private void configure() {
179181
.addEventListener(
180182
"chip-removed",
181183
e -> {
182-
JsonObject eventData = JsonMigration.getEventData(e);
184+
JsonObject eventData = e.getEventData();
183185
String chipLabel = eventData.get(CHIP_LABEL).asString();
184186
findItemByLabel(chipLabel).ifPresent(item -> removeSelectedItem(item, true));
185187
})
@@ -198,7 +200,7 @@ private void configureItems() {
198200
object.put("value", itemLabelGenerator.apply(item));
199201
array.set(index.getAndIncrement(), object);
200202
});
201-
JsonMigration.setPropertyJson(getElement(), "source", array);
203+
getElement().setPropertyJson("source", array);
202204
}
203205

204206
@Override

0 commit comments

Comments
 (0)