public void setNewInstanceResolver(final Object newInstanceResolver) {
        if (newInstanceResolver instanceof NewInstanceResolver) {
            this.newInstanceResolver = (NewInstanceResolver) newInstanceResolver;
        } else if (newInstanceResolver instanceof Closure) {
            final ObjectGraphBuilder self = this;
            this.newInstanceResolver = new NewInstanceResolver() {
                public Object newInstance(Class klass, Map attributes)
                        throws InstantiationException, IllegalAccessException {
                    Closure cls = (Closure) newInstanceResolver;
                    cls.setDelegate(self);
                    return cls.call(klass, attributes);
                }
            };
        } else {
            this.newInstanceResolver = new DefaultNewInstanceResolver();
        }
    }
public void setNewInstanceResolver ( final Object newInstanceResolver ) { if ( newInstanceResolver instanceof NewInstanceResolver ) { this . newInstanceResolver = ( NewInstanceResolver ) newInstanceResolver ; } else if ( newInstanceResolver instanceof Closure ) { final ObjectGraphBuilder self = this ; this . newInstanceResolver = new NewInstanceResolver ( ) { public Object newInstance ( Class klass , Map attributes ) throws InstantiationException , IllegalAccessException { Closure cls = ( Closure ) newInstanceResolver ; cls . setDelegate ( self ) ; return cls . call ( klass , attributes ) ; } } ; } else { this . newInstanceResolver = new DefaultNewInstanceResolver ( ) ; } }
Sets the current NewInstanceResolver.<br>
It will assign DefaultNewInstanceResolver if null.<br>
It accepts a NewInstanceResolver instance or a Closure.