Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7885503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:05:18+00:00 2026-06-03T05:05:18+00:00

Java exposes generic type information e.g. for field types at runtime through interface java.lang.reflect.Type

  • 0

Java exposes generic type information e.g. for field types at runtime through interface java.lang.reflect.Type and its subinterfaces (ParameterizedType, WildcardType).

Does anybody know where I can find a component that can determine if objects of one Type can be casted to another Type, e.g. if a Set<Object> can be casted to Set or a Comparator<User> can be casted to Comparator<? extends Object>?

The solution should work for type information represented by java.lang.reflect.Type, not only Classes, and it should take generics into consideration, i.e. a List<Integer> should not be castable to a List<Object>.

Regards,
Jochen

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T05:05:19+00:00Added an answer on June 3, 2026 at 5:05 am

    Guava’s TypeToken is designed for exactly this problem, among others. It’s meant to be a replacement for Class that’s generics-aware. (Disclosure: I contribute to Guava.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am dealing with a commerical Java API that exposes only the following logging
i need to develop a .net library which exposes a java web service proxy
I have a Java Thread which exposes a property which other threads want to
Is there anything like Beanshell, which exposes CLR classes instead of Java classes, and
I've been struggling with passing Java objects from Java through JSNI (gwt-exporter generated) into
I have written a small webservice[Axis2/Java] which exposes a method public String Fill(String cacheName
I am using a Java server that exposes a RESTful API on the following
I've been exposed to C/C++/Java like syntax over the years, and the way that
I have a java back-end that needs to expose services to clients running in
I've used Apache CXF to expose about ten java classes as web services. I've

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.