Is that possible to restrict some import packages in groovy script engine

TaskListener Groovy script sample code

import myApplication.demo.HelloWorld; // I want only user to allow this import package only, rest of the package will not able to access

def map = [:]
map.name = “saravanan”
def println = new HelloWorld().demo(“d”) // demo function will return something