private Set < MemberLookupResult > performNestedLookup ( String variable ) { Set < MemberLookupResult > ret = new LinkedHashSet <> ( ) ; // start with the first part String [ ] parts = StringUtils . split ( variable , "." ) ; if ( parts . length > 2 ) { Set < MemberLookupResult > subResult = performNestedLookup ( StringUtils . substringBeforeLast ( variable , "." ) ) ; for ( MemberLookupResult result : subResult ) { if ( result . matches ( parts [ parts . length - 1 ] ) ) { ret . addAll ( getResultsForClass ( result . getReturnType ( ) , variable ) ) ; } } } else { Set < MemberLookupResult > subResults = performMemberLookup ( parts [ 0 ] ) ; for ( MemberLookupResult result : subResults ) { if ( result . matches ( parts [ 1 ] ) ) { // we found a method which has the correct name, now we can resolv this ret . addAll ( getResultsForClass ( result . getReturnType ( ) , variable ) ) ; } } } return ret ; }
performs a nested lookup . E . g for foo . bar it will resolve the type of bar and then get it s methods