public Object get ( Object propertyName ) { if ( propertyName instanceof CharSequence ) { propertyName = propertyName . toString ( ) ; } if ( propertyName instanceof List ) { Map submap = new HashMap ( ) ; List propertyNames = ( List ) propertyName ; for ( Object currentName : propertyNames ) { if ( currentName != null ) { currentName = currentName . toString ( ) ; if ( containsKey ( currentName ) ) { submap . put ( currentName , get ( currentName ) ) ; } } } return submap ; } if ( NameUtils . isConfigurational ( propertyName . toString ( ) ) ) { return null ; } Object val = null ; MetaProperty mp = metaClass . getMetaProperty ( propertyName . toString ( ) ) ; if ( mp != null ) { val = mp . getProperty ( instance ) ; } return val ; }
Obtains the value of an object s properties on demand using Groovy s MOP .