Created
May 10, 2018 18:45
-
-
Save gastaldi/b5974e07a55df696e805c6e30d766470 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.thorntail.condition.annotation; | |
import java.lang.annotation.ElementType; | |
import java.lang.annotation.Repeatable; | |
import java.lang.annotation.Retention; | |
import java.lang.annotation.RetentionPolicy; | |
import java.lang.annotation.Target; | |
/** | |
* Annotation which may be placed upon a CDI component to conditionally veto it if a class is not present. | |
* | |
* <p>If the class mentioned in the annotation cannot be found, this component will be fully veto'd by the CDI container.</p> | |
* | |
* <p>This annotation may be used repeatedly and with {@link RequiredClassNotPresent} to create complex conditoions</p> | |
* | |
* <p>All condition annotations will be applied with implicit <b>AND</b> semantics.</p> | |
* | |
* <pre> | |
* @ApplicationScoped | |
* @RequiredClassPresent("org.something.WhichIsRequired") | |
* public class MyComponent { | |
* | |
* } | |
* </pre> | |
* | |
* @author Ken Finnigan | |
* @author Bob McWhirter | |
* | |
* @see RequiredClassNotPresent | |
*/ | |
@Retention(RetentionPolicy.RUNTIME) | |
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD}) | |
@Repeatable(RequiredClassPresent.List.class) | |
public @interface RequiredClassPresent { | |
String value(); | |
@Retention(RetentionPolicy.RUNTIME) | |
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD}) | |
@interface List { | |
RequiredClassPresent[] value(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment