ResolveSource replaceWithinCurrentParent ( AbstractConfigValue old , AbstractConfigValue replacement ) { if ( ConfigImpl . traceSubstitutionsEnabled ( ) ) ConfigImpl . trace ( "replaceWithinCurrentParent old " + old + "@" + System . identityHashCode ( old ) + " replacement " + replacement + "@" + System . identityHashCode ( old ) + " in " + this ) ; if ( old == replacement ) { return this ; } else if ( pathFromRoot != null ) { Container parent = pathFromRoot . head ( ) ; AbstractConfigValue newParent = parent . replaceChild ( old , replacement ) ; return replaceCurrentParent ( parent , ( newParent instanceof Container ) ? ( Container ) newParent : null ) ; } else { if ( old == root && replacement instanceof Container ) { return new ResolveSource ( rootMustBeObj ( ( Container ) replacement ) ) ; } else { throw new ConfigException . BugOrBroken ( "replace in parent not possible " + old + " with " + replacement + " in " + this ) ; // return this; } } }
replacement may be null to delete