Collection MetaClasses与其他MetaClasses有什么不同?

时间:2018-02-14 12:52:34

标签: groovy collections metaprogramming

As this image shows,我可以从字符串和其他MetaClasses中获取MetaMethod,但IDEA说它无法解析" getMetaMethod"对于Collection或List MetaClasses,它返回null。

Collection MetaClass与其他Object MetaClasses不同吗?

编辑:这是代码

def listToString = List.metaClass.getMetaMethod("toString", null)
def collectionToString = Collection.metaClass.getMetaMethod("toString", null)

def stringToString = String.metaClass.getMetaMethod("toString", null)
def objectToString = Object.metaClass.getMetaMethod("toString", null)
def integerToString = Integer.metaClass.getMetaMethod("toString", null)

println listToString
println collectionToString
println stringToString
println objectToString
println integerToString

0 个答案:

没有答案