| 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 |
BeanSpec |
field(String name) |
Map<String,BeanSpec> |
fields()
Returns a list of
BeanSpec for all fields including super class fields. |
List<BeanSpec> |
fields(org.osgl.Lang.Predicate<Field> filter)
Returns a list of
BeanSpec for all fields including super class fields. |
<T extends Annotation> |
getAnnotation(Class<T> annoClass) |
int |
getModifiers() |
boolean |
hasAnnotation() |
boolean |
hasAnnotation(Class<? extends Annotation> annoClass) |
int |
hashCode() |
boolean |
hasInjectDecorator()
Check if the bean spec has injector decorators.
|
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 |
isNotObject() |
boolean |
isObject() |
boolean |
isPrivate() |
boolean |
isProtected() |
boolean |
isPublic() |
boolean |
isStatic() |
boolean |
isTransient() |
String |
name() |
List<BeanSpec> |
nonStaticFields() |
static BeanSpec |
of(Class<?> clazz,
Injector injector) |
static BeanSpec |
of(Field field,
Injector injector) |
static BeanSpec |
of(Field field,
Injector injector,
Map<String,Class> typeParamLookup) |
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,
Injector injector,
int modifiers,
Map<String,Class> typeParamLookup) |
static BeanSpec |
of(Type type,
Annotation[] paramAnnotations,
Injector injector,
Map<String,Class> typeParamLookup) |
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,
Annotation[] paramAnnotations,
String name,
Injector injector,
int modifiers,
Map<String,Class> typeParamLookup) |
static BeanSpec |
of(Type type,
Annotation[] paramAnnotations,
String name,
Injector injector,
Map<String,Class> typeParamLookup) |
static BeanSpec |
of(Type type,
Injector injector) |
static BeanSpec |
of(Type type,
Injector injector,
Map<String,Class> typeParamLookup) |
BeanSpec |
parent() |
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. |
BeanSpec |
withoutName() |
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 boolean isArray()
isArray in interface org.osgl.util.BeanInfo<BeanSpec>public Annotation[] allAnnotations()
allAnnotations in interface org.osgl.util.BeanInfo<BeanSpec>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()
getModifiers in interface org.osgl.util.BeanInfo<BeanSpec>public boolean isTransient()
isTransient in interface org.osgl.util.BeanInfo<BeanSpec>public boolean isStatic()
isStatic in interface org.osgl.util.BeanInfo<BeanSpec>public boolean isPrivate()
isPrivate in interface org.osgl.util.BeanInfo<BeanSpec>public boolean isPublic()
isPublic in interface org.osgl.util.BeanInfo<BeanSpec>public boolean isProtected()
isProtected in interface org.osgl.util.BeanInfo<BeanSpec>public boolean isFinal()
isFinal in interface org.osgl.util.BeanInfo<BeanSpec>public boolean isInterface()
isInterface in interface org.osgl.util.BeanInfo<BeanSpec>public BeanSpec withoutName()
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
typeParams in interface org.osgl.util.BeanInfo<BeanSpec>public BeanSpec componentSpec()
public boolean isInstanceOf(Class c)
Return if the bean is instance of give class.
isInstanceOf in interface org.osgl.util.BeanInfo<BeanSpec>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.
isInstance in interface org.osgl.util.BeanInfo<BeanSpec>o - the object instancetrue if the object is an instance of type of this bean specpublic boolean hasInjectDecorator()
Check if the bean spec has injector decorators. The following annotations are considered to be inject decorators: * qualifiers * post construct annotation * scope annotation * Inject or any annotation has InjectTag presented
true if the beanSpec has inject decorators or false otherwisepublic Set<Annotation> qualifiers()
Returns all qualifier annotation of this bean spec.
public BeanSpec parent()
public boolean isObject()
public boolean isNotObject()
public Map<String,BeanSpec> fields()
Returns a list of BeanSpec for all fields including super class fields.
public List<BeanSpec> fields(org.osgl.Lang.Predicate<Field> filter)
Returns a list of BeanSpec for all fields including super class fields.
filter - a function to filter out fields that are not needed.public static BeanSpec of(Type type, Annotation[] paramAnnotations, Injector injector)
public static BeanSpec of(Type type, Annotation[] paramAnnotations, Injector injector, Map<String,Class> typeParamLookup)
public static BeanSpec of(Type type, Annotation[] paramAnnotations, Injector injector, int modifiers)
public static BeanSpec of(Type type, Annotation[] paramAnnotations, Injector injector, int modifiers, Map<String,Class> typeParamLookup)
public static BeanSpec of(Type type, Annotation[] paramAnnotations, String name, Injector injector)
public static BeanSpec of(Type type, Annotation[] paramAnnotations, String name, Injector injector, Map<String,Class> typeParamLookup)
public static BeanSpec of(Type type, Annotation[] paramAnnotations, String name, Injector injector, int modifiers)
public static BeanSpec of(Type type, Annotation[] paramAnnotations, String name, Injector injector, int modifiers, Map<String,Class> typeParamLookup)
Copyright © 2016–2018 OSGL (Open Source General Library). All rights reserved.