Revision: 72
Author: Skydunkpro
Date: Thu Jul 23 05:38:37 2009
Log: increase more performance, optimize code
http://code.google.com/p/jgentle/source/detail?r=72
Added:
/trunk/JGentleProject/src/org/jgentleframework/context/injecting/SingletonInstanceScopeName.java
Modified:
/trunk/JGentleProject/src/org/jgentleframework/context/AbstractInitLoading.java
/trunk/JGentleProject/src/org/jgentleframework/context/AbstractServiceManagement.java
/trunk/JGentleProject/src/org/jgentleframework/context/BeforeConfigure.java
/trunk/JGentleProject/src/org/jgentleframework/context/IAbstractServiceManagement.java
/trunk/JGentleProject/src/org/jgentleframework/context/ServiceProvider.java
/trunk/JGentleProject/src/org/jgentleframework/context/ServiceProviderImpl.java
/trunk/JGentleProject/src/org/jgentleframework/context/injecting/AbstractBeanCacher.java
/trunk/JGentleProject/src/org/jgentleframework/context/injecting/AbstractBeanFactory.java
/trunk/JGentleProject/src/org/jgentleframework/context/injecting/AppropriateScopeNameClass.java
/trunk/JGentleProject/src/org/jgentleframework/context/injecting/Provider.java
/trunk/JGentleProject/src/org/jgentleframework/context/injecting/autodetect/AutoLoadingDefinitionDetector.java
/trunk/JGentleProject/src/org/jgentleframework/context/injecting/autodetect/ExtensionPointsDetector.java
/trunk/JGentleProject/src/org/jgentleframework/context/injecting/autodetect/FirstDetector.java
/trunk/JGentleProject/src/org/jgentleframework/context/injecting/scope/ScopeController.java
/trunk/JGentleProject/src/org/jgentleframework/context/services/ServiceHandlerImpl.java
/trunk/JGentleProject/src/org/jgentleframework/context/support/InstantiationSelector.java
/trunk/JGentleProject/src/org/jgentleframework/context/support/InstantiationSelectorImpl.java
/trunk/JGentleProject/src/org/jgentleframework/core/factory/InOutExecutor.java
/trunk/JGentleProject/src/org/jgentleframework/core/handling/AnnotationRegister.java
/trunk/JGentleProject/src/org/jgentleframework/core/reflection/AbstractProgramUnit.java
/trunk/JGentleProject/src/org/jgentleframework/core/reflection/AbstractVisitorHandler.java
/trunk/JGentleProject/src/org/jgentleframework/utils/Assertor.java
=======================================
--- /dev/null
+++
/trunk/JGentleProject/src/org/jgentleframework/context/injecting/SingletonInstanceScopeName.java
Thu Jul 23 05:38:37 2009
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2007-2009 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Project: JGentleProject
+ */
+package org.jgentleframework.context.injecting;
+
+/**
+ * The Class SingletonInstanceScopeName.
+ *
+ * @author Quoc Chung - mailto: <a
+ * href="mailto:
skydu...@yahoo.com">
skydu...@yahoo.com</a>
+ * @date Jul 23, 2009
+ */
+public final class SingletonInstanceScopeName {
+ /** The scope name. */
+ public String scopeName;
+
+ /** The shared singleton. */
+ public Object sharedSingleton;
+
+ /**
+ * Instantiates a new singleton instance scope name.
+ *
+ * @param scopeName
+ * the scope name
+ * @param sharedSingleton
+ * the shared singleton
+ */
+ public SingletonInstanceScopeName(String scopeName, Object
sharedSingleton) {
+
+ this.scopeName = scopeName;
+ this.sharedSingleton = sharedSingleton;
+ }
+}
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/context/AbstractInitLoading.java
Tue Jul 21 19:08:49 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/context/AbstractInitLoading.java
Thu Jul 23 05:38:37 2009
@@ -19,6 +19,7 @@
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -63,12 +64,12 @@
.isCast(AbstractLoadingFactory.class, provider) ? provider
: null);
// query option list
- List<DefinitionPostProcessor> dppList = new
ArrayList<DefinitionPostProcessor>();
+ List<DefinitionPostProcessor> dppList = new
LinkedList<DefinitionPostProcessor>();
HashMap<Class, AnnotationBeanProcessor> abpHash = new HashMap<Class,
AnnotationBeanProcessor>();
- List<ObjectAttach<?>> oaList = new ArrayList<ObjectAttach<?>>();
- List<Class<?>> beanClassList = new ArrayList<Class<?>>();
- List<ObjectBindingConstant> obcList = new
ArrayList<ObjectBindingConstant>();
- List<ObjectConstant> ocList = new ArrayList<ObjectConstant>();
+ List<ObjectAttach<?>> oaList = new LinkedList<ObjectAttach<?>>();
+ List<Class<?>> beanClassList = new LinkedList<Class<?>>();
+ List<ObjectBindingConstant> obcList = new
LinkedList<ObjectBindingConstant>();
+ List<ObjectConstant> ocList = new LinkedList<ObjectConstant>();
for (Map<String, Object> optionsList : OLArray) {
/***************/
List<DefinitionPostProcessor> dpp =
(ArrayList<DefinitionPostProcessor>) optionsList
@@ -81,17 +82,17 @@
if (abp != null)
abpHash.putAll(abp);
/***************/
- List<ObjectAttach<?>> oa = (ArrayList<ObjectAttach<?>>) optionsList
+ List<ObjectAttach<?>> oa = (List<ObjectAttach<?>>) optionsList
.get(AbstractConfig.OBJECT_ATTACH_LIST);
if (oa != null)
oaList.addAll(oa);
/***************/
- List<Class<?>> bc = (ArrayList<Class<?>>) optionsList
+ List<Class<?>> bc = (List<Class<?>>) optionsList
.get(AbstractConfig.BEAN_CLASS_LIST);
if (bc != null)
beanClassList.addAll(bc);
/***************/
- List<ObjectBindingConstant> obc = (ArrayList<ObjectBindingConstant>)
optionsList
+ List<ObjectBindingConstant> obc = (List<ObjectBindingConstant>)
optionsList
.get(AbstractConfig.OBJECT_BINDING_CONSTANT_LIST);
if (obc != null)
obcList.addAll(obc);
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/context/AbstractServiceManagement.java
Thu Jul 23 01:43:47 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/context/AbstractServiceManagement.java
Thu Jul 23 05:38:37 2009
@@ -51,7 +51,7 @@
* {@link #getBeanInstance(Class, Class, String, Definition)} method is
* overrided in order to customize the bean instantiation according as its
* configuration data. Moreover, this class provides some methods in order
to
- * manage customized {@link Interceptor interceptors}, matcher cache, ...
+ * manage customizing {@link Interceptor interceptors}, matcher cache, ...
*
* @author LE QUOC CHUNG - mailto: <a
* href="mailto:
skydu...@yahoo.com">
skydu...@yahoo.com</a>
@@ -266,7 +266,7 @@
*/
@Override
public Interceptor[] getInterceptorsFromMatcher(
- ArrayList<Matcher<Definition>> matchers) {
+ List<Matcher<Definition>> matchers) {
Assertor.notNull(matchers);
List<Interceptor> result = new LinkedList<Interceptor>();
@@ -403,8 +403,7 @@
}
}
else {
- ArrayList<Object> list = null;
- list = new ArrayList<Object>();
+ List<Object> list = new ArrayList<Object>();
list.add(interceptor);
this.interceptorList.put(matcher, list);
}
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/context/BeforeConfigure.java
Fri May 15 05:16:41 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/context/BeforeConfigure.java
Thu Jul 23 05:38:37 2009
@@ -40,11 +40,11 @@
* Thực thi tiền xử lý, cấu hình trước khi hàm cấu hình configure method
* được chỉ định trong {@link AbstractConfig} được invoked.
*
- * @param aoh
- * đối tượng <code>Annotation Object Handler</code> sẽ được chỉ
- * định trong {@link Provider} hoặc <code>service
context</code>.
+ * @param serviceHandler
+ * đối tượng <code>service handler</code> sẽ được chỉ định
trong
+ * {@link Provider provider} hoặc <code>service context</code>.
* <p>
- * @param defManager
+ * @param definitionManager
* đối tượng <code>Definition Manager</code> sẽ được chỉ định
* trong {@link Provider} hoặc <code>service context</code>.
Đối
* tượng này tương đương object được get ra từ
@@ -62,7 +62,8 @@
* đối tượng {@link List} chứa danh sách các object class
* configuration ( {@link AbstractConfig})
*/
- public void doProcessing(ServiceHandler aoh, DefinitionManager defManager,
+ public void doProcessing(ServiceHandler serviceHandler,
+ DefinitionManager definitionManager,
AnnotationRegister annoRegister,
List<Class<? extends Configurable>> configList);
}
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/context/IAbstractServiceManagement.java
Fri May 15 05:16:41 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/context/IAbstractServiceManagement.java
Thu Jul 23 05:38:37 2009
@@ -17,7 +17,6 @@
*/
package org.jgentleframework.context;
-import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -133,5 +132,5 @@
* @return the interceptors from matcher
*/
public Interceptor[] getInterceptorsFromMatcher(
- ArrayList<Matcher<Definition>> matchers);
-}
+ List<Matcher<Definition>> matchers);
+}
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/context/ServiceProvider.java
Fri May 15 05:16:41 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/context/ServiceProvider.java
Thu Jul 23 05:38:37 2009
@@ -18,7 +18,7 @@
package org.jgentleframework.context;
import java.util.Collection;
-import java.util.HashMap;
+import java.util.Map;
import org.jgentleframework.configure.Configurable;
import org.jgentleframework.context.injecting.Provider;
@@ -61,8 +61,8 @@
ComponentServiceContextType<T> csc);
/**
- * Removes the specified {@link ComponentServiceContextType}
corressponding
- * to the given class type.
+ * Removes the specified {@link ComponentServiceContextType} bound to the
+ * given class type.
*
* @param clazzType
* the given class type
@@ -89,5 +89,5 @@
* Returns the Map of all current {@link ComponentServiceContextType}
* instances of this {@link ServiceProvider}
*/
- public HashMap<Class<?>, ComponentServiceContextType<Configurable>>
getCSCList();
-}
+ public Map<Class<?>, ComponentServiceContextType<Configurable>>
getCSCList();
+}
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/context/ServiceProviderImpl.java
Fri May 15 05:16:41 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/context/ServiceProviderImpl.java
Thu Jul 23 05:38:37 2009
@@ -60,7 +60,7 @@
* This {@link HashMap} holds all installed
* {@link ComponentServiceContextType} in this ServiceProvider.
*/
- private HashMap<Class<?>, ComponentServiceContextType<Configurable>>
CSCList = new HashMap<Class<?>,
ComponentServiceContextType<Configurable>>();
+ private Map<Class<?>, ComponentServiceContextType<Configurable>> CSCList
= new HashMap<Class<?>, ComponentServiceContextType<Configurable>>();
/*
* (non-Javadoc)
@@ -110,7 +110,7 @@
* @see org.jgentleframework.context.ServiceProvider#getCSCList()
*/
@Override
- public HashMap<Class<?>, ComponentServiceContextType<Configurable>>
getCSCList() {
+ public Map<Class<?>, ComponentServiceContextType<Configurable>>
getCSCList() {
return CSCList;
}
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/context/injecting/AbstractBeanCacher.java
Thu Jul 23 01:43:47 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/context/injecting/AbstractBeanCacher.java
Thu Jul 23 05:38:37 2009
@@ -68,7 +68,7 @@
protected final Object NULL_SHAREDOBJECT = new Object();
/** The root scope name. */
- protected Map<Object, String> rootScopeName = new HashMap<Object,
String>();
+ protected Map<Object, SingletonInstanceScopeName> rootScopeName = new
HashMap<Object, SingletonInstanceScopeName>();
/** The {@link ScopeController}. */
protected ScopeController scopeController = new ScopeController();
@@ -136,7 +136,8 @@
ref = REF.REF_CONSTANT + instanceName;
root = str;
scopeName = Utils.createScopeName(instanceName);
- this.rootScopeName.put(root, scopeName);
+ this.rootScopeName.put(root, new SingletonInstanceScopeName(
+ scopeName, NULL_SHAREDOBJECT));
}
}
ScopeInstance scope = null;
@@ -145,7 +146,8 @@
}
// If is Singleton scope
if ((scope != null && scope.equals(Scope.SINGLETON))) {
- this.rootScopeName.put(root, scopeName);
+ this.rootScopeName.put(root, new SingletonInstanceScopeName(
+ scopeName, NULL_SHAREDOBJECT));
}
return new AppropriateScopeNameClass(clazz, targetClass, definition,
ref, scopeName, mappingName);
@@ -154,8 +156,8 @@
/**
* Returns caching result.
*
- * @param selector
- * the selector
+ * @param targetSelector
+ * the target selector
* @return the object
* @throws InvocationTargetException
* the invocation target exception
@@ -179,8 +181,8 @@
Object result = NULL_SHAREDOBJECT;
Definition definition = targetSelector.getDefinition();
// find in cache
- if (cachingList.containsKey(definition)) {
- CachedConstructor cons = cachingList.get(definition);
+ CachedConstructor cons = cachingList.get(definition);
+ if (cons != null) {
int hashcodeID = cons.hashcodeID();
if (hashcodeID == (definition.hashCode() ^ cons.hashCode())) {
result = cons.newInstance(targetSelector.getArgs());
@@ -206,11 +208,21 @@
* the scope name
* @return the object
*/
- protected Object returnSharedObject(String scopeName) {
-
- if (mapDirectList.containsKey(scopeName)) {
- return mapDirectList.get(scopeName);
- }
- return NULL_SHAREDOBJECT;
+ protected Object returnSharedObject(SingletonInstanceScopeName sisn) {
+
+ Object instance = NULL_SHAREDOBJECT;
+ if (sisn != null) {
+ String scopeName = sisn.scopeName;
+ instance = sisn.sharedSingleton;
+ if (instance == NULL_SHAREDOBJECT) {
+ synchronized (scopeName) {
+ if (mapDirectList.containsKey(scopeName)) {
+ instance = mapDirectList.get(scopeName);
+ sisn.sharedSingleton = instance;
+ }
+ }
+ }
+ }
+ return instance;
}
}
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/context/injecting/AbstractBeanFactory.java
Thu Jul 23 01:43:47 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/context/injecting/AbstractBeanFactory.java
Thu Jul 23 05:38:37 2009
@@ -74,7 +74,7 @@
* @see org.jgentleframework.context.injecting.Provider#getRootScopeName()
*/
@Override
- public Map<Object, String> getRootScopeName() {
+ public Map<Object, SingletonInstanceScopeName> getRootScopeName() {
return rootScopeName;
}
@@ -321,6 +321,8 @@
String mappingName, Definition definition) {
Assertor.notNull(type);
+ Assertor.notNull(targetClass);
+ Assertor.notNull(definition);
CoreInstantiationSelector coreSelector = new
CoreInstantiationSelectorImpl(
type, targetClass, mappingName, null, null, definition);
coreSelector.setCachingList(cachingList);
@@ -348,14 +350,14 @@
protected Object getBeanInstance(AppropriateScopeNameClass asc) {
Object result = null;
- CoreInstantiationSelector coreSelector = new
CoreInstantiationSelectorImpl(
- asc.clazz, asc.targetClass, asc.mappingName, null, null,
- asc.definition);
- coreSelector.setCachingList(cachingList);
ScopeInstance scope = null;
synchronized (scopeList) {
scope = scopeList.get(asc.scopeName);
}
+ CoreInstantiationSelector coreSelector = new
CoreInstantiationSelectorImpl(
+ asc.clazz, asc.targetClass, asc.mappingName, null, null,
+ asc.definition);
+ coreSelector.setCachingList(cachingList);
// If not Singleton scope
try {
if (scope != null && !scope.equals(Scope.SINGLETON)) {
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/context/injecting/AppropriateScopeNameClass.java
Tue Jul 21 19:08:49 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/context/injecting/AppropriateScopeNameClass.java
Thu Jul 23 05:38:37 2009
@@ -27,23 +27,28 @@
* @date Jul 17, 2009
*/
public class AppropriateScopeNameClass {
-
/**
* Instantiates a new appropriate scope name class.
*/
public AppropriateScopeNameClass() {
-
- }
+ }
+
/**
* Instantiates a new appropriate scope name class.
*
- * @param clazz the clazz
- * @param targetClass the target class
- * @param defininition the defininition
- * @param ref the ref
- * @param scopeName the scope name
- * @param mappingName the mapping name
+ * @param clazz
+ * the clazz
+ * @param targetClass
+ * the target class
+ * @param defininition
+ * the defininition
+ * @param ref
+ * the ref
+ * @param scopeName
+ * the scope name
+ * @param mappingName
+ * the mapping name
*/
public AppropriateScopeNameClass(Class<?> clazz, Class<?> targetClass,
Definition defininition, String ref, String scopeName,
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/context/injecting/Provider.java
Thu Jul 23 01:43:47 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/context/injecting/Provider.java
Thu Jul 23 05:38:37 2009
@@ -65,7 +65,7 @@
*
* @return the singletonScopeName
*/
- public Map<Object, String> getRootScopeName();
+ public Map<Object, SingletonInstanceScopeName> getRootScopeName();
/**
* Returns an instance bound to the given {@link Definition}
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/context/injecting/autodetect/AutoLoadingDefinitionDetector.java
Sun Jun 28 00:49:21 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/context/injecting/autodetect/AutoLoadingDefinitionDetector.java
Thu Jul 23 05:38:37 2009
@@ -68,18 +68,18 @@
@Override
public void handling(List<Map<String, Object>> OLArray) {
- ArrayList<Class<?>> list = new ArrayList<Class<?>>();
+ List<Class<?>> list = new ArrayList<Class<?>>();
for (Map<String, Object> optionsList : OLArray) {
/*
* Lấy ra danh sách các đối tượng cất trữ thông tin cấu hình.
*/
- ArrayList<ObjectAttach<?>> othList = (ArrayList<ObjectAttach<?>>)
optionsList
+ List<ObjectAttach<?>> othList = (List<ObjectAttach<?>>) optionsList
.get(AbstractConfig.OBJECT_ATTACH_LIST);
- ArrayList<ObjectConstant> ocstList = (ArrayList<ObjectConstant>)
optionsList
+ List<ObjectConstant> ocstList = (List<ObjectConstant>) optionsList
.get(AbstractConfig.OBJECT_CONSTANT_LIST);
- ArrayList<Class<?>> bclist = (ArrayList<Class<?>>) optionsList
+ List<Class<?>> bclist = (List<Class<?>>) optionsList
.get(AbstractConfig.BEAN_CLASS_LIST);
- ArrayList<ObjectBindingConstant> obcList =
(ArrayList<ObjectBindingConstant>) optionsList
+ List<ObjectBindingConstant> obcList = (List<ObjectBindingConstant>)
optionsList
.get(AbstractConfig.OBJECT_BINDING_CONSTANT_LIST);
/*
* Truy vấn thông tin các object class có chỉ định
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/context/injecting/autodetect/ExtensionPointsDetector.java
Fri May 15 05:16:41 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/context/injecting/autodetect/ExtensionPointsDetector.java
Thu Jul 23 05:38:37 2009
@@ -18,6 +18,8 @@
package org.jgentleframework.context.injecting.autodetect;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -311,12 +313,13 @@
@Override
public void handling(List<Map<String, Object>> OLArray) {
- ArrayList<ObjectBindingConstant> obcList = new
ArrayList<ObjectBindingConstant>();
- ArrayList<ObjectAttach<?>> objectAttachList = new
ArrayList<ObjectAttach<?>>();
- ArrayList<Class<?>> beanClassList = new ArrayList<Class<?>>();
+ List<ObjectBindingConstant> obcList = new
LinkedList<ObjectBindingConstant>();
+ List<ObjectAttach<?>> objectAttachList = new
LinkedList<ObjectAttach<?>>();
+ List<Class<?>> beanClassList = new LinkedList<Class<?>>();
for (Map<String, Object> optionsList : OLArray) {
- obcList.addAll((ArrayList<ObjectBindingConstant>) optionsList
- .get(AbstractConfig.OBJECT_BINDING_CONSTANT_LIST));
+ obcList
+ .addAll((Collection<? extends ObjectBindingConstant>) optionsList
+ .get(AbstractConfig.OBJECT_BINDING_CONSTANT_LIST));
objectAttachList.addAll((ArrayList<ObjectAttach<?>>) optionsList
.get(AbstractConfig.OBJECT_ATTACH_LIST));
beanClassList.addAll((ArrayList<Class<?>>) optionsList
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/context/injecting/autodetect/FirstDetector.java
Fri May 15 05:16:41 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/context/injecting/autodetect/FirstDetector.java
Thu Jul 23 05:38:37 2009
@@ -99,7 +99,7 @@
* @return returns an {@link ArrayList} of detector if it exists, if not,
* returns an empty {@link ArrayList}.
*/
- public ArrayList<Detector> getAllDetectors() {
+ public List<Detector> getAllDetectors() {
ArrayList<Detector> result = new ArrayList<Detector>();
Detector current = getNextDetector();
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/context/injecting/scope/ScopeController.java
Fri May 15 05:16:41 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/context/injecting/scope/ScopeController.java
Thu Jul 23 05:38:37 2009
@@ -18,6 +18,7 @@
package org.jgentleframework.context.injecting.scope;
import java.util.ArrayList;
+import java.util.List;
import org.jgentleframework.configure.enums.Scope;
@@ -32,7 +33,7 @@
* @see Scope
*/
public class ScopeController {
- ArrayList<ScopeImplementation> scopeImplementationList = null;
+ List<ScopeImplementation> scopeImplementationList = null;
/**
* Constructor
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/context/services/ServiceHandlerImpl.java
Fri May 15 05:16:41 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/context/services/ServiceHandlerImpl.java
Thu Jul 23 05:38:37 2009
@@ -24,11 +24,10 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.TooManyListenersException;
import org.jgentleframework.configure.annotation.AnnotationClass;
@@ -334,7 +333,7 @@
* AnnotationRegister#getAnnotationRegistered()
*/
@Override
- public ArrayList<Class<? extends Annotation>> getAnnotationRegistered() {
+ public List<Class<? extends Annotation>> getAnnotationRegistered() {
return this.annoRegister.getAnnotationRegistered();
}
@@ -490,7 +489,7 @@
* AnnotationRegister#getValidatorlist()
*/
@Override
- public HashMap<Class<? extends Annotation>, AnnotationValidator<? extends
Annotation>> getValidatorlist() {
+ public Map<Class<? extends Annotation>, AnnotationValidator<? extends
Annotation>> getValidatorlist() {
return this.annoRegister.getValidatorlist();
}
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/context/support/InstantiationSelector.java
Fri May 15 05:16:41 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/context/support/InstantiationSelector.java
Thu Jul 23 05:38:37 2009
@@ -17,7 +17,7 @@
*/
package org.jgentleframework.context.support;
-import java.util.HashMap;
+import java.util.Map;
import org.aopalliance.intercept.FieldInterceptor;
import org.aopalliance.intercept.Interceptor;
@@ -47,8 +47,8 @@
public Interceptor[] getInterceptors();
/**
- * Returns an array containing all {@link InstantiationInterceptor}s
- * present at.
+ * Returns an array containing all {@link InstantiationInterceptor}s
present
+ * at.
*/
public InstantiationInterceptor[] getInstantiationInterceptors();
@@ -65,14 +65,18 @@
public FieldInterceptor[] getFieldInterceptors();
/**
+ * Gets the map matcher interceptor.
+ *
* @return the mapMatcherInterceptor
*/
- public HashMap<Interceptor, Matcher<Definition>>
getMapMatcherInterceptor();
+ public Map<Interceptor, Matcher<Definition>> getMapMatcherInterceptor();
/**
+ * Sets the map matcher interceptor.
+ *
* @param mapMatcherInterceptor
* the mapMatcherInterceptor to set
*/
public void setMapMatcherInterceptor(
- HashMap<Interceptor, Matcher<Definition>> mapMatcherInterceptor);
-}
+ Map<Interceptor, Matcher<Definition>> mapMatcherInterceptor);
+}
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/context/support/InstantiationSelectorImpl.java
Fri May 15 05:16:41 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/context/support/InstantiationSelectorImpl.java
Thu Jul 23 05:38:37 2009
@@ -20,6 +20,7 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.aopalliance.intercept.FieldInterceptor;
import org.aopalliance.intercept.Interceptor;
@@ -38,8 +39,8 @@
* @date Mar 17, 2008
* @see InstantiationSelector
*/
-public class InstantiationSelectorImpl extends
CoreInstantiationSelectorImpl implements
- InstantiationSelector {
+public class InstantiationSelectorImpl extends
CoreInstantiationSelectorImpl
+ implements InstantiationSelector {
/**
* The Constructor.
*
@@ -74,7 +75,7 @@
*/
public InstantiationSelectorImpl(Class<?> type, Class<?> targetClass,
String mappingName, Definition definition,
- HashMap<Interceptor, Matcher<Definition>> mapMatcherInterceptor) {
+ Map<Interceptor, Matcher<Definition>> mapMatcherInterceptor) {
super(type, targetClass, mappingName, definition);
this.mapMatcherInterceptor = mapMatcherInterceptor;
@@ -108,12 +109,13 @@
}
/** The map matcher interceptor. */
- HashMap<Interceptor, Matcher<Definition>> mapMatcherInterceptor = null;
+ Map<Interceptor, Matcher<Definition>> mapMatcherInterceptor = null;
/*
* (non-Javadoc)
- *
- * @see
org.jgentleframework.context.support.InstantiationSelector#getInterceptors()
+ * @see
+ *
org.jgentleframework.context.support.InstantiationSelector#getInterceptors
+ * ()
*/
@Override
public Interceptor[] getInterceptors() {
@@ -126,8 +128,8 @@
/*
* (non-Javadoc)
- *
- * @see
org.jgentleframework.context.support.InstantiationSelector#getInstantiationInterceptors()
+ * @seeorg.jgentleframework.context.support.InstantiationSelector#
+ * getInstantiationInterceptors()
*/
@Override
public InstantiationInterceptor[] getInstantiationInterceptors() {
@@ -146,8 +148,8 @@
/*
* (non-Javadoc)
- *
- * @see
org.jgentleframework.context.support.InstantiationSelector#getMethodInterceptors()
+ * @seeorg.jgentleframework.context.support.InstantiationSelector#
+ * getMethodInterceptors()
*/
@Override
public MethodInterceptor[] getMethodInterceptors() {
@@ -166,8 +168,8 @@
/*
* (non-Javadoc)
- *
- * @see
org.jgentleframework.context.support.InstantiationSelector#getFieldInterceptors()
+ * @seeorg.jgentleframework.context.support.InstantiationSelector#
+ * getFieldInterceptors()
*/
@Override
public FieldInterceptor[] getFieldInterceptors() {
@@ -186,23 +188,23 @@
/*
* (non-Javadoc)
- *
- * @see
org.jgentleframework.context.support.InstantiationSelector#getMapMatcherInterceptor()
+ * @seeorg.jgentleframework.context.support.InstantiationSelector#
+ * getMapMatcherInterceptor()
*/
@Override
- public HashMap<Interceptor, Matcher<Definition>>
getMapMatcherInterceptor() {
+ public Map<Interceptor, Matcher<Definition>> getMapMatcherInterceptor() {
return mapMatcherInterceptor;
}
/*
* (non-Javadoc)
- *
- * @see
org.jgentleframework.context.support.InstantiationSelector#setMapMatcherInterceptor(java.util.HashMap)
+ * @seeorg.jgentleframework.context.support.InstantiationSelector#
+ * setMapMatcherInterceptor(java.util.Map)
*/
@Override
public void setMapMatcherInterceptor(
- HashMap<Interceptor, Matcher<Definition>> mapMatcherInterceptor) {
+ Map<Interceptor, Matcher<Definition>> mapMatcherInterceptor) {
Assertor.notNull(mapMatcherInterceptor);
this.mapMatcherInterceptor = mapMatcherInterceptor;
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/core/factory/InOutExecutor.java
Tue Jul 21 21:08:46 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/core/factory/InOutExecutor.java
Thu Jul 23 05:38:37 2009
@@ -259,7 +259,7 @@
* @throws IllegalArgumentException
* the illegal argument exception
*/
- public static void executesDisinjection(HashMap<Field, Object> map,
+ public static void executesDisinjection(Map<Field, Object> map,
Object target) throws IllegalArgumentException,
IllegalAccessException {
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/core/handling/AnnotationRegister.java
Fri May 15 05:16:41 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/core/handling/AnnotationRegister.java
Thu Jul 23 05:38:37 2009
@@ -18,10 +18,9 @@
package org.jgentleframework.core.handling;
import java.lang.annotation.Annotation;
-import java.util.ArrayList;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import org.jgentleframework.core.provider.AnnotationValidator;
@@ -35,16 +34,17 @@
*/
public interface AnnotationRegister {
/**
- * Adds an {@link AnnotationValidator} according to specified registered
- * annotation
+ * Adds an {@link AnnotationValidator annotation validator} according to
+ * specified registered annotation
* <p>
- * <b>Note:</b> if previous {@link AnnotationValidator} of annotation is
- * existed, it will be replaced by new {@link AnnotationValidator}
+ * <b>Note:</b> if previous {@link AnnotationValidator validator} of
+ * annotation is existed, it will be replaced by new
+ * {@link AnnotationValidator validator}.
*
* @param anno
- * đối tượng object class của annotation.
+ * the object class according to given annotation
* @param validator
- * đối tượng validator tương ứng chỉ định.
+ * the validator
*/
public <T extends Annotation> void addValidator(Class<T> anno,
AnnotationValidator<T> validator);
@@ -55,10 +55,10 @@
public void clearAllAnnotationRegistered();
/**
- * Returns a {@link HashMap} containing all registered
- * {@link AnnotationValidator}s
+ * Returns a {@link Map map} containing all registered
+ * {@link AnnotationValidator annotation validators}
*/
- public HashMap<Class<? extends Annotation>, AnnotationValidator<? extends
Annotation>> getValidatorlist();
+ public Map<Class<? extends Annotation>, AnnotationValidator<? extends
Annotation>> getValidatorlist();
/**
* Returns <b>true</b> if registered annotation list is empty,
<b>false</b>
@@ -103,16 +103,18 @@
AnnotationValidator<T> validator);
/**
- * Removes a specified {@link AnnotationValidator}
+ * Removes a specified {@link AnnotationValidator annotation validate}
*
* @param validator
- * the {@link AnnotationValidator} need to be removed.
+ * the {@link AnnotationValidator annotation validator} need to
+ * be removed.
*/
public <T extends Annotation> void removeValidator(
AnnotationValidator<T> validator);
/**
- * Removes a specified {@link AnnotationValidator} of given annotation.
+ * Removes a specified {@link AnnotationValidator annotation validator} of
+ * given annotation.
*
* @param anno
* the object class of annotation.
@@ -155,9 +157,7 @@
public int countValidator();
/**
- * Returns an {@link ArrayList} of registered annotation classes
- *
- * @return {@link ArrayList}
+ * Returns an {@link List list} of registered annotation classes
*/
- public ArrayList<Class<? extends Annotation>> getAnnotationRegistered();
-}
+ public List<Class<? extends Annotation>> getAnnotationRegistered();
+}
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/core/reflection/AbstractProgramUnit.java
Fri May 15 05:16:41 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/core/reflection/AbstractProgramUnit.java
Thu Jul 23 05:38:37 2009
@@ -18,6 +18,7 @@
package org.jgentleframework.core.reflection;
import java.util.HashMap;
+import java.util.Map;
import org.aopalliance.reflect.Metadata;
import org.aopalliance.reflect.ProgramUnit;
@@ -33,7 +34,7 @@
*/
public abstract class AbstractProgramUnit implements ProgramUnit {
/** The metadata list. */
- HashMap<Object, Metadata> metadataList = new HashMap<Object, Metadata>();
+ Map<Object, Metadata> metadataList = new HashMap<Object, Metadata>();
/*
* (non-Javadoc)
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/core/reflection/AbstractVisitorHandler.java
Fri May 15 05:16:41 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/core/reflection/AbstractVisitorHandler.java
Thu Jul 23 05:38:37 2009
@@ -21,6 +21,9 @@
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
import java.util.Map.Entry;
import org.jgentleframework.core.handling.DefinitionManager;
@@ -42,13 +45,13 @@
public abstract class AbstractVisitorHandler implements IAnnotationVisitor
{
/** The handler list. */
@SuppressWarnings("unchecked")
- HashMap<Class, AnnotationBeanProcessor> handlerList;
+ Map<Class, AnnotationBeanProcessor> handlerList;
/** The successors. */
- protected ArrayList<DefinitionPostProcessor> successors;
+ protected List<DefinitionPostProcessor> successors;
/** The def manager. */
- public DefinitionManager defManager = null;
+ public DefinitionManager defManager = null;
/**
* Instantiates a new abstract visitor handler.
@@ -62,7 +65,7 @@
this.defManager = defManager;
this.handlerList = new HashMap<Class, AnnotationBeanProcessor>();
- this.successors = new ArrayList<DefinitionPostProcessor>();
+ this.successors = new LinkedList<DefinitionPostProcessor>();
}
/**
=======================================
--- /trunk/JGentleProject/src/org/jgentleframework/utils/Assertor.java Fri
May 15 05:16:41 2009
+++ /trunk/JGentleProject/src/org/jgentleframework/utils/Assertor.java Thu
Jul 23 05:38:37 2009
@@ -20,6 +20,7 @@
import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.List;
import java.util.Map;
import org.jgentleframework.core.IllegalPropertyException;
@@ -210,7 +211,7 @@
* Chuỗi String mô tả message của exception nếu quá trình xác
* nhận failed
*/
- public static void hasValidIndex(ArrayList<?> arrayList, int index,
+ public static void hasValidIndex(List<?> arrayList, int index,
String message) {
Assertor
@@ -230,7 +231,7 @@
* @param index
* chỉ số index
*/
- public static void hasValidIndex(ArrayList<?> arrayList, int index) {
+ public static void hasValidIndex(List<?> arrayList, int index) {
hasValidIndex(arrayList, index,
"[Quá trình xác nhận failed] - index nằm ngoài phạm vi của
arrayList.");