Sonarqube Custom rule

I am trying to implement a SonarQube custom rule for Java. My requirement is to avoid certain method calls on certain instances of classes. I am able to report issue for certain method call but not able to check on which reference (instance of class) that method is called. Could anyone help on this? . The Sonarqube version that I am using is 5.6.6