1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 package javax.enterprise.inject.spi; 20 21 import java.lang.annotation.Annotation; 22 import java.lang.reflect.Type; 23 import java.util.Set; 24 25 import javax.enterprise.context.spi.Contextual; 26 27 /** 28 * Reprensts bean instances that are contextual 29 * and injectable by the container. 30 * 31 * @version $Rev$ $Date$ 32 * 33 * @param <T> bean representation type 34 */ 35 public interface Bean<T> extends Contextual<T> 36 { 37 38 /** 39 * Returns api types of a bean. 40 * 41 * @return api types of a bean 42 */ 43 public abstract Set<Type> getTypes(); 44 45 /** 46 * Returns qualifiers of a bean. 47 * 48 * @return qualifiers of a bean 49 */ 50 public abstract Set<Annotation> getQualifiers(); 51 52 53 /** 54 * Returns bean deployment type. 55 * 56 * @return bean's deployment type. 57 */ 58 public abstract Class<? extends Annotation> getDeploymentType(); 59 60 61 /** 62 * Returns scope of a bean. 63 * 64 * @return scope 65 */ 66 public abstract Class<? extends Annotation> getScope(); 67 68 /** 69 * Returns name of a bean. 70 * 71 * @return name of a bean 72 */ 73 public abstract String getName(); 74 75 /** 76 * Returns true if bean is capable of 77 * serializable, false otherwise. 78 * 79 * @return true if bean is serializable 80 */ 81 public abstract boolean isSerializable(); 82 83 /** 84 * If bean is nullable return true, false 85 * otherwise. 86 * 87 * <p> 88 * Nullable means that if producer 89 * bean api type is primitive, its nullable property 90 * will be false. 91 * </p> 92 * 93 * @return true if bean is nullable. 94 */ 95 public abstract boolean isNullable(); 96 97 /** 98 * Returns all injection points of this bean. 99 * 100 * @return injection points 101 */ 102 public abstract Set<InjectionPoint> getInjectionPoints(); 103 104 /** 105 * Returns class of bean. 106 * 107 * @return class of bean that it represents 108 */ 109 public abstract Class<?> getBeanClass(); 110 111 /** 112 * Returns bean stereotypes. 113 * 114 * @return bean stereotypes 115 */ 116 public Set<Class<? extends Annotation>> getStereotypes(); 117 118 /** 119 * Returns true if declares as policy 120 * 121 * @return true if declares as policy 122 */ 123 public boolean isAlternative(); 124 125 }