Java Mailing List Archive

http://www.gg3721.com/

Home » user.groovy »

[groovy-user] how can I tell if a property is defined in a type hierarchy?

Justin Edelson

2010-09-01

Replies: Find Java Web Hosting

Author LoginPost Reply
http://groovyconsole.appspot.com/script/219001 has a minimal example of
what I'm going to describe below.

I'm trying to add some groovy-based syntatic sugar to the Java Content
Repository API and am running into what looks like a weird MetaClass
problem.

I'm modifying the MetaClass of javax.jcr.Node[1], which extends
javax.jcr.Item[2]. The Item interface defines some getters like:

getDepth()
getName()
getPath()
etc.

Likewise, the Node interface defines some getters:
getIndex()
getNodes()
etc.

Given this, I would expect that Node.metaClass.getProperty("name") would
return a non-null value. However, it returns null.
Node.metaClass.getProperty("index") returns non-null.

What is the correct way to ask the MetaClass "does the property 'name'
in your type hierarchy?"

Thanks,

Justin

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email


©2008 gg3721.com - Jax Systems, LLC, U.S.A.