public void setProperty ( final String property , final Object newValue ) { if ( property . startsWith ( "@" ) ) { if ( newValue instanceof String || newValue instanceof GString ) { final Iterator iter = iterator ( ) ; while ( iter . hasNext ( ) ) { final NodeChild child = ( NodeChild ) iter . next ( ) ; child . attributes ( ) . put ( property . substring ( 1 ) , newValue ) ; } } } else { final GPathResult result = new NodeChildren ( this , property , this . namespaceTagHints ) ; if ( newValue instanceof Map ) { for ( Object o : ( ( Map ) newValue ) . entrySet ( ) ) { final Map . Entry entry = ( Map . Entry ) o ; result . setProperty ( "@" + entry . getKey ( ) , entry . getValue ( ) ) ; } } else { if ( newValue instanceof Closure ) { result . replaceNode ( ( Closure ) newValue ) ; } else { result . replaceBody ( newValue ) ; } } } }
Replaces the specified property of this GPathResult with a new value .