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 801799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:29:54+00:00 2026-05-14T23:29:54+00:00

There are methods like these which require Class literals as argument. Collection<EmpInfo> emps =

  • 0

There are methods like these which require Class literals as argument.

Collection<EmpInfo> emps =  
  SomeSqlUtil.select(  
  EmpInfo.class,  
  "select * from emps");

or

GWT.create(Razmataz.class);

The problem presents itself when I need to supply generic specific classes like

EmpInfo<String>
Razmataz<Integer>

The following would be wrong syntax

Collection<EmpInfo<String>> emps =  
  SomeSqlUtil.select(  
  EmpInfo<String>.class,  
  "select * from emps");

or

GWT.create(Razmataz<Integer>.class);

Because you cannot do syntax like

Razmataz<Integer>.class

So, how would I be able to squeeze a class literal out of

EmpInfo<String>
Razmataz<Integer>

so that I could feed them as arguments to methods requiring Class literals?

Further info

Okay, I confess that I am asking this primarily for GWT.

I have a pair of GWT RPC interface Razmataz. (FYI, GWT RPC interface has to be defined in server-client pairs). I plan to use the same interface pair for communicating whether it be String, Integer, Boolean, etc.

GWT.create(Razmataz) for Razmataz<T>
complains that, since I did not specify T, GWT compiler treated it as Object. Then GWT compiler would not accept Object class. It needs to be more specific than being an Object.

So, it seems there is no way for me to tell GWT.create what T is because a Class literal is a runtime concept while generics is a compile time concept, Right?

  • 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-05-14T23:29:55+00:00Added an answer on May 14, 2026 at 11:29 pm

    Someone left a short but concise answer here, which I was about to choose as the answer. Unfortunately, that person deleted that answer. If that person would be so kind to re-post that answer for me to select. In the mean time, let me state that answer and how I made use of it.

    This is what I should have thought of,


    Interface RazmatazString extends Razmataz<String>{}
    
    GWT.create(RazmatazString.class);
    

    Basing on the answer that was deleted,

    I would have a basic Razmataz interface pair the does a lot of stuffs, which I am too lazy to repeat.

    Abstract class Razmatazer{
    .....
    
      Interface Razmataz<T>{
      // does a lot of RPC stuffs
      }
    
      Interface RazmatazAsync<T>{
      // does a lot of RPC stuffs
      }
    
      RazmatazAsync<?> razmatazAsyncRPC;
    }
    

    The concept is not to instantiate razmatazAsyncRPC handle at the base class but at the derived class.

    For T = String

    StringRazmatazer extends Razmatazer{
    
      Interface RazmatazStringAsync extends RazmatazAsync<String>{}
      Interface RazmatazString extends Razmataz<String>{}
    
      razmatazAsyncRPC = GWT.create(RazmatazString.class);
    }
    

    Otherwise I would have to repeat ~100 lines of code, ~50 each for Razmataz and RazmatazAsync, over various T parametric values of String, Map, Boolean, Integer, etc.

    The basic premise for overcoming this hurdle was – I am lazy to repeat those lines.

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

Sidebar

Ask A Question

Stats

  • Questions 468k
  • Answers 468k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You will either need to use a Server Side Include… May 16, 2026 at 2:16 am
  • Editorial Team
    Editorial Team added an answer You can show a list of the keys in the… May 16, 2026 at 2:16 am
  • Editorial Team
    Editorial Team added an answer You can use the preprocessor "stringify" # to do what… May 16, 2026 at 2:16 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.