[jgentle] r69 commited - increase more and more performance :)

2 views
Skip to first unread message

codesite...@google.com

unread,
Jul 22, 2009, 12:09:06 AM7/22/09
to jgentl...@googlegroups.com
Revision: 69
Author: Skydunkpro
Date: Tue Jul 21 21:08:46 2009
Log: increase more and more performance :)
http://code.google.com/p/jgentle/source/detail?r=69

Added:
/trunk/JGentleProject/.settings/.jsdtscope
/trunk/JGentleProject/.settings/org.eclipse.wst.jsdt.ui.superType.container
/trunk/JGentleProject/.settings/org.eclipse.wst.jsdt.ui.superType.name
Modified:
/trunk/JGentleProject/.classpath
/trunk/JGentleProject/.project

/trunk/JGentleProject/src/org/jgentleframework/context/AbstractServiceManagement.java

/trunk/JGentleProject/src/org/jgentleframework/context/injecting/AbstractBeanCacher.java

/trunk/JGentleProject/src/org/jgentleframework/core/factory/InOutExecutor.java

/trunk/JGentleProject/src/org/jgentleframework/core/factory/support/AbstractProcesserChecker.java

/trunk/JGentleProject/src/org/jgentleframework/core/factory/support/CachedConstructor.java

/trunk/JGentleProject/src/org/jgentleframework/core/factory/support/CommonFactory.java

/trunk/JGentleProject/src/org/jgentleframework/core/factory/support/CoreProcessorImpl.java
/trunk/JGentleProject/src/org/jgentleframework/utils/Utils.java
/trunk/JGentleProject/src/org/samples/unittest/JGentleWiring.java

