<commit_before>/*
 * Grapht, an open source dependency injector.
 * Copyright 2010-2012 Regents of the University of Minnesota and contributors
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 51
 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */
package org.grouplens.grapht;

import javax.annotation.Nullable;
import javax.inject.Qualifier;
import java.lang.annotation.Annotation;

/**
 * <p>
 * Context is the main entry point for configuring bind rules using the fluent
 * API. The dependency injector uses the contexts to limit the scope of a
 * binding. Every time a dependency is satisfied, that type (and possibly {@link Qualifier})
 * is pushed onto the context stack. Thus, if two different types each require a
 * Foo, there can be two different bindings activated depending on which first
 * type is in the context stack.
 * <p>
 * The "root" context is an empty stack, and will always be matched. When
 * creating bindings, the context stack can be configured by calling
 * {@link #in(Class)} or {@link #in(Class, Class)}.
 * 
 * @see org.grouplens.grapht.spi.ElementChainContextMatcher
 * @author <NAME> <<EMAIL>>
 */
public interface Context {
    /**
     * Start a new binding for the given type T within the scope of this
     * context. The returned Binding instance can be configured and completed by
     * invoking one of its various to() methods. By default, the resulting binding will
     * apply to both qualified and unqualified uses of the type; see {@link Binding#withQualifier(Class)}
     * to restrict to qualified types, and {@link Binding#unqualified()}} to restrict to only
     * match unqualified types.
     * 
     * @param <T> The matched source type
     * @param type The raw class that is matched
     * @return A new binding in this context for type T
     */
    <T> Binding<T> bind(Class<T> type);

    /**
     * Start a new binding for a qualified type. A shortcut for {@code
     * bind(type).withQualifier(qual)}, if {@code qual} is non-null, and {@code
     * bind(type).unqualified()} if {@code qual} is null.
     *
     * @param qual The type's qualifier.
     * @param type The type to bind.
     * @param <T>  The type to bind.
     * @return A new binding in this context for T with qualifier qual.
     * @see #bind(Class)
     * @see Binding#withQualifier(Class)
     * @see Binding#unqualified()
     */
    <T> Binding<T> bind(Class<? extends Annotation> qual, Class<T> type);

    /**
     * @deprecated Use {@link #within(Class)}.
     */<commit_msg>Backed out changeset 922ede81315b<commit_after>/*
 * Grapht, an open source dependency injector.
 * Copyright 2010-2012 Regents of the University of Minnesota and contributors
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 51
 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */
package org.grouplens.grapht;

import javax.annotation.Nullable;
import javax.inject.Qualifier;
import java.lang.annotation.Annotation;

/**
 * <p>
 * Context is the main entry point for configuring bind rules using the fluent
 * API. The dependency injector uses the contexts to limit the scope of a
 * binding. Every time a dependency is satisfied, that type (and possibly {@link Qualifier})
 * is pushed onto the context stack. Thus, if two different types each require a
 * Foo, there can be two different bindings activated depending on which first
 * type is in the context stack.
 * <p>
 * The "root" context is an empty stack, and will always be matched. When
 * creating bindings, the context stack can be configured by calling
 * {@link #in(Class)} or {@link #in(Class, Class)}.
 * 
 * @see org.grouplens.grapht.spi.ElementChainContextMatcher
 * @author <NAME> <<EMAIL>>
 */
public interface Context {
    /**
     * Start a new binding for the given type T within the scope of this
     * context. The returned Binding instance can be configured and completed by
     * invoking one of its various to() methods.
     * 
     * @param <T> The matched source type
     * @param type The raw class that is matched
     * @return A new binding in this context for type T
     */
    <T> Binding<T> bind(Class<T> type);

    /**
     * Start a new binding for a qualified type. A shortcut for {@code
     * bind(type).withQualifier(qual)}, if {@code qual} is non-null, and {@code
     * bind(type).unqualified()} if {@code qual} is null.
     *
     * @param qual The type's qualifier.
     * @param type The type to bind.
     * @param <T>  The type to bind.
     * @return A new binding in this context for T with qualifier qual.
     * @see Binding#withQualifier(Class)
     */
    <T> Binding<T> bind(Class<? extends Annotation> qual, Class<T> type);

    /**
     * @deprecated Use {@link #within(Class)}.
     */
{'fraction_non_alphanumeric': 0.08601070950468541, 'fraction_numerical': 0.008366800535475234, 'mean_word_length': 3.3916238060249815, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, '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': '4661976', 'n_tokens_mistral': 1658, 'n_tokens_neox': 1580, 'n_words': 797}