private void removeUnusedEndpoints() {
    if (config == null) {
      return;
    }

    Set<String> endpoints = new HashSet<String>();

    for (Interface iface : project.getInterfaceList()) {
      endpoints.addAll(Arrays.asList(iface.getEndpoints()));
    }

    StringList keys = new StringList();

    synchronized (defaults) {
      for (String key : defaults.keySet()) {
        if (!endpoints.contains(key)) {
          keys.add(key);
        }
      }

      for (String key : keys) {
        EndpointDefaults def = defaults.remove(key);
        config.getEndpointList().remove(def);
      }
    }
  }
  private void initConfig() {
    ProjectConfig projectConfig = this.project.getConfig();

    if (!projectConfig.isSetEndpointStrategy()) {
      projectConfig.addNewEndpointStrategy();
    }

    config =
        (DefaultEndpointStrategyConfig)
            projectConfig.getEndpointStrategy().changeType(DefaultEndpointStrategyConfig.type);

    for (EndpointConfig endpointConfig : config.getEndpointList()) {
      if (!endpointConfig.isSetMode()) {
        endpointConfig.setMode(EndpointConfig.Mode.COMPLEMENT);
      }

      defaults.put(endpointConfig.getStringValue(), new EndpointDefaults(endpointConfig));
    }
  }