Debian Codegraph @

api/src/main/java/jakarta/enterprise/inject/spi/configurator/BeanAttributesConfigurator.java

raw
1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2015, 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 package jakarta.enterprise.inject.spi.configurator;
18
19 import jakarta.enterprise.inject.spi.BeanAttributes;
20 import jakarta.enterprise.inject.spi.ProcessBeanAttributes;
21 import jakarta.enterprise.util.TypeLiteral;
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 a new {@link BeanAttributes} instance.
28 * CDI container must provides an implementation of this interface.
29 *
30 * This configurator 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 ProcessBeanAttributes#configureBeanAttributes()
35 * @param <T> the class of the bean instance
36 * @author Antoine Sabot-Durand
37 * @since 2.0
38 */
39 public interface BeanAttributesConfigurator<T> {
40
41 /**
42 *
43 * Add a type to the bean types
44 *
45 * @param type the type to add
46 * @return self
47 */
48 BeanAttributesConfigurator<T> addType(Type type);
49
50 /**
51 *
52 * Add a type to the bean types
53 *
54 * @param typeLiteral the type to add
55 * @return self
56 */
57 BeanAttributesConfigurator<T> addType(TypeLiteral<?> typeLiteral);
58
59 /**
60 *
61 * Add types to the bean types
62 *
63 * @param types types to add
64 * @return self
65 */
66 BeanAttributesConfigurator<T> addTypes(Type... types);
67
68 /**
69 *
70 * Add types to the bean types
71 *
72 * @param types types to add
73 * @return self
74 */
75 BeanAttributesConfigurator<T> addTypes(Set<Type> types);
76
77 /**
78 * Adds an unrestricted set of bean types for the given type as if it represented a bean class of a managed bean.
79 * Illegal bean types are omitted.
80 *
81 * @param type to build the closure from
82 * @return self
83 */
84 BeanAttributesConfigurator<T> addTransitiveTypeClosure(Type type);
85
86 /**
87 *
88 * Replace bean types
89 *
90 * @param types the types of the configured bean
91 * @return self
92 */
93 BeanAttributesConfigurator<T> types(Type... types);
94
95 /**
96 *
97 * Replace bean types
98 *
99 * @param types the types of the configured bean
100 * @return self
101 */
102 BeanAttributesConfigurator<T> types(Set<Type> types);
103
104 /**
105 *
106 * Replace Bean scope
107 *
108 * @param scope new scope for the configured bean
109 * @return self
110 */
111 BeanAttributesConfigurator<T> scope(Class<? extends Annotation> scope);
112
113 /**
114 *
115 * Add a qualifier to the configured bean
116 *
117 * @param qualifier qualifier to add
118 * @return self
119 */
120 BeanAttributesConfigurator<T> addQualifier(Annotation qualifier);
121
122 /**
123 *
124 * Add qualifiers to the bean.
125 *
126 * @param qualifiers qualifiers to add
127 * @return self
128 */
129 BeanAttributesConfigurator<T> addQualifiers(Annotation... qualifiers);
130
131 /**
132 *
133 * Add qualifiers to the bean.
134 *
135 * @param qualifiers qualifiers to add
136 * @return self
137 */
138 BeanAttributesConfigurator<T> addQualifiers(Set<Annotation> qualifiers);
139
140 /**
141 * Replace all qualifiers.
142 *
143 * @param qualifiers qualifiers for the build bean
144 * @return self
145 */
146 BeanAttributesConfigurator<T> qualifiers(Annotation... qualifiers);
147
148 /**
149 * Replace all qualifiers.
150 *
151 * @param qualifiers for the configured bean
152 * @return self
153 */
154 BeanAttributesConfigurator<T> qualifiers(Set<Annotation> qualifiers);
155
156 /**
157 *
158 * Add a stereotype to the configured bean
159 *
160 * @param stereotype stereotype to add
161 * @return self
162 */
163 BeanAttributesConfigurator<T> addStereotype(Class<? extends Annotation> stereotype);
164
165 /**
166 *
167 * Add stereotypes to the configured bean
168 *
169 * @param stereotypes stereotypes to add
170 * @return self
171 */
172 BeanAttributesConfigurator<T> addStereotypes(Set<Class<? extends Annotation>> stereotypes);
173
174 /**
175 *
176 * Replace stereotypes on the configured bean
177 *
178 * @param stereotypes for the configured bean
179 * @return self
180 */
181 BeanAttributesConfigurator<T> stereotypes(Set<Class<? extends Annotation>> stereotypes);
182
183 /**
184 *
185 * Set the name of the configured bean
186 *
187 * @param name name for the configured bean
188 * @return self
189 */
190 BeanAttributesConfigurator<T> name(String name);
191
192 /**
193 *
194 * Change the alternative status of the configured bean.
195 * By default the configured bean is not an alternative.
196 *
197 * @param value value for alternative property
198 * @return self
199 */
200 BeanAttributesConfigurator<T> alternative(boolean value);
201
202 }