| 1 |
/* |
| 2 |
* JBoss, Home of Professional Open Source |
| 3 |
* Copyright 2016, Red Hat, Inc., and individual contributors |
| 4 |
* by the @authors tag. See the copyright.txt in the distribution for a |
| 5 |
* full listing of individual contributors. |
| 6 |
* |
| 7 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 |
* you may not use this file except in compliance with the License. |
| 9 |
* You may obtain a copy of the License at |
| 10 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 11 |
* Unless required by applicable law or agreed to in writing, software |
| 12 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 13 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 |
* See the License for the specific language governing permissions and |
| 15 |
* limitations under the License. |
| 16 |
*/ |
| 17 |
|
| 18 |
package jakarta.enterprise.inject.spi.configurator; |
| 19 |
|
| 20 |
import jakarta.enterprise.inject.spi.InjectionPoint; |
| 21 |
import jakarta.enterprise.inject.spi.ProcessInjectionPoint; |
| 22 |
import java.lang.annotation.Annotation; |
| 23 |
import java.lang.reflect.Type; |
| 24 |
import java.util.Set; |
| 25 |
|
| 26 |
/** |
| 27 |
* This API is an helper to configure an existing {@link InjectionPoint} instance. |
| 28 |
* CDI container must provides an implementation of this interface. |
| 29 |
* |
| 30 |
* This builder is not thread safe and shall not be used concurrently. |
| 31 |
* |
| 32 |
* <p>CDI Lite implementations are not required to provide support for Portable Extensions.</p> |
| 33 |
* |
| 34 |
* @see ProcessInjectionPoint#configureInjectionPoint() |
| 35 |
* @author Antoine Sabot-Durand |
| 36 |
* @since 2.0 |
| 37 |
*/ |
| 38 |
public interface InjectionPointConfigurator { |
| 39 |
|
| 40 |
/** |
| 41 |
* Set the required {@link Type} (that will be used during typesafe resolution) |
| 42 |
* of the InjectionPoint to build. |
| 43 |
* |
| 44 |
* @param requiredType for the InjectionPoint to build |
| 45 |
* @return self |
| 46 |
*/ |
| 47 |
InjectionPointConfigurator type(Type requiredType); |
| 48 |
|
| 49 |
/** |
| 50 |
* |
| 51 |
* Add the qualifier to the InjectionPoint to build |
| 52 |
* |
| 53 |
* @param qualifier the qualifier to add |
| 54 |
* @return self |
| 55 |
*/ |
| 56 |
InjectionPointConfigurator addQualifier(Annotation qualifier); |
| 57 |
|
| 58 |
/** |
| 59 |
* |
| 60 |
* Add all the qualifiers to the InjectionPoint to build |
| 61 |
* |
| 62 |
* @param qualifiers a varargs or array of qualifiers to add |
| 63 |
* @return self |
| 64 |
*/ |
| 65 |
InjectionPointConfigurator addQualifiers(Annotation... qualifiers); |
| 66 |
|
| 67 |
/** |
| 68 |
* |
| 69 |
* Add all the qualifiers to the InjectionPoint to build |
| 70 |
* |
| 71 |
* @param qualifiers a Set of qualifiers to add |
| 72 |
* @return self |
| 73 |
*/ |
| 74 |
InjectionPointConfigurator addQualifiers(Set<Annotation> qualifiers); |
| 75 |
|
| 76 |
/** |
| 77 |
* Replace all qualifiers. |
| 78 |
* |
| 79 |
* @param qualifiers a varargs or array of qualifiers to replace to existing ones |
| 80 |
* @return self |
| 81 |
*/ |
| 82 |
InjectionPointConfigurator qualifiers(Annotation... qualifiers); |
| 83 |
|
| 84 |
/** |
| 85 |
* Replace all qualifiers. |
| 86 |
* |
| 87 |
* @param qualifiers a Set of qualifiers to replace to existing ones |
| 88 |
* @return self |
| 89 |
*/ |
| 90 |
InjectionPointConfigurator qualifiers(Set<Annotation> qualifiers); |
| 91 |
|
| 92 |
/** |
| 93 |
* |
| 94 |
* Change the delegate status of the built InjectionPoint. |
| 95 |
* By default the InjectionPoint is not a delegate one. |
| 96 |
* |
| 97 |
* @param delegate boolean to define or undefine the delegate nature of the configured InjectionPoint |
| 98 |
* @return self |
| 99 |
*/ |
| 100 |
InjectionPointConfigurator delegate(boolean delegate); |
| 101 |
|
| 102 |
/** |
| 103 |
* |
| 104 |
* Change the transient status of the built InjectionPoint. |
| 105 |
* By default the InjectionPoint is not transient. |
| 106 |
* |
| 107 |
* @param trans boolean to define or undefine the transient nature of the configured InjectionPoint |
| 108 |
* @return self |
| 109 |
*/ |
| 110 |
InjectionPointConfigurator transientField(boolean trans); |
| 111 |
} |