小编Mic*_*UER的帖子

通过自定义注释切换GWT.create(XXX.class)

我希望你们的编码都很好。所以...我正在重构正在使用的GWT应用程序的客户端,我想知道一些事情。日复一日地寻找答案,我决定问您您的观点...

标题是相当理解的,但是有我想做的一小段。

我想改变这样的东西

public AnnotatedObject annotated = GWT.create(AnnotatedObject.class);
Run Code Online (Sandbox Code Playgroud)

通过这样的事情

@CreativeAnnotation
public AnnotatedObject;
Run Code Online (Sandbox Code Playgroud)

我不得不说,在我的xxx.gwt.xml中,我做了这样的事情:

<replace-with class="package.AnnotationObject2">
    <when-type-is class="package.AnnotationObject" />
</replace-with>
Run Code Online (Sandbox Code Playgroud)

如您所见,我的递减替换类是AnnotationObject2,目前,我在上面的替换类之间添加了一行,并且有:

<replace-with class="package.AnnotationObject1">
    <when-type-is class="package.AnnotationObject" />
    <when-property-is name="type" value="object1" />
</replace-with>

<replace-with class="package.AnnotationObject2">
    <when-type-is class="package.AnnotationObject" />
    <when-property-is name="type" value="object2" />
</replace-with>
Run Code Online (Sandbox Code Playgroud)

我不太喜欢使用xxx.html的元数据,因此我想要的结果是:

@CreativeAnnotation(type = "object2")
public AnnotatedObject;
Run Code Online (Sandbox Code Playgroud)

那么,您是否认为GWT可以实现这种事情(我不得不说我使用GWT 2.5,这是由于客户的需求引起的)吗?如果可以,您能帮我吗?

提前致谢。

编辑:我的意思是,我知道GIN ...只是想知道如何从头开始。

gwt binding annotations

1
推荐指数
1
解决办法
401
查看次数

标签 统计

annotations ×1

binding ×1

gwt ×1