org.eclipse.sisu.space.WildcardKey Maven / Gradle / Ivy
/*
* Copyright (c) 2010-2024 Sonatype, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Stuart McCulloch (Sonatype, Inc.) - initial API and implementation
*/
package org.eclipse.sisu.space;
import java.lang.annotation.Annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import javax.inject.Provider;
import javax.inject.Qualifier;
import com.google.inject.Key;
import com.google.inject.TypeLiteral;
/**
* Binding {@link Key} for implementations that act as "wild-cards", meaning they match against any assignable type.
*
* Since the wild-card type is {@link Object} and the associated qualifier may not be unique between implementations,
* the qualifier is saved and replaced with a unique (per-implementation) pseudo-qualifier. The original qualifier is
* available by casting the pseudo-qualifier to {@link Provider} and calling {@code get()}.
*/
final class WildcardKey
{
// ----------------------------------------------------------------------
// Constants
// ----------------------------------------------------------------------
private static final TypeLiteral
© 2015 - 2024 Weber Informatics LLC | Privacy Policy