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

Improve handling of unknown generic types. #803

Merged
merged 2 commits into from
Jul 3, 2020

Conversation

michael-simons
Copy link
Collaborator

This improves the SingleUseEntityMapper to check the returned value for being something like a collection in case we couldn’t determine the generics of a wrapper class. In case the of Collections, this allows for a correct assigment.

Generic arrays are not detectable with that approach.

So something like

public class GenericQueryResultWrapper<T> {

    T result;
}

will work for T being a known entity type or a collection thereof, but not for an array of known entities.

This improves the `SingleUseEntityMapper` to check the returned value for being something like a collection in case we couldn’t determine the generics of a wrapper class. In case the of Collections, this allows for a correct assigment.

Generic arrays are not detectable with that approach.

So something like

```
public class GenericQueryResultWrapper<T> {

    T result;
}
```

will work for `T` being a known entity type or a collection thereof, but not for an array of known entities.
@michael-simons michael-simons merged commit 593a02d into master Jul 3, 2020
@michael-simons michael-simons deleted the issue/GenericQueryResultWrapper branch July 3, 2020 06:29
michael-simons added a commit that referenced this pull request Jul 3, 2020
This improves the `SingleUseEntityMapper` to check the returned value for being something like a collection in case we couldn’t determine the generics of a wrapper class. In case the of Collections, this allows for a correct assigment.

Generic arrays are not detectable with that approach.

So something like

```
public class GenericQueryResultWrapper<T> {

    T result;
}
```

will work for `T` being a known entity type or a collection thereof, but not for an array of known entities.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants