Issue Details (XML | Word | Printable)

Key: GROOVY-2142
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Graeme Rocher
Reporter: Graeme Rocher
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
groovy

Add new metaClass property to all objects to unify access to meta class across instances

Created: 25/Sep/07 06:12 PM   Updated: 30/Nov/07 10:15 PM   Resolved: 25/Sep/07 07:46 PM
Return to search
Component/s: None
Affects Version/s: 1.0, 1.1-beta-1, 1.1-beta-2, 1.1-beta-3
Fix Version/s: 1.1-rc-1

Time Tracking:
Not Specified


 Description  « Hide

Currently you have to check before hand if an object is a GroovyObject and then have selective logic to obtain the MetaClass:

def metaClass
if(obj instanceof GroovyObject) metaClass = obj.metaClass
else {
  metaClass = GroovySystem.metaClassRegistry.getMetaClass(obj.class)
}

This is ugly and error prone. There should be a property on all objects that simplifies this logic to just:

def metaClass = obj.metaClass


Graeme Rocher made changes - 25/Sep/07 07:46 PM
Field Original Value New Value
Resolution Fixed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]
Paul King made changes - 30/Nov/07 10:15 PM
Status Resolved [ 5 ] Closed [ 6 ]