/*
   * (non-Javadoc)
   *
   * @see com.puppetlabs.geppetto.pp.dsl.linking.IMessageAcceptor#accept(org.eclipse.xtext.diagnostics.Severity, java.lang.String,
   * org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EStructuralFeature, int, java.lang.String, java.lang.String)
   */
  @Override
  public void accept(
      Severity severity,
      String message,
      EObject source,
      EStructuralFeature feature,
      int index,
      String issueCode,
      String... issueData) {

    if (severity == null) throw new IllegalArgumentException("severity can not be null");
    if (feature == null) throw new IllegalArgumentException("feature can not be null");
    if (source == null) throw new IllegalArgumentException("source can not be null");

    if (source.eClass().getEStructuralFeature(feature.getName()) != feature) {
      throw new IllegalArgumentException(
          "EClass '"
              + source.eClass().getName()
              + "' does not expose a feature '"
              + feature.getName()
              + //
              "' (id: "
              + feature.getFeatureID()
              + ")");
    }

    producer.setNode(getNode(source, feature, index));
    DiagnosticMessage m = new DiagnosticMessage(message, severity, issueCode, issueData);
    producer.addDiagnostic(m);
  }
  /*
   * (non-Javadoc)
   *
   * @see com.puppetlabs.geppetto.pp.dsl.linking.IMessageAcceptor#accept(org.eclipse.xtext.diagnostics.Severity, java.lang.String,
   * org.eclipse.xtext.nodemodel.INode, java.lang.String, java.lang.String)
   */
  @Override
  public void accept(
      Severity severity, String message, INode node, String issueCode, String... issueData) {

    if (node == null) throw new IllegalArgumentException("node can not be null");

    producer.setNode(node);
    DiagnosticMessage m = new DiagnosticMessage(message, severity, issueCode, issueData);
    producer.addDiagnostic(m);
  }