为什么Netbeans找不到接口实例的方法?

时间:2015-09-08 23:54:57

标签: java netbeans methods netbeans-8

我有一个班级:

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
    [PFPush handlePush:userInfo];
    UINavigationController *nav = (UINavigationController *) self.tabBarController.selectedViewController;
    NewsViewController *dvController8 = [[NewsViewController alloc] initWithNibName:@"NewsViewController" bundle:[NSBundle mainBundle]];
    [nav pushViewController:dvController8 animated:YES];

    if (application.applicationState == UIApplicationStateInactive) {
        UIAlertView *test = [[UIAlertView alloc] initWithTitle:@"INACTIVE" message:@"INACTIVE" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
        [test show];

        [self handleRemoteNotificationWithPayload:userInfo];
    }
}
-(void)handleRemoteNotificationWithPayload:(NSDictionary *)payload {
    UINavigationController *nav = (UINavigationController *) self.tabBarController.selectedViewController;
    NewsViewController *dvController8 = [[NewsViewController alloc] initWithNibName:@"NewsViewController" bundle:[NSBundle mainBundle]];
    [nav pushViewController:dvController8 animated:YES];



}

界面:

public class JWHTMLPage implements JWDisplayable {
    ...
}

另一堂课:

public interface JWDisplayable {

    public void addCSS(String link);
    public void addJS(String link);
    public void setViewport(String content);
    public void appendToBody(String html);
    public void updateHTML();

}

在JWHTMLPageMap中,我重写了addCSS方法。问题是NetBeans的自动完成没有找到JWHTMLPage的方法:

enter image description here

它将页面视为一个对象,但它是一个JWHTMLPage,它在JWDisplayable中实现所有这些方法。我究竟做错了什么??这毫无意义。

1 个答案:

答案 0 :(得分:1)

你的问题肯定来自这一行:

class SocialAuthSerializer(serializers.HyperlinkedModelSerializer):
    login = serializers.SerializerMethodField()

    def get_login(self, obj):
        return obj.extra_data['login']

你可能没有编译错误,但你使用现有的类是不正确的,好像它们是正式的generecity参数,然后真正的类将被通用参数隐藏

所以改为使用:

logger.info("Your message")

这可能会生成类似以下内容的警告:类型参数S不应受最终类型String的限制。最终类型无法进一步扩展(因为String是最终类型)

因此,为什么不简单地写一下:

public class JWHTMLPageMap<String, JWHTMLPage> implements Map<String, JWHTMLPage>, JWDisplayable {