是否可以使用 Java 中的一组注释创建自定义注释?
Is it possible to create a custom annotation with a group of annotations in Java?
我在我的系统中使用了 lombok 和 JPA。所以对于实体 classes,它们看起来都像:
@Getter
@Setter
@Entity
@NoArgsConstructor
@AllArgsConstructor
public class XxxEntity {
...
}
所以我的问题是我可以创建一个自定义注释来对所有这些注释进行分组吗?
所以它可能看起来像:
@CustomAnnotation
public class XxxEntity {
...
}
当我使用@CustomAnnotation 时,它会将上述所有注释应用到 class。
这可能吗?
谢谢。
我在我的系统中使用了 lombok 和 JPA。所以对于实体 classes,它们看起来都像:
@Getter
@Setter
@Entity
@NoArgsConstructor
@AllArgsConstructor
public class XxxEntity {
...
}
所以我的问题是我可以创建一个自定义注释来对所有这些注释进行分组吗?
所以它可能看起来像:
@CustomAnnotation
public class XxxEntity {
...
}
当我使用@CustomAnnotation 时,它会将上述所有注释应用到 class。
这可能吗?
谢谢。