=======================================
--- /dev/null
+++ /trunk/JGentleProject/.settings/.jsdtscope Tue Jul 21 21:08:46 2009
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con"
path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con"
path="org.eclipse.wst.jsdt.launching.WebProject"/>
+ <classpathentry kind="con"
path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
+ <classpathentry kind="output" path=""/>
+</classpath>
=======================================
--- /dev/null
+++
/trunk/JGentleProject/.settings/org.eclipse.wst.jsdt.ui.superType.container
Tue Jul 21 21:08:46 2009
@@ -0,0 +1,1 @@
+org.eclipse.wst.jsdt.launching.baseBrowserLibrary
=======================================
--- /dev/null
+++ /trunk/JGentleProject/.settings/org.eclipse.wst.jsdt.ui.superType.name
Tue Jul 21 21:08:46 2009
@@ -0,0 +1,1 @@
+Window
=======================================
--- /trunk/JGentleProject/.classpath Tue May 26 07:58:49 2009
+++ /trunk/JGentleProject/.classpath Tue Jul 21 21:08:46 2009
@@ -14,6 +14,7 @@
<classpathentry kind="lib" path="lib/JavaEE5/jsf-impl.jar"/>
<classpathentry kind="lib" path="lib/JavaEE5/jstl-1.2.jar"/>
<classpathentry kind="lib"
path="lib/cglib-docs-2.1_3/cglib-nodep-2.1_3.jar"/>
- <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JRE6"/>
+ <classpathentry kind="lib" path="D:/DANH-MUC/FOR PROGRAMMER/Java
plus/jakarta-commons/commons-collections-3.2.1/commons-collections-3.2.1.jar"
sourcepath="D:/DANH-MUC/FOR PROGRAMMER/Java
plus/jakarta-commons/commons-collections-3.2.1/commons-collections-3.2.1-sources.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
=======================================
--- /trunk/JGentleProject/.project Thu Mar 12 07:27:15 2009
+++ /trunk/JGentleProject/.project Tue Jul 21 21:08:46 2009
@@ -1,10 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>JGentleFramework</name>
+ <name>JGentleProject</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
+ <buildCommand>
+ <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
@@ -16,6 +21,7 @@
<nature>com.tssap.selena.model.modeling_nature</nature>
<nature>com.borland.selena.uml20.uml20_nature</nature>
<nature>com.nomagic.magicdraw.eclipse.jdt.MagicDraw.nature</nature>
+ <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
<linkedResources>
<link>
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/context/AbstractServiceManagement.java
Tue Jul 21 19:08:49 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/context/AbstractServiceManagement.java
Tue Jul 21 21:08:46 2009
@@ -88,12 +88,6 @@
Class<?> targetClass = asc.targetClass;
Definition definition = asc.definition;
String mappingName = asc.ref;
- synchronized (this) {
- matcherCache = this.matcherCache == null ? new
ConcurrentHashMap<Definition, Matcher<Definition>>()
- : matcherCache;
- interceptorList = this.interceptorList == null ? new
HashMap<Matcher<Definition>, ArrayList<Object>>()
- : interceptorList;
- }
CoreInstantiationSelector coreSelector = new
CoreInstantiationSelectorImpl(
type, targetClass, asc.ref, definition);
ScopeInstance scope = null;
@@ -113,6 +107,12 @@
log.fatal("Could not instantiate bean instance!", e);
}
}
+ synchronized (this) {
+ matcherCache = this.matcherCache == null ? new
ConcurrentHashMap<Definition, Matcher<Definition>>()
+ : matcherCache;
+ interceptorList = this.interceptorList == null ? new
HashMap<Matcher<Definition>, ArrayList<Object>>()
+ : interceptorList;
+ }
/*
* find matcher in cache
*/
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/context/injecting/AbstractBeanCacher.java
Tue Jul 21 19:08:49 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/context/injecting/AbstractBeanCacher.java
Tue Jul 21 21:08:46 2009
@@ -31,12 +31,9 @@
import org.jgentleframework.context.injecting.scope.ScopeInstance;
import org.jgentleframework.context.services.ServiceHandler;
import org.jgentleframework.context.support.CoreInstantiationSelector;
-import org.jgentleframework.context.support.Selector;
import org.jgentleframework.core.AmbiguousException;
-import org.jgentleframework.core.factory.support.AbstractProcesserChecker;
import org.jgentleframework.core.factory.support.CachedConstructor;
import org.jgentleframework.core.factory.support.CommonFactory;
-import org.jgentleframework.core.factory.support.MetaDefObject;
import org.jgentleframework.core.reflection.metadata.Definition;
import org.jgentleframework.utils.ReflectUtils;
import org.jgentleframework.utils.Utils;
@@ -173,13 +170,13 @@
* @throws NoSuchMethodException
* the no such method exception
*/
- protected Object returnsCachingResult(Selector selector)
+ protected Object returnsCachingResult(
+ CoreInstantiationSelector targetSelector)
throws InvocationTargetException, IllegalArgumentException,
SecurityException, InstantiationException, IllegalAccessException,
NoSuchMethodException {

Object result = NULL_SHAREDOBJECT;
- CoreInstantiationSelector targetSelector = (CoreInstantiationSelector)
selector;
Definition definition = targetSelector.getDefinition();
// find in cache
if (cachingList.containsKey(definition)) {
@@ -188,14 +185,14 @@
if (hashcodeID == (definition.hashCode() ^ cons.hashCode())) {
result = cons.newInstance(targetSelector.getArgs());
// executes process after bean is created
- MetaDefObject metaObj = new MetaDefObject();
- AbstractProcesserChecker.findInOutNonRuntime(metaObj,
- definition);
- AbstractProcesserChecker.prepareSingletonBean(targetSelector,
- this, result);
+ // MetaDefObject metaObj = new MetaDefObject();
+ // AbstractProcesserChecker.findInOutNonRuntime(metaObj,
+ // definition);
+ // AbstractProcesserChecker.prepareSingletonBean(targetSelector,
+ // this, result);
CommonFactory.singleton().executeProcessAfterBeanCreated(
- targetSelector.getTargetClass(), metaObj, this, result,
- definition);
+ targetSelector.getTargetClass(),
+ cons.getMetaDefObject(), this, result, definition);
return result;
}
}
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/core/factory/InOutExecutor.java
Tue Jul 21 19:08:49 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/core/factory/InOutExecutor.java
Tue Jul 21 21:08:46 2009
@@ -22,6 +22,7 @@
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

