public class AopFactory extends Object
AopFactory class.
| 限定符和类型 | 字段和说明 |
|---|---|
protected boolean |
enhance |
protected int |
injectDepth |
protected HashMap<Class<?>,Class<?>> |
mapping |
protected static int |
MAX_INJECT_DEPTH
Constant
MAX_INJECT_DEPTH=7 |
protected boolean |
singleton |
protected ConcurrentHashMap<Class<?>,Object> |
singletonCache |
| 构造器和说明 |
|---|
AopFactory() |
| 限定符和类型 | 方法和说明 |
|---|---|
<T> AopFactory |
addMapping(Class<T> from,
Class<? extends T> to)
addMapping.
|
<T> AopFactory |
addMapping(Class<T> from,
String to)
addMapping.
|
AopFactory |
addSingletonObject(Object singletonObject)
addSingletonObject.
|
protected Object |
createObject(Class<?> targetClass)
createObject.
|
protected <T> T |
doGet(Class<T> targetClass,
int injectDepth)
doGet.
|
protected void |
doInject(Class<?> targetClass,
Object targetObject,
int injectDepth)
doInject.
|
<T> T |
get(Class<T> targetClass)
get.
|
<T> T |
get(Class<T> targetClass,
int injectDepth)
get.
|
int |
getInjectDepth()
Getter for the field
injectDepth. |
Class<?> |
getMappingClass(Class<?> from)
getMappingClass.
|
protected Class<?> |
getUsefulClass(Class<?> clazz)
getUsefulClass.
|
<T> T |
inject(Class<T> targetClass,
T targetObject)
inject.
|
<T> T |
inject(Class<T> targetClass,
T targetObject,
int injectDepth)
inject.
|
<T> T |
inject(T targetObject)
inject.
|
<T> T |
inject(T targetObject,
int injectDepth)
inject.
|
boolean |
isSingleton()
isSingleton.
|
AopFactory |
setEnhance(boolean enhance)
已过时。
|
AopFactory |
setInjectDepth(int injectDepth)
Setter for the field
injectDepth. |
AopFactory |
setSingleton(boolean singleton)
Setter for the field
singleton. |
protected ConcurrentHashMap<Class<?>,Object> singletonCache
protected static int MAX_INJECT_DEPTH
MAX_INJECT_DEPTH=7protected boolean singleton
protected boolean enhance
protected int injectDepth
public <T> T get(Class<T> targetClass)
get.
T - a T object.targetClass - a Class object.public <T> T get(Class<T> targetClass, int injectDepth)
get.
T - a T object.targetClass - a Class object.injectDepth - a int.protected <T> T doGet(Class<T> targetClass, int injectDepth) throws ReflectiveOperationException
doGet.
T - a T object.targetClass - a Class object.injectDepth - a int.ReflectiveOperationException - if any.public <T> T inject(T targetObject)
inject.
T - a T object.targetObject - a T object.public <T> T inject(T targetObject,
int injectDepth)
inject.
T - a T object.targetObject - a T object.injectDepth - a int.public <T> T inject(Class<T> targetClass, T targetObject)
inject.
T - a T object.targetClass - a Class object.targetObject - a T object.public <T> T inject(Class<T> targetClass, T targetObject, int injectDepth)
inject.
T - a T object.targetClass - a Class object.targetObject - a T object.injectDepth - a int.protected void doInject(Class<?> targetClass, Object targetObject, int injectDepth) throws ReflectiveOperationException
doInject.
targetClass - a Class object.targetObject - a Object object.injectDepth - a int.ReflectiveOperationException - if any.protected Object createObject(Class<?> targetClass) throws ReflectiveOperationException
createObject.
targetClass - a Class object.Object object.ReflectiveOperationException - if any.@Deprecated public AopFactory setEnhance(boolean enhance)
Setter for the field enhance.
enhance - a boolean.AopFactory object.public AopFactory setSingleton(boolean singleton)
Setter for the field singleton.
singleton - a boolean.AopFactory object.public boolean isSingleton()
isSingleton.
public AopFactory setInjectDepth(int injectDepth)
Setter for the field injectDepth.
injectDepth - a int.AopFactory object.public int getInjectDepth()
Getter for the field injectDepth.
public AopFactory addSingletonObject(Object singletonObject)
addSingletonObject.
singletonObject - a Object object.AopFactory object.public <T> AopFactory addMapping(Class<T> from, Class<? extends T> to)
addMapping.
T - a T object.from - a Class object.to - a Class object.AopFactory object.public <T> AopFactory addMapping(Class<T> from, String to)
addMapping.
T - a T object.from - a Class object.to - a String object.AopFactory object.Copyright © 2023. All rights reserved.