English 中文(简体)
在通知中进入静态领域
原标题:Accessing static field in annotation

试图在格罗莫夫尼族中使用贾瓦语,但很难将ava类固定位置作为参数:

说明:Id.java

package x.y.annotations;

import java.lang.annotation.ElementType;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface Id {

    public Class<Adapter> adapter();

    public Class<Object> targetType();

    public String targetAttribute();

    public String onDelete();

}

静态田的 j类:XPerson.java

package x.y.static.domain;

public class XPerson {

    public static String ID;

}

以及出现问题的农奴阶级: 个人:农业

package x.y.domain

import x.y.annotations.Id
import x.y.static.domain.XPerson

class Person {

    @Id(adapter = Adapter, targetType = XPerson, targetAttribute = XPerson.ID, onDelete = "delete")
    long id
}

Eclipse为“targetAttribute = XPerson.ID”部分:

Groovy:expected x.y.domain。 iii 不得以@x.y.annotations表示财产。 Id

我还尝试了“XPerson.@ID”等物品,或为国际发展学领域确定一个接线器,但没有任何帮助。

Any hints would be great.

Regards, michael

最佳回答
问题回答




相关问题
Groovy - how to exit each loop?

I m new to Grails/Groovy and am trying to find a node in a an xml file; I ve figured out how to iterate over all of them, but I want to exit the loop when the target node is found. I ve read that ...

Eclipse Spring Builder set properties with Groovy beans

I typically use groovy to construct simple bean but the Spring IDE plugin to eclipse fails to build when I try to set a property that is generated by groovy without an explicit setter. For example, ...

How can I get this snippet to work?

I d like to port a little piece of code from Ruby to Groovy, and I m stuck at this: def given(array,closure) { closure.delegate = array closure() } given([1,2,3,4]) { findAll { it > 4} ...

Changing the value in a map in Groovy

This is about a very basic program I m writing in Groovy. I have defined a map inside a method: def addItem() { print("Enter the item name: ") def itemName = reader.readLine() print(...

Is functional Clojure or imperative Groovy more readable?

OK, no cheating now. No, really, take a minute or two and try this out. What does "positions" do? Edit: simplified according to cgrand s suggestion. (defn redux [[current next] flag] [(if flag ...

热门标签