<commit_before>package com.atlassian.sal.jira.component;

import com.atlassian.jira.ComponentManager;
import com.atlassian.sal.api.component.ComponentLocator;

import org.picocontainer.ComponentAdapter;
import org.picocontainer.PicoContainer;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

public class JiraComponentLocator extends ComponentLocator
{
    public JiraComponentLocator()
    {
        ComponentLocator.setComponentLocator(this);
    }

    @SuppressWarnings("unchecked")
	protected <T> T getComponentInternal(Class<T> iface)
    {
        return (T) ComponentManager.getComponentInstanceOfType(iface);
    }

	@Override
	protected <T> Collection<T> getComponentsInternal(Class<T> iface)
	{
		Collection<T> implementations = new ArrayList<T>();
		PicoContainer picoContainer = ComponentManager.getInstance().getContainer();
		List componentAdaptersOfType = picoContainer.getComponentAdaptersOfType(iface);
		for (Iterator iterator = componentAdaptersOfType.iterator(); iterator.hasNext();)
		{
			ComponentAdapter componentAdapter = (ComponentAdapter) iterator.next();
			implementations.add((T) componentAdapter.getComponentInstance());
		}
		return implementations;
	}
}
<commit_msg>Added new method for getting components by key<commit_after>package com.atlassian.sal.jira.component;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

import org.picocontainer.ComponentAdapter;
import org.picocontainer.PicoContainer;

import com.atlassian.jira.ComponentManager;
import com.atlassian.sal.api.component.ComponentLocator;

public class JiraComponentLocator extends ComponentLocator
{
    public JiraComponentLocator()
    {
        ComponentLocator.setComponentLocator(this);
    }

    @SuppressWarnings("unchecked")
	protected <T> T getComponentInternal(Class<T> iface)
    {
        return (T) ComponentManager.getComponentInstanceOfType(iface);
    }

	@Override
	protected <T> Collection<T> getComponentsInternal(Class<T> iface)
	{
		Collection<T> implementations = new ArrayList<T>();
		PicoContainer picoContainer = ComponentManager.getInstance().getContainer();
		List componentAdaptersOfType = picoContainer.getComponentAdaptersOfType(iface);
		for (Iterator iterator = componentAdaptersOfType.iterator(); iterator.hasNext();)
		{
			ComponentAdapter componentAdapter = (ComponentAdapter) iterator.next();
			implementations.add((T) componentAdapter.getComponentInstance());
		}
		return implementations;
	}

	@Override
	protected <T> T getComponentInternal(Class<T> iface, String componentKey)
	{
		PicoContainer picoContainer = ComponentManager.getInstance().getContainer();
		List componentAdaptersOfType = picoContainer.getComponentAdaptersOfType(iface);
		for (Iterator iterator = componentAdaptersOfType.iterator(); iterator.hasNext();)
		{
			ComponentAdapter componentAdapter = (ComponentAdapter) iterator.next();
			if (componentKey.equals(componentAdapter.getComponentKey()))
					return (T) componentAdapter.getComponentInstance();
		}
		return null;
	}
}

{'fraction_non_alphanumeric': 0.10032154340836012, 'fraction_numerical': 0.0, 'mean_word_length': 5.898004434589801, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '2658232', 'n_tokens_mistral': 921, 'n_tokens_neox': 877, 'n_words': 165}