斯卡拉类型别名注解 [英] Scala Type aliases for annotations
本文介绍了斯卡拉类型别名注解的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的code点多,三个注释一起出现:
In many points of my code, three annotations appears together:
@BeanProperty
@(SpaceProperty @beanGetter)(nullValue="0")
其中, NullValue属性=0
是一个参数的注释 SpaceProperty
。
是否有可能定义一个类型别名 @BeanProperty @(SpaceProperty @beangetter)
?
Is it possible to define a single type alias for @BeanProperty @(SpaceProperty @beangetter)
?
我能做的最好的是:
type ScalaSpaceProperty = SpaceProperty @beanGetter
@BeanProperty
@(ScalaSpaceProperty)(nullValue = "0")
是否有可能定义一个类型别名其中的参数应用到最后一两个注解?
Is it possible to define a type alias for two annotations where the parameters are applied to the last one?
推荐答案
没有。您的可以的编写宏为此在斯卡拉2.10,我认为(但文档不可的时刻,所以我不能检查)。
No. You can write a macro to do this in Scala 2.10, I think (but the documentation isn't available at the moment, so I can't check).
这篇关于斯卡拉类型别名注解的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文