public static void createEventInterface(
      Option option, String packageName, String rootDirectoryPathName) {
    JCodeModel model = new JCodeModel();

    try {
      JDefinedClass jClass =
          model._class(
              packageName + "." + EventHelper.getEventNamePrefix(option) + EventHelper.EVENT_SUFFIX,
              ClassType.INTERFACE);
      // jClass._extends(NativeEvent.class);

      // TODO this logic should not be in an helper, pb it is duplicated
      // inside all helper, should have a common algo
      // write getter for Series / Point / Chart / Axis (context) inside
      // event
      if (option.getContext() != null)
        EventHelper.getType(option)
            .accept(new EventGetterWriterVisitor(option, jClass, model), OutputType.Interface);

      ClassRegistry.INSTANCE.put(option, OutputType.Interface, jClass);

    } catch (JClassAlreadyExistsException e) {
      throw new RuntimeException(e);
    }

    try {
      model.build(new File(rootDirectoryPathName));
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
  public static JDefinedClass createFunctionCallbackInterface(
      Option option, String packageName, String rootDirectoryPathName) {
    JCodeModel model = new JCodeModel();

    JDefinedClass jClass = null;

    try {
      String fqn = FunctionHelper.getFunctionCallbackFqn(option, packageName);

      JClass contextObject = FunctionHelper.getContextObject(option, OutputType.Interface);

      jClass = model._class(fqn, ClassType.INTERFACE);

      JMethod method = jClass.method(JMod.NONE, Object.class, EventHelper.ON_PREFIX + "Callback");

      if (contextObject != null)
        method.param(
            contextObject,
            option.getContext().substring(0, 1).toLowerCase() + option.getContext().substring(1));

      ClassRegistry.INSTANCE
          .getRegistry()
          .put(new ClassRegistry.RegistryKey(option, OutputType.Interface), jClass);

      logger.info("Function callback created;" + option.getTitle());

    } catch (JClassAlreadyExistsException e) {
      throw new RuntimeException(e);
    }

    try {
      model.build(new File(rootDirectoryPathName));
    } catch (IOException e) {
      throw new RuntimeException(e);
    }

    return jClass;
  }
  public static JDefinedClass createEventHandlerInterface(
      Option option, String packageName, String rootDirectoryPathName) {
    JCodeModel model = new JCodeModel();

    JDefinedClass jClass = null;

    try {
      String eventName = EventHelper.getEventNamePrefix(option);
      String handlerName = eventName + EventHelper.HANDLER_SUFFIX;
      String fullyqualifiedName = packageName + "." + handlerName;
      jClass = model._class(fullyqualifiedName, ClassType.INTERFACE);

      JClass eventClass =
          ClassRegistry.INSTANCE
              .getRegistry()
              .get(new ClassRegistry.RegistryKey(option, OutputType.Interface));

      jClass
          .method(JMod.NONE, void.class, EventHelper.ON_PREFIX + eventName)
          .param(eventClass, EventHelper.paramName(eventName));

      EventRegistry.INSTANCE.put(EventHelper.getRegistryKey(option), jClass);
      logger.info("Handler created;" + handlerName);

    } catch (JClassAlreadyExistsException e) {
      throw new RuntimeException(e);
    }

    try {
      model.build(new File(rootDirectoryPathName));
    } catch (IOException e) {
      throw new RuntimeException(e);
    }

    return jClass;
  }