Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #39629
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: getting generic type parameter in method |
| Date | Wed, 21 Oct 2020 08:43:06 -0400 |
| Organization | A noiseless patient Spider |
| Lines | 23 |
| Message-ID | <rmpact$irl$1@dont-email.me> (permalink) |
| References | <7e2c11ae-85bd-42cd-a7a7-27313edb9178n@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Wed, 21 Oct 2020 12:43:09 -0000 (UTC) |
| Injection-Info | reader02.eternal-september.org; posting-host="6895006881a8baa16a6b4a7db70f0207"; logging-data="19317"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19bZFfvbwT5y/SjI0MiTEcV" |
| User-Agent | Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.3.3 |
| Cancel-Lock | sha1:aiLo614ymsfELUlBXUcYyy4xy2o= |
| In-Reply-To | <7e2c11ae-85bd-42cd-a7a7-27313edb9178n@googlegroups.com> |
| Content-Language | en-US |
| Xref | csiph.com comp.lang.java.programmer:39629 |
Show key headers only | View raw
On 10/21/2020 7:38 AM, Philipp Kraus wrote:
> Hello,
>
> I'm implementing an interface of a library, which I can use for deserialization a byte array into my own datastructures. The method is:
>
> public <T> T fromData( @Nonnull final byte[] p_bytes, @Nonnull final Class<T> p_class, @Nonnull final Type p_type ) throws DataConverterException
> [...]
> I have taken a look into Google Guava and Apache Commons with the ReflectUtils / TypeUtils, but I don't know How I get get from my p_class Variable the details auf T during runtime.
I'm not up to speed on all the latest developments, but I think
you're out of luck at least through Java 15. JLS 4.7 describes which
types are "reifiable," and includes a discussion on why some types
(including most generic types) are not. Perhaps in some future Java
things will change, but I don't believe they've changed yet.
(However, "perhaps" I'm wrong. I'm at Java 11 these days, and
have not fully explored the more recent releases.)
--
esosman@comcast-dot-net.invalid
"Total honesty is what we as citizens deserve from our president."
-- Melania Trump
Ninety-one days to go.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
getting generic type parameter in method Philipp Kraus <philipp.kraus.flashpixx@gmail.com> - 2020-10-21 04:38 -0700
Re: getting generic type parameter in method Eric Sosman <esosman@comcast-dot-net.invalid> - 2020-10-21 08:43 -0400
Re: getting generic type parameter in method Marcel Mueller <news.5.maazl@spamgourmet.org> - 2020-10-21 15:28 +0200
Re: getting generic type parameter in method Arne Vajhøj <arne@vajhoej.dk> - 2020-10-21 21:33 -0400
Re: getting generic type parameter in method Philipp Kraus <philipp.kraus.flashpixx@gmail.com> - 2020-10-22 04:16 -0700
Re: getting generic type parameter in method Philipp Kraus <philipp.kraus.flashpixx@gmail.com> - 2020-10-22 04:21 -0700
Re: getting generic type parameter in method "e.d.pro...@gmail.com" <e.d.programmer@gmail.com> - 2020-10-22 04:16 -0700
csiph-web