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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:08:14+00:00 2026-06-01T23:08:14+00:00

I am kind a confuse on the implementation i am working on. This the

  • 0

I am kind a confuse on the implementation i am working on. This the method which i am suppose to call

<I, O, T> T post(String url, I data, ContentBuilder<I, HttpEntity> contentBuilder, ResponseHandler<? extends T> responseHandler);

Now i have to write couple of classes which will be used for ContentBuilder and responsehandler. the thing to be noticed is return type T.

I wrote an abstract class WSResponse and then extended it MyWSResponse so that my response handler looks like

ResponseHandler <WSResponse> rh = new MyWSResponse();

The method which is calling this post method has this signature

public interface GPCl{
   public <T> T callPost (String data)
}

…

public <T> T callPost(String data){
    HttpWebServiceClient client = getHttpWSClient();
    ContentBuilder<String, HttpEntity> contentBuilder = new MyXMLBuilder();
    ResponseHandler<WSResponse> rh= new MyWSResponse();

    WSResponse wsResponse = client.post("", data, contentBuilder, rh);
    return (T)wsResponse;
}

Now i am confused at return type of this method. Would it remain T or something else? If i change it from T to WSRespons, i get an error that i haven’t implemented method callPost.

The method callPost is being called as

GPClient cl = new GPClient(myhttpParams);
cl.callPost(d)

P.S:
this is first time i am dealing with generics

  • 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-01T23:08:16+00:00Added an answer on June 1, 2026 at 11:08 pm

    Methods of this type — <T> T method(things that don't mention T) — are almost never what you want to do, and are highly dangerous, because they inevitably involve casts that probably don’t work — but you won’t be warned until it fails at runtime. I suspect that the return type of this method should just be WSResponse, but your question isn’t clear enough for me to be sure.

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

Sidebar

Related Questions

i.m kind of confuse about this code if($filter_col!=null && $filter_val!=null) $filter = $filter_col.|.$filter_val; $prevpage
Kind of related to this question: https://stackoverflow.com/questions/8708525/how-to-check-if-mako-function-exist I want to check if a function
I'll make this as short and to the point as possible, but it's kind
This may be simple, but it's kind of tough for a not-so-jquery guy like
i am kind of confused why python add some additional decimal number in this
I am kind of confused on where to put this : try { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
i have a simple question about caching, this kind of confuses me lol Im
I've been mulling over this for a few weeks in preparation but kind of
I'm kind of confuse with the navigation properties in the EF Code First. The
I'm kind of confuse a little bit, I just got my Macbook Pro today

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.