-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(java): move ValidationConstraint to the new Model plugin (#179)
* feat(java/maven-plugin): add ability to set plugin configuration * refactor(java/parser-jvm-core): use PluginConfiguration interface & fix tests * style(java/parser-jvm-core): format * style(java/maven-plugin): format * refactor(java/maven-plugin): address review comments * test(java/parser-jvm-core): fix tests * feat(java/parser-jvm-core): implement plugin manual ordering * feat(java): add NonnullPlugin * feat(java): add parser-jvm-utils module * refactor(java/maven-plugin): use parser-jvm-utils * feat(java/parser-jvm-plugins-nonnull): use parser-jvm-utils * feat(java): add parser-jvm-utils module * refactor(java/maven-plugin): use parser-jvm-utils * style(java/maven-plugin): format * style(java/parser-jvm-core): format * refactor(java): small improvements * refactor(java/parser-jvm-plugin-nonnull): update NonnullPluginConfig * refactor(java/parser-jvm-utils): use interface instead of a class to fit maven reflection * refactor(java/parser-jvm-utils): use interface instead of a class to fit maven reflection * fix(java/parser-jvm-plugin-nonnull): add empty constructor * fix(java/parser-jvm-utils): use merge function in ConfigList Processor * feat(java/parser-jvm-utils): add BidirectionalMap structure * feat(java/parser-jvm-plugin-backbone): add AssoiciationMap * feat(java/parser-jvm-plugin-backbone): implement generic types * feat(java/parser-jvm-plugin-backbone): implement generic types * test(java/parser-jvm-plugin-backbone): update tests * feat(java): add parser-jvm-test-utils package * refactor(java/parser-jvm-plugin-nonnull): implement NonnullPlugin correctly & add tests * fix(java/parser-jvm-plugin-nonnull): correctly detect nonnull annotations for nested classes * style(java/parser-jvm-plugin-nonnull): format * style(java/parser-jvm-plugin-backbone): format * style(java/maven-plugin): format * fix(java/parser-jvm-core): attempt to resolve null pointer exception * chore(java/parser-jvm-plugin-nonnull): improve pom.xml * fix(java/parser-jvm-test-utils): fix issue with incorrect resource loading * style(java): format * chore(java): remove debug calls & fix failing tests * test(java/parser-jvm-plugin-backbone): fix test fixture * test(java/parser-jvm-plugin-nonnull): add missing test fixture * test(java/parser-jvm-plugin-nonnull): fix test fixture * style(java/parser-jvm-plugin-backbone): format * feat(java): introduce parser-jvm-plugin-model * refactor(java/parser-jvm-utils): allow using ConfigList as a modifiable container & add ModelPlugin to defaults * refactor(java/parser-jvm-plugin-backbone): remove ValidationSchemaProcessor * style(java/parser-jvm-plugin-model): format * test(java/parser-jvm-plugin-model): fix failing tests * refactor(java): move AssociationMap to core & add PluginsToolset to check plugin running before/after the current one * fix(java/maven-plugin): fix broken update * chore(java/maven-plugin): fix model plugin dependency * chore: add model plugin child project * chore: simplify the pom file in jvm-plugin-model * chore: simplify pom file in jvm-utils * chore: move code frm instance initializer block to beforeEach * refactor(java): address review comments * style(java/parser-jvm-core): format Co-authored-by: haijian <[email protected]>
- Loading branch information
1 parent
d3173f8
commit 5dde3c6
Showing
30 changed files
with
419 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...ages/java/parser-jvm-core/src/main/java/com/vaadin/fusion/parser/core/PluginsToolset.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.vaadin.fusion.parser.core; | ||
|
||
import java.util.Optional; | ||
import java.util.SortedSet; | ||
|
||
public class PluginsToolset { | ||
private final SortedSet<Plugin> plugins; | ||
|
||
public PluginsToolset(SortedSet<Plugin> plugins) { | ||
this.plugins = plugins; | ||
} | ||
|
||
public Optional<Integer> comparePluginOrders(Plugin current, | ||
Plugin target) { | ||
if (!plugins.contains(current) || !plugins.contains(target)) { | ||
return Optional.empty(); | ||
} | ||
|
||
return Optional.of(plugins.comparator().compare(current, target)); | ||
} | ||
|
||
public Optional<Integer> comparePluginOrders(Plugin current, | ||
Class<? extends Plugin> target) { | ||
return findPluginByClass(target) | ||
.flatMap(plugin -> comparePluginOrders(current, plugin)); | ||
} | ||
|
||
public Optional<Integer> comparePluginOrders( | ||
Class<? extends Plugin> current, Plugin target) { | ||
return findPluginByClass(current) | ||
.flatMap(plugin -> comparePluginOrders(plugin, target)); | ||
} | ||
|
||
public Optional<Integer> comparePluginOrders( | ||
Class<? extends Plugin> current, Class<? extends Plugin> target) { | ||
var currentInstance = findPluginByClass(current); | ||
var targetInstance = findPluginByClass(target); | ||
|
||
if (currentInstance.isPresent() && targetInstance.isPresent()) { | ||
return comparePluginOrders(currentInstance.get(), | ||
targetInstance.get()); | ||
} | ||
|
||
return Optional.empty(); | ||
} | ||
|
||
public Optional<Plugin> findPluginByClass(Class<? extends Plugin> cls) { | ||
return plugins.stream() | ||
.filter(plugin -> cls.isAssignableFrom(plugin.getClass())) | ||
.findFirst(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 0 additions & 58 deletions
58
...ackbone/src/main/java/com/vaadin/fusion/parser/plugins/backbone/ValidationConstraint.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.