Skip to content

Instantly share code, notes, and snippets.

@vorburger
Created July 27, 2016 18:04
Show Gist options
  • Select an option

  • Save vorburger/c43272ccb4bc3db8d85baaa6686a3c27 to your computer and use it in GitHub Desktop.

Select an option

Save vorburger/c43272ccb4bc3db8d85baaa6686a3c27 to your computer and use it in GitHub Desktop.
/*
* Copyright (c) 2016 Red Hat, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
package org.opendaylight.netvirt.aclservice.tests.utils.inject;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import javax.inject.Provider;
/**
* Class annotation to indicate a concrete {@link Provider} which can provide an instance
* of the annotated class.
*
* <p>
* This is used in conjunction with frameworks such as JUnit which typically
* control creation of instances themselves (in JUnit's case of Tests), but have
* a hook allowing to customize them; that hook then needs a hint how to create
* respective instances, and this provides that.
*
* @see ProviderRunner
*
* @author Michael Vorburger
*/
@Inherited
@Target(TYPE)
@Retention(RUNTIME)
public @interface InstanceProvidedBy {
/**
* Specify the {@link Provider}.
*
* @return a class which implements {@link Provider} with a get() that
* returns a class of the type that is annotated with this
* annotation
*/
Class<? extends Provider<?>> value();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment