Constrianing the use of getjavaElement