@@ -77,34 +78,28 @@
Provider provider, Object target, Definition definition)
throws IllegalArgumentException, IllegalAccessException {

- Assertor.notNull(definition, "The given definition must not be null!");
- Assertor.notNull(provider, "The current provider must not be null!");
- Assertor.notNull(target, "The current target must not be null!");
Map<Field, Object> result = new HashMap<Field, Object>();
- synchronized (target) {
- if (fields != null) {
- ArrayList<Field> fieldList = new ArrayList<Field>();
- for (Field field : fields) {
- Definition defField = definition.getMemberDefinition(field);
- if (defField != null
- && defField.isAnnotationPresent(Inject.class)) {
- Inject inject = defField.getAnnotation(Inject.class);
- Object injected = InOutExecutor.getInjectedDependency(
- inject, field.getType(), provider);
- field.setAccessible(true);
- Object current = field.get(target);
- if (inject.alwaysInject() == false && current != null) {
- continue;
- }
- result.put(field, current);
- field.set(target, injected);
- if (!fieldList.contains(field))
- fieldList.add(field);
- field.setAccessible(false);
- }
- else
+ if (fields != null) {
+ List<Field> fieldList = new ArrayList<Field>();
+ for (Field field : fields) {
+ Definition defField = definition.getMemberDefinition(field);
+ if (defField != null
+ && defField.isAnnotationPresent(Inject.class)) {
+ Inject inject = defField.getAnnotation(Inject.class);
+ Object injected = InOutExecutor.getInjectedDependency(
+ inject, field.getType(), provider);
+ field.setAccessible(true);
+ Object current = field.get(target);
+ if (inject.alwaysInject() == false && current != null) {
continue;
- }
+ }
+ result.put(field, current);
+ field.set(target, injected);
+ if (!fieldList.contains(field))
+ fieldList.add(field);
+ }
+ else
+ continue;
}
}
return result;
@@ -130,34 +125,28 @@
Provider provider, Object target, Definition definition)
throws IllegalArgumentException, IllegalAccessException {

- Assertor.notNull(definition, "The given definition must not be null!");
- Assertor.notNull(provider, "The current provider must not be null!");
- Assertor.notNull(target, "The current target must not be null!");
- synchronized (target) {
- if (fields != null) {
- for (Field field : fields) {
- Object outjectObj = null;
- Definition defField = definition.getMemberDefinition(field);
- if (defField != null
- && defField.isAnnotationPresent(Outject.class)) {
- Outject outject = defField.getAnnotation(Outject.class);
- field.setAccessible(true);
- outjectObj = field.get(target);
- field.setAccessible(false);
- /*
- * Executes builder
- */
- if (ReflectUtils.isCast(Builder.class, target)) {
- Builder builder = (Builder) target;
- if (builder.getOutjectValue(field) != null)
- outjectObj = builder.getOutjectValue(field);
- }
- InOutExecutor.setOutjectedDependency(outject,
- outjectObj, provider, field.getClass());
- }
- else
- continue;
- }
+ if (fields != null) {
+ for (Field field : fields) {
+ Object outjectObj = null;
+ Definition defField = definition.getMemberDefinition(field);
+ if (defField != null
+ && defField.isAnnotationPresent(Outject.class)) {
+ Outject outject = defField.getAnnotation(Outject.class);
+ field.setAccessible(true);
+ outjectObj = field.get(target);
+ /*
+ * Executes builder
+ */
+ if (ReflectUtils.isCast(Builder.class, target)) {
+ Builder builder = (Builder) target;
+ if (builder.getOutjectValue(field) != null)
+ outjectObj = builder.getOutjectValue(field);
+ }
+ InOutExecutor.setOutjectedDependency(outject, outjectObj,
+ provider, field.getClass());
+ }
+ else
+ continue;
}
}
}
@@ -187,38 +176,30 @@
throws IllegalArgumentException, IllegalAccessException,
InvocationTargetException {

- Assertor.notNull(definition, "The given definition must not be null!");
- Assertor.notNull(provider, "The current provider must not be null!");
- Assertor.notNull(target, "The current target must not be null!");
- HashMap<Field, Object> result = new HashMap<Field, Object>();
- synchronized (target) {
- if (setters != null) {
- for (Method method : setters) {
- Definition defMethod = definition
- .getMemberDefinition(method);
- if (defMethod == null)
- continue;
- else {
- Object[] args = Utils.getInjectedParametersOf(method,
- defMethod, provider);
- method.setAccessible(true);
- // Find field corresponding to setter method.
- Field field = null;
- try {
- field = Utils.getFieldOfDefaultSetGetter(method,
- (Class<?>) definition.getKey());
- field.setAccessible(true);
- result.put(field, field.get(target));
- field.setAccessible(false);
- }
- catch (InvalidOperationException e) {
- throw new InOutDependencyException(e.getMessage());
- }
- catch (NoSuchFieldException e) {
- }
- method.invoke(target, args);
- method.setAccessible(false);
- }
+ Map<Field, Object> result = new HashMap<Field, Object>();
+ if (setters != null) {
+ for (Method method : setters) {
+ Definition defMethod = definition.getMemberDefinition(method);
+ if (defMethod == null)
+ continue;
+ else {
+ Object[] args = Utils.getInjectedParametersOf(method,
+ defMethod, provider);
+ method.setAccessible(true);
+ // Find field corresponding to setter method.
+ Field field = null;
+ try {
+ field = Utils.getFieldOfDefaultSetGetter(method,
+ (Class<?>) definition.getKey());
+ field.setAccessible(true);
+ result.put(field, field.get(target));
+ }
+ catch (InvalidOperationException e) {
+ throw new InOutDependencyException(e.getMessage());
+ }
+ catch (NoSuchFieldException e) {
+ }
+ method.invoke(target, args);
}
}
}
@@ -317,51 +298,43 @@
throws IllegalArgumentException, IllegalAccessException,
InvocationTargetException {

- Assertor.notNull(definition, "The given definition must not be null!");
- Assertor.notNull(provider, "The current provider must not be null!");
- Assertor.notNull(target, "The current target must not be null!");
- synchronized (target) {
- if (getters != null) {
- for (Method method : getters) {
- Definition defMethod = definition
- .getMemberDefinition(method);
- if (defMethod == null)
- continue;
- else {
- Class<?> returnType = method.getReturnType();
- Object[] args = Utils.getInjectedParametersOf(method,
- defMethod, provider);
- Object outjectObj = null;
- method.setAccessible(true);
- outjectObj = args.length == 0 ? method.invoke(target)
- : method.invoke(target, args);
- method.setAccessible(false);
- Outject outject = defMethod
- .getAnnotation(Outject.class);
- Field field = null;
- try {
- field = Utils.getFieldOfDefaultSetGetter(method,
- (Class<?>) definition.getKey());
- }
- catch (InvalidOperationException e) {
- throw new InOutDependencyException(e.getMessage());
- }
- catch (NoSuchFieldException e) {
- }
- /*
- * Executes builder
- */
- if (ReflectUtils.isCast(Builder.class, target)) {
- Builder builder = (Builder) target;
- if (builder.getOutjectValue(field) != null)
- outjectObj = builder.getOutjectValue(field);
- }
- // executes outjection
- Class<?> type = field != null ? field.getClass()
- : returnType;
- InOutExecutor.setOutjectedDependency(outject,
- outjectObj, provider, type);
- }
+ if (getters != null) {
+ for (Method method : getters) {
+ Definition defMethod = definition.getMemberDefinition(method);
+ if (defMethod == null)
+ continue;
+ else {
+ Class<?> returnType = method.getReturnType();
+ Object[] args = Utils.getInjectedParametersOf(method,
+ defMethod, provider);
+ Object outjectObj = null;
+ method.setAccessible(true);
+ outjectObj = args.length == 0 ? method.invoke(target)
+ : method.invoke(target, args);
+ Outject outject = defMethod.getAnnotation(Outject.class);
+ Field field = null;
+ try {
+ field = Utils.getFieldOfDefaultSetGetter(method,
+ (Class<?>) definition.getKey());
+ }
+ catch (InvalidOperationException e) {
+ throw new InOutDependencyException(e.getMessage());
+ }
+ catch (NoSuchFieldException e) {
+ }
+ /*
+ * Executes builder
+ */
+ if (ReflectUtils.isCast(Builder.class, target)) {
+ Builder builder = (Builder) target;
+ if (builder.getOutjectValue(field) != null)
+ outjectObj = builder.getOutjectValue(field);
+ }
+ // executes outjection
+ Class<?> type = field != null ? field.getClass()
+ : returnType;
+ InOutExecutor.setOutjectedDependency(outject, outjectObj,
+ provider, type);
}
}
}
@@ -428,7 +401,6 @@
}
}
else if (result != null && result != NullClass.class) {
-
if (!ReflectUtils.isCast(type, result)) {
System.out.println(result);
throw new InOutDependencyException(
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/core/factory/support/AbstractProcesserChecker.java
Tue Jul 21 19:08:49 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/core/factory/support/AbstractProcesserChecker.java
Tue Jul 21 21:08:46 2009
@@ -80,7 +80,7 @@
.toArray(new Field[injectedFields.size()]));
}
// find all outjected fields
- ArrayList<Field> outjectedFields = definition != null ? definition
+ List<Field> outjectedFields = definition != null ? definition
.getFieldsAnnotatedWith(Outject.class) : null;
if (outjectedFields != null) {
for (int i = 0; i < outjectedFields.size(); i++) {
@@ -96,7 +96,7 @@
.toArray(new Field[outjectedFields.size()]));
}
// find all injected methods (setter)
- ArrayList<Method> injectedMethods = definition != null ? definition
+ List<Method> injectedMethods = definition != null ? definition
.getMethodsAnnotatedWith(Inject.class) : null;
if (injectedMethods != null) {
for (int i = 0; i < injectedMethods.size(); i++) {
@@ -114,7 +114,7 @@
.toArray(new Method[injectedMethods.size()]));
}
// find all outjected methods (getter)
- ArrayList<Method> outjectedMethods = definition != null ? definition
+ List<Method> outjectedMethods = definition != null ? definition
.getMethodsAnnotatedWith(Outject.class) : null;
if (outjectedMethods != null) {
for (int i = 0; i < outjectedMethods.size(); i++) {
@@ -142,7 +142,7 @@
* @return the cached constructor
*/
abstract protected CachedConstructor createConstructionProxy(
- CoreInstantiationSelector selector);
+ CoreInstantiationSelector selector, MetaDefObject mdo);

/**
* Creates the construction proxy.
@@ -160,7 +160,7 @@
abstract protected CachedConstructor createConstructionProxy(
CoreInstantiationSelector selector, Class<?> interfaze,
net.sf.cglib.proxy.MethodInterceptor interceptor,
- final List<Method> methodList);
+ final List<Method> methodList, MetaDefObject mdo);

/**
* Creates the pure bean instance.
@@ -214,10 +214,10 @@
final List<Method> methodList = new ArrayList<Method>();
Enhancer.getMethods(targetClass, null, methodList);
cons = createConstructionProxy(selector, null, intercept,
- methodList);
+ methodList, metaObj);
}
else {
- cons = createConstructionProxy(selector);
+ cons = createConstructionProxy(selector, metaObj);
}
}
else {
@@ -231,7 +231,7 @@
List<Method> methodList = definition.getMethodsAnnotatedWith(
Inject.class, Outject.class);
cons = createConstructionProxy(selector, targetClass,
- intercept, methodList);
+ intercept, methodList, metaObj);
}
else if (targetClass.isInterface())
throw new InOutDependencyException(
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/core/factory/support/CachedConstructor.java
Fri May 15 05:16:41 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/core/factory/support/CachedConstructor.java
Tue Jul 21 21:08:46 2009
@@ -37,6 +37,18 @@
*/
Object newInstance(Object... arguments) throws InvocationTargetException;

+ /**
+ * Gets the meta def object.
+ */
+ MetaDefObject getMetaDefObject();
+
+ /**
+ * Sets the meta def object.
+ *
+ * @param mdo
+ */
+ void setMetaDefObject(MetaDefObject mdo);
+
/**
* Returns the hashcodeID of this {@link CachedConstructor}
*
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/core/factory/support/CommonFactory.java
Wed May 20 00:20:35 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/core/factory/support/CommonFactory.java
Tue Jul 21 21:08:46 2009
@@ -19,8 +19,11 @@

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
import java.util.List;

+import net.sf.cglib.reflect.FastClass;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jgentleframework.context.beans.DefinitionAware;
@@ -46,6 +49,7 @@
/** Singleton object. */
private static CommonFactory objInstance = new CommonFactory();

+ /** The log. */
private final Log log = LogFactory.getLog(getClass());

/**
@@ -92,18 +96,28 @@
if (ReflectUtils.isCast(Initializing.class, obj)) {
((Initializing) obj).activate();
}
- else if (def.isAnnotationPresentAtAnyMethods(InitializingMethod.class)) {
+ else {
List<Method> methods = def
.getMethodsAnnotatedWith(InitializingMethod.class);
- for (Method method : methods) {
- method.setAccessible(true);
- method.invoke(obj);
- method.setAccessible(false);
+ if (methods != null && methods.size() != 0) {
+ for (Method method : methods) {
+ if (Modifier.isPublic(method.getModifiers())) {
+ method.setAccessible(true);
+ method.invoke(obj);
+ }
+ else {
+ if (log.isErrorEnabled()) {
+ log
+ .error("The initializing method must be public !");
+ }
+ }
+ }
}
}
- else {
- ReflectUtils.invokeMethod(obj, "init", null, null, true, true);
- }
+ // else {
+ //
+ // ReflectUtils.invokeMethod(obj, "init", null, null, true, true);
+ // }
}

/**
@@ -220,30 +234,26 @@
SecurityException, InstantiationException, IllegalAccessException,
InvocationTargetException, NoSuchMethodException {

- /*
- * Xử lý thông tin các inject non-invocation
- */
if (!targetClass.isAnnotation()) {
+ /*
+ * Xử lý thông tin các inject non-invocation
+ */
InOutExecutor.executesInjectingAndFiltering(metaObj
.getInjectedFields(), metaObj.getSetters(), provider,
result, definition);
- }
- // embed
- embedProvider(provider, result);
- embedDefinition(definition, result);
- embedTargetClasses(new Class<?>[] { targetClass }, result);
- /*
- * Chỉ định thực thi init
- */
- if (!targetClass.isAnnotation()) {
+ // embed
+ embedProvider(provider, result);
+ embedDefinition(definition, result);
+ embedTargetClasses(new Class<?>[] { targetClass }, result);
+ // thực thi init
doInit(definition, result, targetClass);
- }
- /*
- * Xử lý thông tin các outject non-invocation
- */
- InOutExecutor.executesFieldOutjecting(metaObj.getOutjectedFields(),
- provider, result, definition);
- InOutExecutor.executesMethodOutjecting(metaObj.getGetters(), provider,
- result, definition);
+ /*
+ * Xử lý thông tin các outject non-invocation
+ */
+ InOutExecutor.executesFieldOutjecting(metaObj.getOutjectedFields(),
+ provider, result, definition);
+ InOutExecutor.executesMethodOutjecting(metaObj.getGetters(),
+ provider, result, definition);
+ }
}
}
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/core/factory/support/CoreProcessorImpl.java
Tue Jul 21 19:08:49 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/core/factory/support/CoreProcessorImpl.java
Tue Jul 21 21:08:46 2009
@@ -275,13 +275,14 @@
enhancer.setNamingPolicy(new JGentleNamingPolicy());
Class<?> proxied = enhancer.createClass();
Enhancer.registerStaticCallbacks(proxied, callbacks);
+ MetaDefObject metaObj = new MetaDefObject();
+ findInOutNonRuntime(metaObj, definition);
CachedConstructor cons = Utils.createConstructionProxy(
- definition, proxied, instSelector.getArgTypes());
+ definition, proxied, instSelector.getArgTypes(),
+ metaObj);
selector.getCachingList().put(definition, cons);
result = cons.newInstance(instSelector.getArgs());
// executes process after bean is created
- MetaDefObject metaObj = new MetaDefObject();
- findInOutNonRuntime(metaObj, definition);
prepareSingletonBean(selector, provider, result);
CommonFactory.singleton().executeProcessAfterBeanCreated(
targetClass, metaObj, provider, result, definition);
@@ -304,7 +305,7 @@
@SuppressWarnings("unchecked")
@Override
protected CachedConstructor createConstructionProxy(
- CoreInstantiationSelector selector) {
+ CoreInstantiationSelector selector, MetaDefObject mdo) {

Assertor.notNull(selector, "The selector ["
+ CoreInstantiationSelector.class.toString()
@@ -329,7 +330,7 @@
// Store callbacks.
Enhancer.registerStaticCallbacks(proxied, callbacks);
CachedConstructor cons = Utils.createConstructionProxy(selector
- .getDefinition(), proxied, selector.getArgTypes());
+ .getDefinition(), proxied, selector.getArgTypes(), mdo);
return cons;
}

@@ -345,7 +346,7 @@
protected CachedConstructor createConstructionProxy(
final CoreInstantiationSelector selector, Class<?> interfaze,
net.sf.cglib.proxy.MethodInterceptor interceptor,
- final List<Method> methodList) {
+ final List<Method> methodList, MetaDefObject mdo) {

Assertor.notNull(interceptor,
"The given interceptor must not be null !");
@@ -383,7 +384,7 @@
// Store callbacks.
Enhancer.registerStaticCallbacks(proxied, callbacks);
CachedConstructor cons = Utils.createConstructionProxy(selector
- .getDefinition(), proxied, selector.getArgTypes());
+ .getDefinition(), proxied, selector.getArgTypes(), mdo);
return cons;
}
}
=======================================
--- /trunk/JGentleProject/src/org/jgentleframework/utils/Utils.java Tue Jul
21 19:08:49 2009
+++ /trunk/JGentleProject/src/org/jgentleframework/utils/Utils.java Tue Jul
21 21:08:46 2009
@@ -45,6 +45,7 @@
import org.jgentleframework.core.factory.InOutDependencyException;
import org.jgentleframework.core.factory.InOutExecutor;
import org.jgentleframework.core.factory.support.CachedConstructor;
+import org.jgentleframework.core.factory.support.MetaDefObject;
import org.jgentleframework.core.intercept.JGentleFastClass;
import org.jgentleframework.core.intercept.support.CoreIdentification;
import org.jgentleframework.core.intercept.support.InterceptConditioner;
@@ -75,7 +76,7 @@
*/
public static CachedConstructor createConstructionProxy(
final Definition definition, Class<?> clazz,
- Class<?>[] parameterTypes) {
+ Class<?>[] parameterTypes, final MetaDefObject mdo) {

FastConstructor constructor = null;
try {
@@ -112,6 +113,8 @@
}
final FastConstructor fastConstructor = constructor;
return new CachedConstructor() {
+ MetaDefObject mdoInner = mdo;
+
@Override
public int hashcodeID() {

@@ -123,6 +126,18 @@

return fastConstructor.newInstance(arguments);
}
+
+ @Override
+ public MetaDefObject getMetaDefObject() {
+
+ return this.mdoInner;
+ }
+
+ @Override
+ public void setMetaDefObject(MetaDefObject mdo) {
+
+ this.mdoInner = mdo;
+ }
};
}

=======================================
--- /trunk/JGentleProject/src/org/samples/unittest/JGentleWiring.java Fri
Jun 19 09:56:17 2009
+++ /trunk/JGentleProject/src/org/samples/unittest/JGentleWiring.java Tue
Jul 21 21:08:46 2009
@@ -55,7 +55,7 @@
/**
* Rigourous Test :-)
*/
- public void testSingtonLoopInner() {
+ public void testSingtonLoop0() {

Provider provider = JGentle.buildProvider(Config.class);
A2 a = (A2) provider.getBean(A2.class);
Reply all
Reply to author
Forward
0 new messages