Skip to content

Commit

Permalink
Add object factories so mapstruct can handle FXColections
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheikah45 authored and Brutus5000 committed Aug 19, 2023
1 parent d8ea2c8 commit d5b7838
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import javafx.beans.property.*;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.collections.ObservableMap;
import javafx.collections.ObservableSet;
import org.mapstruct.ObjectFactory;
import org.springframework.stereotype.Component;

import java.util.List;
Expand Down Expand Up @@ -66,4 +68,19 @@ public <T> ObservableSet<T> map(Set<T> value) {
// public <T> List<T> map (ListProperty<T> value) {
// return value.get();
// }

@ObjectFactory
public <T> ObservableSet<T> createObservableSet() {
return FXCollections.observableSet();
}

@ObjectFactory
public <T> ObservableList<T> createObservableList() {
return FXCollections.observableArrayList();
}

@ObjectFactory
public <K, V> ObservableMap<K, V> createObservableMap() {
return FXCollections.observableHashMap();
}
}

0 comments on commit d5b7838

Please sign in to comment.