Commit b3e2c3577345c1851a0b45ef6370a88180d59988
1 parent
7fb88f37
Exists in
master
Adição de javadoc na classe br.gov.frameworkdemoiselle.util.Beans
Showing
1 changed file
with
46 additions
and
0 deletions
Show diff stats
impl/core/src/main/java/br/gov/frameworkdemoiselle/util/Beans.java
| @@ -52,6 +52,14 @@ import javax.enterprise.inject.spi.InjectionPoint; | @@ -52,6 +52,14 @@ import javax.enterprise.inject.spi.InjectionPoint; | ||
| 52 | 52 | ||
| 53 | import br.gov.frameworkdemoiselle.DemoiselleException; | 53 | import br.gov.frameworkdemoiselle.DemoiselleException; |
| 54 | 54 | ||
| 55 | +/** | ||
| 56 | + * <p> | ||
| 57 | + * Utilizes a {@link BeanManager}, obtained in the bootstrap process, to provide custom operations for obtaining contextual references for beans. | ||
| 58 | + * <p> | ||
| 59 | + * All its public methods are static. | ||
| 60 | + * | ||
| 61 | + * @author SERPRO | ||
| 62 | + */ | ||
| 55 | public final class Beans { | 63 | public final class Beans { |
| 56 | 64 | ||
| 57 | private static transient ResourceBundle bundle; | 65 | private static transient ResourceBundle bundle; |
| @@ -69,6 +77,20 @@ public final class Beans { | @@ -69,6 +77,20 @@ public final class Beans { | ||
| 69 | return manager; | 77 | return manager; |
| 70 | } | 78 | } |
| 71 | 79 | ||
| 80 | + /** | ||
| 81 | + * Obtains a injectble instance of a bean, which have the given required type and qualifiers, | ||
| 82 | + * and are available for injection in the point where this method was call. | ||
| 83 | + * | ||
| 84 | + * @param beanClass | ||
| 85 | + * the beanClass which instace is requested to be obtained. | ||
| 86 | + * @param qualifiers | ||
| 87 | + * a set of qualifiers with any quantity of elements (zero including). | ||
| 88 | + * @return Type | ||
| 89 | + * a instace of the injected beanClass. | ||
| 90 | + * @throws DemoiselleException | ||
| 91 | + * if no bean are avaliable to be injected for the given Class and qualifiers. | ||
| 92 | + * | ||
| 93 | + */ | ||
| 72 | public static <T> T getReference(final Class<T> beanClass, Annotation... qualifiers) { | 94 | public static <T> T getReference(final Class<T> beanClass, Annotation... qualifiers) { |
| 73 | T instance; | 95 | T instance; |
| 74 | 96 | ||
| @@ -91,6 +113,18 @@ public final class Beans { | @@ -91,6 +113,18 @@ public final class Beans { | ||
| 91 | return instance; | 113 | return instance; |
| 92 | } | 114 | } |
| 93 | 115 | ||
| 116 | + /** | ||
| 117 | + * Obtains a injectble instance of a bean, which have the given required type | ||
| 118 | + * and are available for injection in the point where this method was call. | ||
| 119 | + * | ||
| 120 | + * @param beanClass | ||
| 121 | + * the beanClass which instace is requested to be obtained. | ||
| 122 | + * @return Type | ||
| 123 | + * a instace of the injected beanClass. | ||
| 124 | + * @throws DemoiselleException | ||
| 125 | + * if no bean are avaliable to be injected for the given Class. | ||
| 126 | + * | ||
| 127 | + */ | ||
| 94 | public static <T> T getReference(final Class<T> beanClass) { | 128 | public static <T> T getReference(final Class<T> beanClass) { |
| 95 | T instance; | 129 | T instance; |
| 96 | 130 | ||
| @@ -105,6 +139,18 @@ public final class Beans { | @@ -105,6 +139,18 @@ public final class Beans { | ||
| 105 | return instance; | 139 | return instance; |
| 106 | } | 140 | } |
| 107 | 141 | ||
| 142 | + /** | ||
| 143 | + * Obtains a injectble instance of a bean, which have the given EL name | ||
| 144 | + * and are available for injection in the point where this method was call. | ||
| 145 | + * | ||
| 146 | + * @param beanName | ||
| 147 | + * the EL name for the requested bean. | ||
| 148 | + * @return Type | ||
| 149 | + * a instace of the injected beanClass. | ||
| 150 | + * @throws DemoiselleException | ||
| 151 | + * if no bean are avaliable to be injected for the given bean name. | ||
| 152 | + * | ||
| 153 | + */ | ||
| 108 | @SuppressWarnings("unchecked") | 154 | @SuppressWarnings("unchecked") |
| 109 | public static <T> T getReference(String beanName) { | 155 | public static <T> T getReference(String beanName) { |
| 110 | T instance; | 156 | T instance; |