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

JSON-LD Transformers: add method to transform collections of primitive types #3315

Open
paullatzelsperger opened this issue Jul 19, 2023 · 0 comments
Assignees
Labels
core feature enhancement New feature or request
Milestone

Comments

@paullatzelsperger
Copy link
Member

Feature Request

It would be good to have a way to automatically transform collections of primitive types readily available.

For example, transforming a Set<String> can currently be done using the following code:

var set = jsonValue.asJsonArray().stream()
                        .map(jv -> transformString(jv, context))
                        .collect(Collectors.toSet());

That code has to be executed in every subclass. So it would be even more comfortable and less error prone if the existing transformArray method could already internally transform primitive types.

Which Areas Would Be Affected?

JSON-LD, probably the AbstractJsonLdTransformer

Why Is the Feature Desired?

Ease of use, centralizing features.

Solution Proposal

add a check to the transformArray method, if the object in question is a primitive type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core feature enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants