Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: avoid duplicating scanned classes #674

Merged
merged 4 commits into from
Jan 6, 2025
Merged

Conversation

berezovskyi
Copy link
Contributor

Description

Switch to Set instead of List for keeping a map of all RDF type URI to POJOs to avoid dupe POJO entries in the map.

Checklist

  • This PR adds an entry to the CHANGELOG. See https://keepachangelog.com/en/1.0.0/ for instructions. Minor edits are exempt.
  • This PR was tested on at least one Lyo OSLC server (e.g. manual workflow on Lyo Sample and OSLC RefImpl) or adds unit/integration tests.
  • This PR does NOT break the API

Issues

Closes #673

@@ -49,7 +49,7 @@ public class ResourcePackages {
/**
* The RDFs-Classes types mapping.
*/
static final Map<String, List<Class<?>>> TYPES_MAPPINGS = new HashMap<>();
static final Map<String, Set<Class<?>>> TYPES_MAPPINGS = new HashMap<>();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ben81 please note that the map is not "org.eclipse.lyo.oslc4j.provider.jena.resources.child.ChildAnimal" -> [ChildAnimal.class] but instead "http://locahost:7001/vocabulary/AbstractTypesTest2"->[ChildAnimal.class]. It can happen that you annotate multiple classes with the same @OslcNamespace("http://locahost:7001/vocabulary/")/@OslcResourceShape(title = "AbstractTypesTest2") annotation pair and a collection on the map value is designed to handle this.

@berezovskyi berezovskyi added this to the 7.0 milestone Jan 4, 2025
@ben81
Copy link

ben81 commented Jan 6, 2025

The fix is good for me.
Thank you

@berezovskyi berezovskyi merged commit ae59caf into master Jan 6, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants