简体   繁体   中英

Can I return a generic in Google Cloud End Point

When I return a generic the end point api file seems to disappear. Sample code is pasted.

@ApiMethod
public RestResponse<Container> testGeneric() {
    Container container = new Container();

    container.testLong =  (long)4345;
    container.testDate = new Date();
    container.testString = "sathya";
    container.testDouble = 123.98;
    container.testInt = 123;

    RestResponse<Container> response = new RestResponse<Container>();
    response.t = container;

    return response;        
}

Is this a bug in endpoint and is such a thing not allowed at all ?

Regards, Sathya

I don't think it's a bug, but it's just not supported, in the same way that you can't return a String form your Endpoint...

In order to check what's the problem, if you're using the Google Plugin for Eclipse, you can look at the error log under Window -> Show View -> Error Log to get more info.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM