<commit_before>package org.vaadin.highlighter;

import org.vaadin.highlighter.client.state.ComponentHighlighterState;

import com.vaadin.server.AbstractClientConnector;
import com.vaadin.server.AbstractExtension;
import com.vaadin.server.VaadinService;

public class ComponentHighlighterExtension extends AbstractExtension {

  @Override
  public void extend(AbstractClientConnector target) {
    if (VaadinService.getCurrent().getDeploymentConfiguration().isProductionMode()) {
      return;
    }
    super.extend(target);
    setComponentDebugLabel(target.getClass().getCanonicalName());
  }

  @Override
  protected ComponentHighlighterState getState() {
    return (ComponentHighlighterState) super.getState();
  }

  public void setComponentDebugLabel(String label) {
    getState().debugLabel = label;
  }

}
<commit_msg>Simplified extension API a bit. The component to be extended can be passed in through the extension's constructor.<commit_after>package org.vaadin.highlighter;

import org.vaadin.highlighter.client.state.ComponentHighlighterState;

import com.vaadin.server.AbstractClientConnector;
import com.vaadin.server.AbstractExtension;
import com.vaadin.server.VaadinService;

public class ComponentHighlighterExtension extends AbstractExtension {

  public ComponentHighlighterExtension() {
    super();
  }

  public ComponentHighlighterExtension(AbstractClientConnector target) {
    super();
    if (target != null) {
      extend(target);
    }
  }

  @Override
  public void extend(AbstractClientConnector target) {
    if (VaadinService.getCurrent().getDeploymentConfiguration().isProductionMode()) {
      return;
    }
    super.extend(target);
    setComponentDebugLabel(target.getClass().getCanonicalName());
  }

  @Override
  protected ComponentHighlighterState getState() {
    return (ComponentHighlighterState) super.getState();
  }

  public void setComponentDebugLabel(String label) {
    getState().debugLabel = label;
  }

}

{'fraction_non_alphanumeric': 0.08956692913385826, 'fraction_numerical': 0.0, 'mean_word_length': 4.1994884910485935, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '983649', 'n_tokens_mistral': 580, 'n_tokens_neox': 544, 'n_words': 104}