Consider using anonymous classes.