| 1 |
/* |
| 2 |
* Copyright (c) 2021 Red Hat and others |
| 3 |
* |
| 4 |
* This program and the accompanying materials are made available under the |
| 5 |
* Apache Software License 2.0 which is available at: |
| 6 |
* https://www.apache.org/licenses/LICENSE-2.0. |
| 7 |
* |
| 8 |
* SPDX-License-Identifier: Apache-2.0 |
| 9 |
*/ |
| 10 |
|
| 11 |
package jakarta.enterprise.inject.build.compatible.spi; |
| 12 |
|
| 13 |
import jakarta.enterprise.lang.model.declarations.ClassInfo; |
| 14 |
|
| 15 |
/** |
| 16 |
* A scope of a bean. Scope type is an {@linkplain #annotation() annotation}, meta-annotated |
| 17 |
* {@link jakarta.inject.Scope @Scope} or {@link jakarta.enterprise.context.NormalScope @NormalScope}. |
| 18 |
* Lifecycle of beans with given scope is determined by a {@linkplain jakarta.enterprise.context.spi.Context context}. |
| 19 |
* |
| 20 |
* @since 4.0 |
| 21 |
*/ |
| 22 |
public interface ScopeInfo { |
| 23 |
/** |
| 24 |
* Returns the declaration of this scope annotation. |
| 25 |
* |
| 26 |
* @return declaration of this scope annotation, never {@code null} |
| 27 |
*/ |
| 28 |
ClassInfo annotation(); |
| 29 |
|
| 30 |
/** |
| 31 |
* Binary name of this scope annotation, as defined by <cite>The Java™ Language Specification</cite>; |
| 32 |
* in other words, the scope annotation name as returned by {@link Class#getName()}. |
| 33 |
* Equivalent to {@code annotation().name()}. |
| 34 |
* |
| 35 |
* @return binary name of this scope annotation, never {@code null} |
| 36 |
*/ |
| 37 |
default String name() { |
| 38 |
return annotation().name(); |
| 39 |
} |
| 40 |
|
| 41 |
/** |
| 42 |
* Returns whether this scope type is normal. In other words, returns whether |
| 43 |
* this scope annotation is meta-annotated {@code @NormalScope}. |
| 44 |
* |
| 45 |
* @return whether this scope type is normal |
| 46 |
*/ |
| 47 |
boolean isNormal(); |
| 48 |
} |