private void addPropertiesAtPath ( ParserRuleContext context , Map < String , Object > existingProperties , Iterable < String > path , Object value ) throws ParseException { Map < String , Object > current = existingProperties ; Iterator < String > iter = path . iterator ( ) ; while ( iter . hasNext ( ) ) { String pathPart = iter . next ( ) ; if ( iter . hasNext ( ) ) { if ( existingProperties . containsKey ( pathPart ) ) { Object val = existingProperties . get ( pathPart ) ; if ( ! ( val instanceof DataMap ) ) { throw new ParseException ( new ParseError ( new ParseErrorLocation ( context ) , "Conflicting property: " + path . toString ( ) ) ) ; } current = ( DataMap ) val ; } else { DataMap next = new DataMap ( ) ; current . put ( pathPart , next ) ; current = next ; } } else { if ( current . containsKey ( pathPart ) ) { throw new ParseException ( new ParseError ( new ParseErrorLocation ( context ) , "Property already defined: " + path . toString ( ) ) ) ; } else { current . put ( pathPart , value ) ; } } } }
Adds additional properties to an existing properties map at the location identified by the given path .