protected void extractProfilesAndAdd ( final String key , final String value , final Operator operator ) { String fullKey = key ; int ndx = fullKey . indexOf ( PROFILE_LEFT ) ; if ( ndx == - 1 ) { justAdd ( fullKey , value , null , operator ) ; return ; } // extract profiles ArrayList < String > keyProfiles = new ArrayList <> ( ) ; while ( true ) { ndx = fullKey . indexOf ( PROFILE_LEFT ) ; if ( ndx == - 1 ) { break ; } final int len = fullKey . length ( ) ; int ndx2 = fullKey . indexOf ( PROFILE_RIGHT , ndx + 1 ) ; if ( ndx2 == - 1 ) { ndx2 = len ; } // remember profile final String profile = fullKey . substring ( ndx + 1 , ndx2 ) ; keyProfiles . add ( profile ) ; // extract profile from key ndx2 ++ ; final String right = ( ndx2 == len ) ? StringPool . EMPTY : fullKey . substring ( ndx2 ) ; fullKey = fullKey . substring ( 0 , ndx ) + right ; } if ( fullKey . startsWith ( StringPool . DOT ) ) { // check for special case when only profile is defined in section fullKey = fullKey . substring ( 1 ) ; } // add value to extracted profiles justAdd ( fullKey , value , keyProfiles , operator ) ; }
Extracts profiles from the key name and adds key - value to them .