@ RestrictTo ( RestrictTo . Scope . LIBRARY ) public int incrementDepthBy ( String key , int depth ) { if ( isContainer ( key ) ) { // If it's a container then we added programatically and it isn't a part of the keypath. return 0 ; } if ( ! keys . get ( depth ) . equals ( "**" ) ) { // If it's not a globstar then it is part of the keypath. return 1 ; } if ( depth == keys . size ( ) - 1 ) { // The last key is a globstar. return 0 ; } if ( keys . get ( depth + 1 ) . equals ( key ) ) { // We are a globstar and the next key is our current key so consume both. return 2 ; } return 0 ; }
For a given key and depth returns how much the depth should be incremented by when resolving a keypath to children .