public class BeanSpec extends Object implements org.osgl.util.AnnotationAware
Specification of a bean to be injected.
| Modifier and Type | Method and Description |
|---|---|
Annotation[] |
allAnnotations() |
BeanSpec |
componentSpec() |
boolean |
equals(Object obj)
A bean spec equals to another bean spec if all of the following conditions are met: * the
type of the two bean spec equals to each other * the annotations of the two bean spec equals to each other |
<T extends Annotation> |
getAnnotation(Class<T> annoClass) |
int |
getModifiers() |
boolean |
hasAnnotation() |
boolean |
hasAnnotation(Class<? extends Annotation> annoClass) |
int |
hashCode() |
Injector |
injector() |
boolean |
isArray() |
boolean |
isFinal() |
boolean |
isInstance(Object o)
Check if a given object is instance of the type of this bean spec.
|
boolean |
isInstanceOf(Class c)
Return if the bean is instance of give class.
|
boolean |
isInterface() |
boolean |
isPrivate() |
boolean |
isProtected() |
boolean |
isPublic() |
boolean |
isStatic() |
boolean |
isTransient() |
String |
name() |
static BeanSpec |
of(Class<?> clazz,
Injector injector) |
static BeanSpec |
of(Field field,
Injector injector) |
static BeanSpec |
of(Type type,
Annotation[] paramAnnotations,
Injector injector) |
static BeanSpec |
of(Type type,
Annotation[] paramAnnotations,
Injector injector,
int modifiers) |
static BeanSpec |
of(Type type,
Annotation[] paramAnnotations,
String name,
Injector injector) |
static BeanSpec |
of(Type type,
Annotation[] paramAnnotations,
String name,
Injector injector,
int modifiers) |
static BeanSpec |
of(Type type,
Injector injector) |
Set<Annotation> |
qualifiers()
Returns all qualifier annotation of this bean spec.
|
Class |
rawType() |
static Class<?> |
rawTypeOf(Type type)
A utility method to return raw type (the class) of a given type.
|
Annotation[] |
taggedAnnotations(Class<? extends Annotation> tagType) |
BeanSpec |
toList()
Convert an array bean spec to a list bean spec.
|
String |
toString() |
Type |
type() |
List<Type> |
typeParams()
Returns a list of type parameters if the
type() of the bean is instance of ParameterizedType. |
public boolean equals(Object obj)
A bean spec equals to another bean spec if all of the following conditions are met: * the type of the two bean spec equals to each other * the annotations of the two bean spec equals to each other
Specifically, scope does not participate comparison because 1. Scope annotations shall be put onto type, or the factory method with Provides annotation, which is equivalent to Type. So it is safe to ignore scope annotation because one type cannot be annotated with different scope 2. If we count scope annotation in equality test, we will never be able to get the correct provider stem from the factory methods.
public Injector injector()
public Type type()
public Class rawType()
public String name()
public boolean isArray()
public Annotation[] allAnnotations()
public Annotation[] taggedAnnotations(Class<? extends Annotation> tagType)
public BeanSpec toList()
Convert an array bean spec to a list bean spec.
public <T extends Annotation> T getAnnotation(Class<T> annoClass)
getAnnotation in interface org.osgl.util.AnnotationAwarepublic boolean hasAnnotation(Class<? extends Annotation> annoClass)
hasAnnotation in interface org.osgl.util.AnnotationAwarepublic boolean hasAnnotation()
public int getModifiers()
public boolean isTransient()
public boolean isStatic()
public boolean isPrivate()
public boolean isPublic()
public boolean isProtected()
public boolean isFinal()
public boolean isInterface()
public List<Type> typeParams()
Returns a list of type parameters if the type() of the bean is instance of ParameterizedType.
For example the bean spec of a field declared as
private Map<String, Integer> scores;
The typeParams() method will return a list of String and Integer
public BeanSpec componentSpec()
public boolean isInstanceOf(Class c)
Return if the bean is instance of give class.
c - the classtrue if the underline bean is an instance of cpublic boolean isInstance(Object o)
Check if a given object is instance of the type of this bean spec.
o - the object instancetrue if the object is an instance of type of this bean specpublic Set<Annotation> qualifiers()
Returns all qualifier annotation of this bean spec.
public static BeanSpec of(Type type, Annotation[] paramAnnotations, Injector injector)
public static BeanSpec of(Type type, Annotation[] paramAnnotations, Injector injector, int modifiers)
public static BeanSpec of(Type type, Annotation[] paramAnnotations, String name, Injector injector)
public static BeanSpec of(Type type, Annotation[] paramAnnotations, String name, Injector injector, int modifiers)
Copyright © 2016–2018 OSGL (Open Source General Library). All rights reserved.