Revision: 95
Author: Skydunkpro
Date: Thu Aug 27 01:41:53 2009
Log: optimize code
http://code.google.com/p/jgentle/source/detail?r=95
Added:
/trunk/JGentleProject/src/org/jgentleframework/reflection/metadata/AnnotationMetadata.java
/trunk/JGentleProject/src/org/jgentleframework/reflection/metadata/AnnotationMetadataImpl.java
Deleted:
/trunk/JGentleProject/src/org/jgentleframework/reflection/metadata/AnnoMeta.java
/trunk/JGentleProject/src/org/jgentleframework/reflection/metadata/AnnoMetaImpl.java
Modified:
/trunk/JGentleProject/src/org/jgentleframework/core/handling/AbstractDefinitionController.java
/trunk/JGentleProject/src/org/jgentleframework/integration/remoting/rmi/context/RmiServiceExporterProcessor.java
/trunk/JGentleProject/src/org/jgentleframework/reflection/AbstractVisitorHandler.java
/trunk/JGentleProject/src/org/jgentleframework/reflection/DefinitionPostProcessor.java
/trunk/JGentleProject/src/org/jgentleframework/reflection/IAnnotationVisitor.java
/trunk/JGentleProject/src/org/jgentleframework/reflection/ReflectIdentification.java
/trunk/JGentleProject/src/org/jgentleframework/reflection/annohandler/AnnotationHandler.java
/trunk/JGentleProject/src/org/jgentleframework/reflection/annohandler/AnnotationPostProcessor.java
/trunk/JGentleProject/src/org/jgentleframework/reflection/metadata/AnnotationProxy.java
/trunk/JGentleProject/src/org/jgentleframework/reflection/metadata/Definition.java
/trunk/JGentleProject/src/org/jgentleframework/reflection/metadata/DefinitionCore.java
/trunk/JGentleProject/src/org/jgentleframework/reflection/metadata/DefinitionCoreImpl.java
/trunk/JGentleProject/src/org/jgentleframework/reflection/metadata/MetaDataFactory.java
/trunk/JGentleProject/src/org/jgentleframework/utils/ReflectUtils.java
/trunk/JGentleProject/src/org/samples/AnnoMetaTest.java
/trunk/JGentleProject/src/org/samples/PostProcessorTest.java
=======================================
--- /dev/null
+++
/trunk/JGentleProject/src/org/jgentleframework/reflection/metadata/AnnotationMetadata.java
Thu Aug 27 01:41:53 2009
@@ -0,0 +1,161 @@
+/*
+ * 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: JGentleFramework
+ */
+package org.jgentleframework.reflection.metadata;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+import org.aopalliance.reflect.Metadata;
+
+/**
+ * Represents the {@link AnnotationMetadata annotation metadata} will be
created in
+ * JGentle system. An {@link AnnotationMetadata annotation metadata} will
hold a list of
+ * {@link Metadata metadatas} which may be another {@link
AnnotationMetadata annotation
+ * metadatas} or basic datas (values of attributes of an annotation) are
+ * interpreted.
+ * <p>
+ * If {@link AnnotationMetadata annotation metadata} is interpreted of
annotation, key of
+ * it will be the instance which is annotated with that
<code>annotation</code>,
+ * and value will be the <code>annotation instance</code>.
+ *
+ * @author LE QUOC CHUNG - mailto: <a
+ * href="mailto:
skydu...@yahoo.com">
skydu...@yahoo.com</a>
+ * @date Sep 5, 2007
+ * @see Metadata
+ */
+public interface AnnotationMetadata extends Metadata {
+ /**
+ * Removes all the {@link Metadata metadatas} in current {@link
AnnotationMetadata
+ * annotation metadata}
+ */
+ public void clear();
+
+ /**
+ * Returns <code>true</code> if current {@link AnnotationMetadata
annotation metadata}
+ * contains the given {@link Metadata metadata}
+ *
+ * @param metadata
+ * the desired {@link Metadata} need to be tested.
+ * @return returns <b>true</b> if this {@link AnnotationMetadata
annotation metadata}
+ * contains the given {@link Metadata}, <b>false</b> otherwise.
+ */
+ public boolean contains(Metadata metadata);
+
+ /**
+ * Returns <b>true</b> if this {@link AnnotationMetadata annotation
metadata} contains
+ * a {@link Metadata metadata} corresponds to the given object key.
+ *
+ * @param key
+ * key of {@link Metadata} need to be tested.
+ * @return returns <b>true</b> if this {@link AnnotationMetadata
annotation metadata}
+ * contains a {@link Metadata metadata} corresponds to the given
+ * key, <b>false</b> otherwise.
+ */
+ public boolean contains(Object key);
+
+ /**
+ * Returns the number of all {@link Metadata metadatas} in current
+ * {@link AnnotationMetadata annotation metadata}
+ */
+ public int count();
+
+ /**
+ * Returns the {@link Metadata metadata} corresponds to the given object
+ * key, or <code>null</code> if current {@link AnnotationMetadata
annotation metadata}
+ * doesn't contain any mapping corresponding to the given key.
+ *
+ * @param key
+ * the given object key
+ */
+ public Metadata getMetadata(Object key);
+
+ /**
+ * Returns the {@link Map map} containing all {@link Metadata metadatas}
in
+ * current {@link AnnotationMetadata annotation metadata}
+ */
+ public Map<Object, Metadata> getMetaList();
+
+ /**
+ * Returns the name of this {@link AnnotationMetadata annotation
metadata}, if it's
+ * not specified, a default name is name of object class of {@link
AnnotationMetadata
+ * annotation metadata} will be returned.
+ */
+ public String getName();
+
+ /**
+ * Returns the parents of current {@link AnnotationMetadata annotation
metadata}, if
+ * returning value is <b>null</b>, it will be key of one {@link Definition
+ * definition}.
+ *
+ * @see Definition
+ * @see DefinitionCore
+ */
+ public AnnotationMetadata getParents();
+
+ /**
+ * Returns the object class type of current {@link AnnotationMetadata
annotation
+ * metadata}
+ */
+ public Class<?> getType();
+
+ /**
+ * Returns <b>true</b> if current {@link AnnotationMetadata annotation
metadata} is
+ * empty, otherwise returns <b>false</b>.
+ */
+ public boolean isEmpty();
+
+ /**
+ * Returns a {@link Set set} of keys corresponds to all {@link Metadata
+ * metadatas} existing in current {@link AnnotationMetadata annotation
metadata}
+ */
+ public Set<Object> keySet();
+
+ /**
+ * Puts a {@link Metadata metadata} into current {@link
AnnotationMetadata annotation
+ * metadata}.
+ *
+ * @param data
+ * the given metadata.
+ */
+ public Metadata putMetaData(Metadata data);
+
+ /**
+ * Removes a specified {@link Metadata metadata}
+ *
+ * @param key
+ * key of {@link Metadata} need to be removed.
+ */
+ public Metadata removeMetadata(Object key);
+
+ /**
+ * Sets name to current {@link AnnotationMetadata annotation metadata}.
+ *
+ * @param name
+ * the given name
+ */
+ public void setName(String name);
+
+ /**
+ * Returns a {@link Collection collection} view of {@link Metadata
+ * metadatas} existing in current {@link AnnotationMetadata annotation
metadata}.
+ *
+ * @return {@link Collection}
+ */
+ public Collection<Metadata> values();
+}
=======================================
--- /dev/null
+++
/trunk/JGentleProject/src/org/jgentleframework/reflection/metadata/AnnotationMetadataImpl.java
Thu Aug 27 01:41:53 2009
@@ -0,0 +1,314 @@
+/*
+ * 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: JGentleFramework
+ */
+package org.jgentleframework.reflection.metadata;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.aopalliance.reflect.Metadata;
+import org.jgentleframework.utils.ReflectUtils;
+
+/**
+ * This class is an implementation of {@link AnnotationMetadata} interface.
+ *
+ * @author LE QUOC CHUNG - mailto: <a
+ * href="mailto:
skydu...@yahoo.com">
skydu...@yahoo.com</a>
+ * @date Sep 4, 2007
+ * @see AnnotationMetadata
+ * @see Metadata
+ * @see MetadataImpl
+ */
+class AnnotationMetadataImpl extends MetadataImpl implements Metadata,
AnnotationMetadata {
+ /**
+ * The {@link Map map} containing all {@link Metadata metadata} objects of
+ * this {@link AnnotationMetadata annotation metadata}
+ */
+ Map<Object, Metadata> metaList = new HashMap<Object, Metadata>();
+
+ /** The current name of this {@link AnnotationMetadata} */
+ String name = "";
+
+ /**
+ * The {@link AnnotationMetadata} parents of this {@link
AnnotationMetadata} if it exists, if
+ * not, this mean current {@link AnnotationMetadata} is a {@link
AnnotationMetadata} of one
+ * {@link Definition} and its value will be <code>null</code>.
+ */
+ AnnotationMetadata parents;
+
+ /** The type. */
+ Class<?> type = null;
+
+ /**
+ * The Constructor.
+ *
+ * @param key
+ * the key
+ * @param value
+ * the value
+ */
+ public AnnotationMetadataImpl(Object key, Object value) {
+
+ super(key, value);
+ if (ReflectUtils.isClass(key)) {
+ type = (Class<?>) key;
+ }
+ else if (ReflectUtils.isMethod(key)) {
+ type = ((Method) key).getDeclaringClass();
+ }
+ else if (ReflectUtils.isField(key)) {
+ type = ((Field) key).getDeclaringClass();
+ }
+
this.name = type != null ? type.toString() : "";
+ }
+
+ /**
+ * The Constructor.
+ *
+ * @param key
+ * the key
+ * @param value
+ * the value
+ * @param parents
+ * the parents
+ */
+ public AnnotationMetadataImpl(Object key, Object value,
AnnotationMetadata parents) {
+
+ super(key, value);
+ if (ReflectUtils.isClass(key)) {
+ type = (Class<?>) key;
+
this.name = type.getName();
+ }
+ this.parents = parents;
+ }
+
+ /**
+ * The Constructor.
+ *
+ * @param key
+ * the key
+ * @param value
+ * the value
+ * @param parents
+ * the parents
+ * @param name
+ * the name
+ */
+ public AnnotationMetadataImpl(Object key, Object value,
AnnotationMetadata parents, String name) {
+
+ super(key, value);
+ if (ReflectUtils.isClass(key))
+ type = (Class<?>) key;
+ this.parents = parents;
+
this.name = name;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jgentleframework.core.reflection.metadata.AnnoMeta#clear()
+ */
+ @Override
+ public void clear() {
+
+ metaList.clear();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ *
org.jgentleframework.core.reflection.metadata.AnnoMeta#contains(java.lang
+ * .Object)
+ */
+ @Override
+ public boolean contains(Object key) {
+
+ return metaList.containsKey(key);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
@seeorg.jgentleframework.core.reflection.metadata.AnnoMeta#contains(org.
+ * aopalliance.reflect.Metadata)
+ */
+ @Override
+ public boolean contains(Metadata value) {
+
+ return metaList.containsValue(value);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jgentleframework.core.reflection.metadata.AnnoMeta#count()
+ */
+ @Override
+ public int count() {
+
+ return metaList.size();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * org.jgentleframework.core.reflection.metadata.AnnoMeta#getMetadata(java
+ * .lang.Object)
+ */
+ @Override
+ public Metadata getMetadata(Object key) {
+
+ return metaList.get(key);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jgentleframework.core.reflection.metadata.AnnoMeta#getName()
+ */
+ @Override
+ public String getName() {
+
+ return name;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jgentleframework.core.reflection.metadata.AnnoMeta#getType()
+ */
+ @Override
+ public Class<?> getType() {
+
+ return type;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jgentleframework.core.reflection.metadata.AnnoMeta#isEmpty()
+ */
+ @Override
+ public boolean isEmpty() {
+
+ return metaList.isEmpty();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jgentleframework.core.reflection.metadata.AnnoMeta#keySet()
+ */
+ @Override
+ public Set<Object> keySet() {
+
+ return metaList.keySet();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * org.jgentleframework.core.reflection.metadata.AnnoMeta#putMetaData(org
+ * .aopalliance.reflect.Metadata)
+ */
+ @Override
+ public Metadata putMetaData(Metadata data) {
+
+ return metaList.put(data.getKey(), data);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * org.jgentleframework.core.reflection.metadata.AnnoMeta#removeMetadata(
+ * java.lang.Object)
+ */
+ @Override
+ public Metadata removeMetadata(Object key) {
+
+ return metaList.remove(key);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ *
org.jgentleframework.core.reflection.metadata.AnnoMeta#setName(java.lang
+ * .String)
+ */
+ @Override
+ public void setName(String name) {
+
+
this.name = name;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jgentleframework.core.reflection.metadata.AnnoMeta#values()
+ */
+ @Override
+ public Collection<Metadata> values() {
+
+ return metaList.values();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
org.jgentleframework.core.reflection.metadata.AnnoMeta#getParents()
+ */
+ @Override
+ public AnnotationMetadata getParents() {
+
+ return parents;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * org.jgentleframework.core.reflection.metadata.MetadataImpl#getValue()
+ */
+ @Override
+ public Object getValue() {
+
+ return this.value;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
org.jgentleframework.core.reflection.metadata.AnnoMeta#getMetaList()
+ */
+ @Override
+ public Map<Object, Metadata> getMetaList() {
+
+ return metaList;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+
+ StringBuffer string = new StringBuffer();
+ string.append("Annotation metadata");
+ string.append(" '");
+ string.append(
this.name != null && !this.name.isEmpty() ? name
+ : "Not specified name" + "'");
+ string.append(" according to key '");
+ string.append(this.getKey().toString());
+ string.append("'#");
+ string.append(super.toString());
+ return string.toString();
+ }
+}
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/reflection/metadata/AnnoMeta.java
Fri Aug 14 00:45:12 2009
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * 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: JGentleFramework
- */
-package org.jgentleframework.reflection.metadata;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-
-import org.aopalliance.reflect.Metadata;
-
-/**
- * Represents the {@link AnnoMeta annotation metadata} will be created in
- * JGentle system. An {@link AnnoMeta annotation metadata} will hold a
list of
- * {@link Metadata metadatas} which may be another {@link AnnoMeta
annotation
- * metadatas} or basic datas (values of attributes of an annotation) are
- * interpreted.
- * <p>
- * If {@link AnnoMeta annotation metadata} is interpreted of annotation,
key of
- * it will be the instance which is annotated with that
<code>annotation</code>,
- * and value will be the <code>annotation instance</code>.
- *
- * @author LE QUOC CHUNG - mailto: <a
- * href="mailto:
skydu...@yahoo.com">
skydu...@yahoo.com</a>
- * @date Sep 5, 2007
- * @see Metadata
- */
-public interface AnnoMeta extends Metadata {
- /**
- * Removes all the {@link Metadata metadatas} in current {@link AnnoMeta
- * annotation metadata}
- */
- public void clear();
-
- /**
- * Returns <code>true</code> if current {@link AnnoMeta annotation
metadata}
- * contains the given {@link Metadata metadata}
- *
- * @param metadata
- * the desired {@link Metadata} need to be tested.
- * @return returns <b>true</b> if this {@link AnnoMeta annotation
metadata}
- * contains the given {@link Metadata}, <b>false</b> otherwise.
- */
- public boolean contains(Metadata metadata);
-
- /**
- * Returns <b>true</b> if this {@link AnnoMeta annotation metadata}
contains
- * a {@link Metadata metadata} corresponds to the given object key.
- *
- * @param key
- * key of {@link Metadata} need to be tested.
- * @return returns <b>true</b> if this {@link AnnoMeta annotation
metadata}
- * contains a {@link Metadata metadata} corresponds to the given
- * key, <b>false</b> otherwise.
- */
- public boolean contains(Object key);
-
- /**
- * Returns the number of all {@link Metadata metadatas} in current
- * {@link AnnoMeta annotation metadata}
- */
- public int count();
-
- /**
- * Returns the {@link Metadata metadata} corresponds to the given object
- * key, or <code>null</code> if current {@link AnnoMeta annotation
metadata}
- * doesn't contain any mapping corresponding to the given key.
- *
- * @param key
- * the given object key
- */
- public Metadata getMetadata(Object key);
-
- /**
- * Returns the {@link Map map} containing all {@link Metadata metadatas}
in
- * current {@link AnnoMeta annotation metadata}
- */
- public Map<Object, Metadata> getMetaList();
-
- /**
- * Returns the name of this {@link AnnoMeta annotation metadata}, if it's
- * not specified, a default name is name of object class of {@link
AnnoMeta
- * annotation metadata} will be returned.
- */
- public String getName();
-
- /**
- * Returns the parents of current {@link AnnoMeta annotation metadata}, if
- * returning value is <b>null</b>, it will be key of one {@link Definition
- * definition}.
- *
- * @see Definition
- * @see DefinitionCore
- */
- public AnnoMeta getParents();
-
- /**
- * Returns the object class type of current {@link AnnoMeta annotation
- * metadata}
- */
- public Class<?> getType();
-
- /**
- * Returns <b>true</b> if current {@link AnnoMeta annotation metadata} is
- * empty, otherwise returns <b>false</b>.
- */
- public boolean isEmpty();
-
- /**
- * Returns a {@link Set set} of keys corresponds to all {@link Metadata
- * metadatas} existing in current {@link AnnoMeta annotation metadata}
- */
- public Set<Object> keySet();
-
- /**
- * Puts a {@link Metadata metadata} into current {@link AnnoMeta
annotation
- * metadata}.
- *
- * @param data
- * the given metadata.
- */
- public Metadata putMetaData(Metadata data);
-
- /**
- * Removes a specified {@link Metadata metadata}
- *
- * @param key
- * key of {@link Metadata} need to be removed.
- */
- public Metadata removeMetadata(Object key);
-
- /**
- * Sets name to current {@link AnnoMeta annotation metadata}.
- *
- * @param name
- * the given name
- */
- public void setName(String name);
-
- /**
- * Returns a {@link Collection collection} view of {@link Metadata
- * metadatas} existing in current {@link AnnoMeta annotation metadata}.
- *
- * @return {@link Collection}
- */
- public Collection<Metadata> values();
-}
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/reflection/metadata/AnnoMetaImpl.java
Fri Aug 14 00:45:12 2009
+++ /dev/null
@@ -1,314 +0,0 @@
-/*
- * 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: JGentleFramework
- */
-package org.jgentleframework.reflection.metadata;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.aopalliance.reflect.Metadata;
-import org.jgentleframework.utils.ReflectUtils;
-
-/**
- * This class is an implementation of {@link AnnoMeta} interface.
- *
- * @author LE QUOC CHUNG - mailto: <a
- * href="mailto:
skydu...@yahoo.com">
skydu...@yahoo.com</a>
- * @date Sep 4, 2007
- * @see AnnoMeta
- * @see Metadata
- * @see MetadataImpl
- */
-class AnnoMetaImpl extends MetadataImpl implements Metadata, AnnoMeta {
- /**
- * The {@link Map map} containing all {@link Metadata metadata} objects of
- * this {@link AnnoMeta annotation metadata}
- */
- Map<Object, Metadata> metaList = new HashMap<Object, Metadata>();
-
- /** The current name of this {@link AnnoMeta} */
- String name = "";
-
- /**
- * The {@link AnnoMeta} parents of this {@link AnnoMeta} if it exists, if
- * not, this mean current {@link AnnoMeta} is a {@link AnnoMeta} of one
- * {@link Definition} and its value will be <code>null</code>.
- */
- AnnoMeta parents;
-
- /** The type. */
- Class<?> type = null;
-
- /**
- * The Constructor.
- *
- * @param key
- * the key
- * @param value
- * the value
- */
- public AnnoMetaImpl(Object key, Object value) {
-
- super(key, value);
- if (ReflectUtils.isClass(key)) {
- type = (Class<?>) key;
- }
- else if (ReflectUtils.isMethod(key)) {
- type = ((Method) key).getDeclaringClass();
- }
- else if (ReflectUtils.isField(key)) {
- type = ((Field) key).getDeclaringClass();
- }
-
this.name = type != null ? type.toString() : "";
- }
-
- /**
- * The Constructor.
- *
- * @param key
- * the key
- * @param value
- * the value
- * @param parents
- * the parents
- */
- public AnnoMetaImpl(Object key, Object value, AnnoMeta parents) {
-
- super(key, value);
- if (ReflectUtils.isClass(key)) {
- type = (Class<?>) key;
-
this.name = type.getName();
- }
- this.parents = parents;
- }
-
- /**
- * The Constructor.
- *
- * @param key
- * the key
- * @param value
- * the value
- * @param parents
- * the parents
- * @param name
- * the name
- */
- public AnnoMetaImpl(Object key, Object value, AnnoMeta parents, String
name) {
-
- super(key, value);
- if (ReflectUtils.isClass(key))
- type = (Class<?>) key;
- this.parents = parents;
-
this.name = name;
- }
-
- /*
- * (non-Javadoc)
- * @see org.jgentleframework.core.reflection.metadata.AnnoMeta#clear()
- */
- @Override
- public void clear() {
-
- metaList.clear();
- }
-
- /*
- * (non-Javadoc)
- * @see
- *
org.jgentleframework.core.reflection.metadata.AnnoMeta#contains(java.lang
- * .Object)
- */
- @Override
- public boolean contains(Object key) {
-
- return metaList.containsKey(key);
- }
-
- /*
- * (non-Javadoc)
- *
@seeorg.jgentleframework.core.reflection.metadata.AnnoMeta#contains(org.
- * aopalliance.reflect.Metadata)
- */
- @Override
- public boolean contains(Metadata value) {
-
- return metaList.containsValue(value);
- }
-
- /*
- * (non-Javadoc)
- * @see org.jgentleframework.core.reflection.metadata.AnnoMeta#count()
- */
- @Override
- public int count() {
-
- return metaList.size();
- }
-
- /*
- * (non-Javadoc)
- * @see
- * org.jgentleframework.core.reflection.metadata.AnnoMeta#getMetadata(java
- * .lang.Object)
- */
- @Override
- public Metadata getMetadata(Object key) {
-
- return metaList.get(key);
- }
-
- /*
- * (non-Javadoc)
- * @see org.jgentleframework.core.reflection.metadata.AnnoMeta#getName()
- */
- @Override
- public String getName() {
-
- return name;
- }
-
- /*
- * (non-Javadoc)
- * @see org.jgentleframework.core.reflection.metadata.AnnoMeta#getType()
- */
- @Override
- public Class<?> getType() {
-
- return type;
- }
-
- /*
- * (non-Javadoc)
- * @see org.jgentleframework.core.reflection.metadata.AnnoMeta#isEmpty()
- */
- @Override
- public boolean isEmpty() {
-
- return metaList.isEmpty();
- }
-
- /*
- * (non-Javadoc)
- * @see org.jgentleframework.core.reflection.metadata.AnnoMeta#keySet()
- */
- @Override
- public Set<Object> keySet() {
-
- return metaList.keySet();
- }
-
- /*
- * (non-Javadoc)
- * @see
- * org.jgentleframework.core.reflection.metadata.AnnoMeta#putMetaData(org
- * .aopalliance.reflect.Metadata)
- */
- @Override
- public Metadata putMetaData(Metadata data) {
-
- return metaList.put(data.getKey(), data);
- }
-
- /*
- * (non-Javadoc)
- * @see
- * org.jgentleframework.core.reflection.metadata.AnnoMeta#removeMetadata(
- * java.lang.Object)
- */
- @Override
- public Metadata removeMetadata(Object key) {
-
- return metaList.remove(key);
- }
-
- /*
- * (non-Javadoc)
- * @see
- *
org.jgentleframework.core.reflection.metadata.AnnoMeta#setName(java.lang
- * .String)
- */
- @Override
- public void setName(String name) {
-
-
this.name = name;
- }
-
- /*
- * (non-Javadoc)
- * @see org.jgentleframework.core.reflection.metadata.AnnoMeta#values()
- */
- @Override
- public Collection<Metadata> values() {
-
- return metaList.values();
- }
-
- /*
- * (non-Javadoc)
- * @see
org.jgentleframework.core.reflection.metadata.AnnoMeta#getParents()
- */
- @Override
- public AnnoMeta getParents() {
-
- return parents;
- }
-
- /*
- * (non-Javadoc)
- * @see
- * org.jgentleframework.core.reflection.metadata.MetadataImpl#getValue()
- */
- @Override
- public Object getValue() {
-
- return this.value;
- }
-
- /*
- * (non-Javadoc)
- * @see
org.jgentleframework.core.reflection.metadata.AnnoMeta#getMetaList()
- */
- @Override
- public Map<Object, Metadata> getMetaList() {
-
- return metaList;
- }
-
- /*
- * (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
-
- StringBuffer string = new StringBuffer();
- string.append("Annotation metadata");
- string.append(" '");
- string.append(
this.name != null && !this.name.isEmpty() ? name
- : "Not specified name" + "'");
- string.append(" according to key '");
- string.append(this.getKey().toString());
- string.append("'#");
- string.append(super.toString());
- return string.toString();
- }
-}
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/core/handling/AbstractDefinitionController.java
Fri Aug 14 00:45:12 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/core/handling/AbstractDefinitionController.java
Thu Aug 27 01:41:53 2009
@@ -20,7 +20,7 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
-import java.util.ArrayList;
+import java.util.List;
import org.jgentleframework.core.factory.InOutDependencyException;
import org.jgentleframework.reflection.AbstractVisitorHandler;
@@ -29,14 +29,14 @@
import org.jgentleframework.reflection.annohandler.AnnotationBeanProcessor;
import org.jgentleframework.reflection.annohandler.AnnotationHandler;
import org.jgentleframework.reflection.annohandler.AnnotationPostProcessor;
-import org.jgentleframework.reflection.metadata.AnnoMeta;
+import org.jgentleframework.reflection.metadata.AnnotationMetadata;
import org.jgentleframework.utils.Assertor;
import org.jgentleframework.utils.ReflectUtils;
/**
* Quản lý các phương thức điều khiển các <i>module</i> là các
* <i>extension-point</i> trong khi thực thi xử lý annotation, bao gồm
việc diễn
- * dịch <code>annotation</code> thành {@link AnnoMeta}, quản lý
+ * dịch <code>annotation</code> thành {@link AnnotationMetadata}, quản lý
* {@link DefinitionPostProcessor}, {@link AnnotationBeanProcessor}, ...
*
* @author LE QUOC CHUNG - mailto: <a
@@ -52,9 +52,9 @@
protected IAnnotationVisitor visitorHandler = new AbstractVisitorHandler(
this) {
@Override
- protected AnnoMeta build(
+ protected AnnotationMetadata build(
Annotation element,
- AnnoMeta containter,
+ AnnotationMetadata containter,
DefinitionManager defManager)
throws Exception {
@@ -80,8 +80,7 @@
Assertor.notNull(handler);
Class<?> clazz = handler.getClass();
- ArrayList<Type> typeList = ReflectUtils.getAllGenericInterfaces(clazz,
- true);
+ List<Type> typeList = ReflectUtils.getAllGenericInterfaces(clazz, true);
for (Type type : typeList) {
if (ReflectUtils.isCast(ParameterizedType.class, type)) {
ParameterizedType pType = (ParameterizedType) type;
@@ -244,7 +243,7 @@
* org.jgentleframework.core.reflection.metadata.AnnoMeta)
*/
@Override
- public void visit(Annotation[] annoArray, AnnoMeta rootAnnoMeta) {
+ public void visit(Annotation[] annoArray, AnnotationMetadata
rootAnnoMeta) {
this.visitorHandler.visit(annoArray, rootAnnoMeta);
}
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/integration/remoting/rmi/context/RmiServiceExporterProcessor.java
Fri Aug 14 00:45:12 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/integration/remoting/rmi/context/RmiServiceExporterProcessor.java
Thu Aug 27 01:41:53 2009
@@ -31,7 +31,7 @@
import org.jgentleframework.reflection.AnnotationBeanException;
import org.jgentleframework.reflection.annohandler.AnnotationPostProcessor;
import org.jgentleframework.reflection.annohandler.PointStatus;
-import org.jgentleframework.reflection.metadata.AnnoMeta;
+import org.jgentleframework.reflection.metadata.AnnotationMetadata;
import org.jgentleframework.utils.ReflectUtils;
/**
@@ -79,7 +79,7 @@
* java.lang.annotation.Annotation[], java.lang.Object)
*/
@Override
- public void after(RmiExporting anno, AnnoMeta parents, AnnoMeta annoMeta,
+ public void after(RmiExporting anno, AnnotationMetadata parents,
AnnotationMetadata annotationMetadata,
Annotation[] listAnno, Object objConfig)
throws AnnotationBeanException {
@@ -119,7 +119,7 @@
* java.lang.annotation.Annotation[], java.lang.Object)
*/
@Override
- public void before(RmiExporting anno, AnnoMeta parents,
+ public void before(RmiExporting anno, AnnotationMetadata parents,
Annotation[] listAnno, Object objConfig)
throws AnnotationBeanException {
@@ -137,7 +137,7 @@
*/
@Override
public void catchException(Exception ex, RmiExporting anno,
- AnnoMeta parents, AnnoMeta annoMeta, Annotation[] listAnno,
+ AnnotationMetadata parents, AnnotationMetadata annotationMetadata,
Annotation[] listAnno,
Object objConfig) throws AnnotationBeanException {
if (ex instanceof RmiExportingException) {
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/reflection/AbstractVisitorHandler.java
Fri Aug 14 00:45:12 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/reflection/AbstractVisitorHandler.java
Thu Aug 27 01:41:53 2009
@@ -30,7 +30,7 @@
import org.jgentleframework.reflection.annohandler.AnnotationHandler;
import org.jgentleframework.reflection.annohandler.AnnotationPostProcessor;
import org.jgentleframework.reflection.annohandler.PointStatus;
-import org.jgentleframework.reflection.metadata.AnnoMeta;
+import org.jgentleframework.reflection.metadata.AnnotationMetadata;
import org.jgentleframework.utils.Assertor;
import org.jgentleframework.utils.ReflectUtils;
@@ -49,8 +49,8 @@
/** The successors. */
protected List<DefinitionPostProcessor> successors;
- /** The def manager. */
- public DefinitionManager defManager = null;
+ /** The definition manager. */
+ public DefinitionManager definitionManager = null;
/**
* Instantiates a new abstract visitor handler.
@@ -62,7 +62,7 @@
public <T extends Annotation> AbstractVisitorHandler(
DefinitionManager defManager) {
- this.defManager = defManager;
+ this.definitionManager = defManager;
this.handlerList = new HashMap<Class, AnnotationBeanProcessor>();
this.successors = new ArrayList<DefinitionPostProcessor>();
}
@@ -80,8 +80,9 @@
* @throws Exception
* the exception
*/
- protected abstract AnnoMeta build(Annotation element, AnnoMeta containter,
- DefinitionManager definitionManager) throws Exception;
+ protected abstract AnnotationMetadata build(Annotation element,
+ AnnotationMetadata containter, DefinitionManager definitionManager)
+ throws Exception;
/**
* Interprets annotation.
@@ -92,7 +93,8 @@
* the root anno meta
*/
@SuppressWarnings("unchecked")
- private void visitAnnotation(Annotation[] annoArray, AnnoMeta
rootAnnoMeta) {
+ private void visitAnnotation(Annotation[] annoArray,
+ AnnotationMetadata rootAnnoMeta) {
/*
* Thực thi xử lý chuyển đổi dữ liệu annotation
@@ -101,7 +103,7 @@
AnnotationBeanProcessor<?> annoHandler = this.handlerList
.get(element.annotationType());
AnnotationPostProcessor app = null;
- AnnoMeta result = null;
+ AnnotationMetadata result = null;
/*
* Thực thi method before của AnnotationPostProcessor
*/
@@ -126,11 +128,12 @@
if ((ps != null && ps.isEnable()) || ps == null) {
AnnotationHandler ahl = (AnnotationHandler) annoHandler;
result = ahl.handleVisit(element, rootAnnoMeta,
- this.defManager);
+ this.definitionManager);
}
}
else {
- result = build(element, rootAnnoMeta, this.defManager);
+ result = build(element, rootAnnoMeta,
+ this.definitionManager);
}
/*
* Thực thi method after của AnnotationPostProcessor
@@ -149,7 +152,8 @@
* Thực thi việc diễn dịch mặc địch nếu không tìm thấy
* method handleVisit
*/
- result = build(element, rootAnnoMeta, this.defManager);
+ result = build(element, rootAnnoMeta,
+ this.definitionManager);
}
}
catch (Exception e) {
@@ -185,7 +189,7 @@
* .annotation.Annotation[],
* org.jgentleframework.core.reflection.metadata.AnnoMeta)
*/
- public void visit(Annotation[] annoArray, AnnoMeta rootAnnoMeta) {
+ public void visit(Annotation[] annoArray, AnnotationMetadata
rootAnnoMeta) {
/*
* Thực thi method before của DefinitionPostProcessor
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/reflection/DefinitionPostProcessor.java
Fri Aug 14 00:45:12 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/reflection/DefinitionPostProcessor.java
Thu Aug 27 01:41:53 2009
@@ -19,7 +19,7 @@
import java.lang.annotation.Annotation;
-import org.jgentleframework.reflection.metadata.AnnoMeta;
+import org.jgentleframework.reflection.metadata.AnnotationMetadata;
import org.jgentleframework.reflection.metadata.Definition;
/**
@@ -40,11 +40,11 @@
*
* @param annoArray
* the annotation list of current {@link Definition}
- * @param annoMeta
- * The {@link AnnoMeta} of current {@link Definition}
+ * @param annotationMetadata
+ * The {@link AnnotationMetadata} of current {@link Definition}
* @throws DefinitionPostException
*/
- void beforePost(Annotation[] annoArray, AnnoMeta annoMeta)
+ void beforePost(Annotation[] annoArray, AnnotationMetadata
annotationMetadata)
throws DefinitionPostException;
/**
@@ -53,25 +53,25 @@
*
* @param annoArray
* the annotation list of current {@link Definition}
- * @param annoMeta
- * The {@link AnnoMeta} of current {@link Definition}
+ * @param annotationMetadata
+ * The {@link AnnotationMetadata} of current {@link Definition}
* @throws DefinitionPostException
*/
- void afterPost(Annotation[] annoArray, AnnoMeta annoMeta)
+ void afterPost(Annotation[] annoArray, AnnotationMetadata
annotationMetadata)
throws DefinitionPostException;
/**
* This method will catch all exceptions thrown during the corresponding
* {@link Definition} is instantiating, includes thrown exceptions of
- * {@link #beforePost(Annotation[], AnnoMeta)} method and
- * {@link #afterPost(Annotation[], AnnoMeta)} method.
+ * {@link #beforePost(Annotation[], AnnotationMetadata)} method and
+ * {@link #afterPost(Annotation[], AnnotationMetadata)} method.
*
* @param ex
* the exception
* @param annoArray
* the annotation list of current {@link Definition}
- * @param annoMeta
- * The {@link AnnoMeta} of current {@link Definition}
+ * @param annotationMetadata
+ * The {@link AnnotationMetadata} of current {@link Definition}
* @param bool
* this boolean value represents the time of exception
catching.
* If <b>true</b>, it is <code>before post</code>,if
<b>false</b>,
@@ -82,5 +82,5 @@
* this instantiation will be interupted.
*/
boolean catchException(Exception ex, Annotation[] annoArray,
- AnnoMeta annoMeta, boolean bool);
-}
+ AnnotationMetadata annotationMetadata, boolean bool);
+}
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/reflection/IAnnotationVisitor.java
Fri Aug 14 00:45:12 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/reflection/IAnnotationVisitor.java
Thu Aug 27 01:41:53 2009
@@ -20,7 +20,7 @@
import java.lang.annotation.Annotation;
import org.jgentleframework.reflection.annohandler.AnnotationBeanProcessor;
-import org.jgentleframework.reflection.metadata.AnnoMeta;
+import org.jgentleframework.reflection.metadata.AnnotationMetadata;
import org.jgentleframework.reflection.metadata.Definition;
/**
@@ -133,5 +133,5 @@
* @param annoArray
* @param rootAnnoMeta
*/
- public void visit(Annotation[] annoArray, AnnoMeta rootAnnoMeta);
-}
+ public void visit(Annotation[] annoArray, AnnotationMetadata
rootAnnoMeta);
+}
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/reflection/ReflectIdentification.java
Fri Aug 14 00:45:12 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/reflection/ReflectIdentification.java
Thu Aug 27 01:41:53 2009
@@ -33,8 +33,8 @@
*/
public abstract class ReflectIdentification {
/**
- * Returns a class identification that corresponds to configuration data
of
- * configuration data.
+ * Returns a class identification that corresponds to its configuration
+ * data.
*
* @return {@link Identification}
*/
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/reflection/annohandler/AnnotationHandler.java
Fri Aug 14 00:45:12 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/reflection/annohandler/AnnotationHandler.java
Thu Aug 27 01:41:53 2009
@@ -20,7 +20,7 @@
import java.lang.annotation.Annotation;
import org.jgentleframework.core.handling.DefinitionManager;
-import org.jgentleframework.reflection.metadata.AnnoMeta;
+import org.jgentleframework.reflection.metadata.AnnotationMetadata;
/**
* Chỉ định một processor thực thi việc diễn dịch.
@@ -34,17 +34,19 @@
public interface AnnotationHandler<T extends Annotation> extends
AnnotationBeanProcessor<T> {
/**
- * Thực thi tao tác diễn dịch một annotation chỉ định thành AnnoMeta.
+ * Thực thi tao tác diễn dịch một annotation chỉ định thành
+ * AnnotationMetadata.
*
* @param annotation
* đối tượng Annotation tương ứng cần diễn dịch
- * @param annoMeta
+ * @param annotationMetadata
* đối tượng root_AnnoMeta của definition hiện hành sẽ chứa
- * AnnoMeta sắp diễn dịch.
- * @param defManager
+ * AnnotationMetadata sắp diễn dịch.
+ * @param definitionManager
* đối tượng Definition Manager của container hiện hành.
- * @return trả về đối tượng AnnoMeta được diễn dịch.
+ * @return trả về đối tượng AnnotationMetadata được diễn dịch.
*/
- public AnnoMeta handleVisit(T annotation, AnnoMeta annoMeta,
- DefinitionManager defManager) throws Exception;
-}
+ public AnnotationMetadata handleVisit(T annotation,
+ AnnotationMetadata annotationMetadata,
+ DefinitionManager definitionManager) throws Exception;
+}
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/reflection/annohandler/AnnotationPostProcessor.java
Fri Aug 14 00:45:12 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/reflection/annohandler/AnnotationPostProcessor.java
Thu Aug 27 01:41:53 2009
@@ -20,7 +20,7 @@
import java.lang.annotation.Annotation;
import org.jgentleframework.reflection.AnnotationBeanException;
-import org.jgentleframework.reflection.metadata.AnnoMeta;
+import org.jgentleframework.reflection.metadata.AnnotationMetadata;
/**
* Mô tả các hành vi sẽ được thực thi trước và sau khi
<code>Annotation</code>
@@ -43,15 +43,15 @@
* @param anno
* annotation chỉ định được sử dụng để interpreter
* @param parents
- * annoMeta cha sẽ chứa annoMeta sắp được interpreter. (có thể
là
- * root-AnnoMeta của Definition)
+ * annotationMetadata cha sẽ chứa annotationMetadata sắp được
+ * diễn dịch. (có thể là root-AnnotationMetadata của
Definition)
* @param listAnno
* danh sách annotation gốc được chỉ định cùng với annotation
* hiện hành
* @param objConfig
* đối tượng được cấu hình annotation.
*/
- void before(T anno, AnnoMeta parents, Annotation[] listAnno,
+ void before(T anno, AnnotationMetadata parents, Annotation[] listAnno,
Object objConfig) throws AnnotationBeanException;
/**
@@ -63,19 +63,20 @@
* @param anno
* annotation chỉ định được sử dụng để interpreter
* @param parents
- * annoMeta cha chứa annoMeta được interpreter (có thể là
- * root-AnnoMeta của Definition).
- * @param annoMeta
- * annoMeta ứng với annotation sau khi đã được interpreter.
+ * annotationMetadata cha chứa annotationMetadata được diễn
dịch
+ * (có thể là root-AnnotationMetadata của Definition).
+ * @param annotationMetadata
+ * annotationMetadata ứng với annotation sau khi đã được
+ * interpreter.
* @param listAnno
* danh sách annotation gốc được chỉ định cùng với annotation
* hiện hành
* @param objConfig
* đối tượng được chỉ định annotation.
*/
- void after(T anno, AnnoMeta parents, AnnoMeta annoMeta,
- Annotation[] listAnno, Object objConfig)
- throws AnnotationBeanException;
+ void after(T anno, AnnotationMetadata parents,
+ AnnotationMetadata annotationMetadata, Annotation[] listAnno,
+ Object objConfig) throws AnnotationBeanException;
/**
* Hàm xử lý catch các ngoại lệ được ném ra bởi before method hoặc after
@@ -86,19 +87,21 @@
* @param anno
* annotation chỉ định được sử dụng để interpreter
* @param parents
- * annoMeta cha chứa annoMeta được interpreter (có thể là
- * root-AnnoMeta của Definition).
- * @param annoMeta
- * annoMeta ứng với annotation sau khi đã được interpreter nếu
có
- * (catch exception từ after method), còn nếu annoMeta là null
có
- * nghĩa rằng đang catch exception được ném ra bởi before
method.
+ * annotationMetadata cha chứa annotationMetadata được
+ * interpreter (có thể là root-AnnotationMetadata của
+ * Definition).
+ * @param annotationMetadata
+ * annotationMetadata ứng với annotation sau khi đã được
+ * interpreter nếu có (catch exception từ after method), còn
nếu
+ * annotationMetadata là null có nghĩa rằng đang catch
exception
+ * được ném ra bởi before method.
* @param listAnno
* danh sách annotation gốc được chỉ định cùng với annotation
* hiện hành
* @param objConfig
* đối tượng được chỉ định annotation.
*/
- void catchException(Exception ex, T anno, AnnoMeta parents,
- AnnoMeta annoMeta, Annotation[] listAnno, Object objConfig)
- throws AnnotationBeanException;
-}
+ void catchException(Exception ex, T anno, AnnotationMetadata parents,
+ AnnotationMetadata annotationMetadata, Annotation[] listAnno,
+ Object objConfig) throws AnnotationBeanException;
+}
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/reflection/metadata/AnnotationProxy.java
Fri Aug 14 00:45:12 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/reflection/metadata/AnnotationProxy.java
Thu Aug 27 01:41:53 2009
@@ -27,12 +27,13 @@
import org.jgentleframework.utils.ReflectUtils;
/**
- * This class represents creating proxied annotation from {@link
Definition}
- * data. These proxied annotation are responsible for intermediation
between
- * {@link AnnoMeta} data type and object annotation type in order to
access,
- * modify configured data easily and simplify operations of using
- * {@link AnnoMeta}. A proxied annotation is a proxy of an annotation
instance,
- * taking an annotation interface, but accessible data is its {@link
AnnoMeta}.
+ * This class represents created proxied annotation of {@link Definition
+ * definition} data. These proxied annotation are responsible for
intermediation
+ * between {@link AnnotationMetadata} data type and object annotation type
in
+ * order to access, modify configured data easily and simplify operations
of
+ * using {@link AnnotationMetadata}. A proxied annotation is a proxy of an
+ * annotation instance, taking an annotation interface, but accessible
data is
+ * its {@link AnnotationMetadata}.
*
* @author LE QUOC CHUNG - mailto: <a
* href="mailto:
skydu...@yahoo.com">
skydu...@yahoo.com</a>
@@ -47,8 +48,8 @@
* @param obj
* desired original annotation instance.
* @param definition
- * the current {@link Definition} holding {@link AnnoMeta} of
- * original annotation instance.
+ * the current {@link Definition} holding
+ * {@link AnnotationMetadata} of original annotation instance.
* @return returns an proxied annotation
*/
public static Object createProxy(Object obj, Definition definition) {
@@ -64,13 +65,13 @@
}
/** The anno meta. */
- private AnnoMeta annoMeta;
+ private AnnotationMetadata annotationMetadata;
/** The definition. */
- private Definition definition;
+ private Definition definition;
/** The target. */
- private Object target = null;
+ private Object target = null;
/**
* Constructor.
@@ -84,8 +85,9 @@
this.target = obj;
this.definition = definition;
- this.annoMeta = (AnnoMeta) definition.getAnnoMeta().getMetadata(
- ((Annotation) target).annotationType());
+ this.annotationMetadata = (AnnotationMetadata) definition
+ .getAnnotationMetadata().getMetadata(
+ ((Annotation) target).annotationType());
}
/*
@@ -128,7 +130,8 @@
else if (method.getName().equals("annotationType")) {
return method.invoke(this.target, args);
}
- result = this.annoMeta.getMetadata(method.getName()).getValue();
+ result = this.annotationMetadata.getMetadata(method.getName())
+ .getValue();
return result;
}
@@ -140,7 +143,8 @@
@Override
public Metadata setValueOfAnnotation(String valueName, Object value) {
- Object resource = this.annoMeta.getMetadata(valueName).getValue();
+ Object resource = this.annotationMetadata.getMetadata(valueName)
+ .getValue();
if (resource.getClass().isArray()) {
if (!value.getClass().isArray()) {
throw new IllegalPropertyException("Setting value is invalid.");
@@ -149,8 +153,8 @@
value.getClass().getComponentType())) {
throw new IllegalPropertyException("Setting value is invalid.");
}
- return this.annoMeta.putMetaData(MetaDataFactory.createMetaData(
- valueName, value));
+ return this.annotationMetadata.putMetaData(MetaDataFactory
+ .createMetaData(valueName, value));
}
else {
if (ReflectUtils.isAnnotation(resource)) {
@@ -163,7 +167,7 @@
throw new IllegalPropertyException(
"Setting value is invalid.");
}
- return this.annoMeta.putMetaData(MetaDataFactory
+ return this.annotationMetadata.putMetaData(MetaDataFactory
.createMetaData(valueName, value));
}
else {
@@ -171,7 +175,7 @@
throw new IllegalPropertyException(
"Setting value is invalid.");
}
- return this.annoMeta.putMetaData(MetaDataFactory
+ return this.annotationMetadata.putMetaData(MetaDataFactory
.createMetaData(valueName, value));
}
}
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/reflection/metadata/Definition.java
Fri Aug 14 00:45:12 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/reflection/metadata/Definition.java
Thu Aug 27 01:41:53 2009
@@ -37,7 +37,7 @@
* {@link Method} or {@link Field} so as to provide adscititious
information for
* them. Key of <code>definition</code> is an object that is interpreted of
* <code>(Class, Method, Field, Annotation, ...)</code> and its value is an
- * corresponding {@link AnnoMeta} object that is generated by
+ * corresponding {@link AnnotationMetadata} object that is generated by
* <code>container</code>.
* <p>
* Moreover, it is extended from {@link AnnotatedElement} interface so it
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/reflection/metadata/DefinitionCore.java
Fri Aug 14 00:45:12 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/reflection/metadata/DefinitionCore.java
Thu Aug 27 01:41:53 2009
@@ -34,28 +34,29 @@
*/
public interface DefinitionCore extends MetadataControl {
/**
- * Creates {@link AnnoMeta annotation metadata} content.
+ * Creates {@link AnnotationMetadata annotation metadata} content.
*/
public void buildAnnoMeta();
/**
* Returns <b>true</b> if this {@link Definition definition} contains
given
- * {@link AnnoMeta}.
+ * {@link AnnotationMetadata}.
*
- * @param annoMeta
- * the {@link AnnoMeta annotation metadata} whose presence in
- * this {@link Definition definition} is to be tested.
+ * @param annotationMetadata
+ * the {@link AnnotationMetadata annotation metadata} whose
+ * presence in this {@link Definition definition} is to be
+ * tested.
* @return <b>true</b> if this {@link Definition definition} contains a
- * specified {@link AnnoMeta annotation metada}, <b>false</b>
- * otherwise.
+ * specified {@link AnnotationMetadata annotation metada},
+ * <b>false</b> otherwise.
*/
- public boolean containsMeta(AnnoMeta annoMeta);
+ public boolean containsMeta(AnnotationMetadata annotationMetadata);
/**
- * Returns current {@link AnnoMeta annotation metadata} of this
+ * Returns current {@link AnnotationMetadata annotation metadata} of this
* {@link Definition definition}
*/
- public AnnoMeta getAnnoMeta();
+ public AnnotationMetadata getAnnotationMetadata();
/**
* Returns a {@link Map map} containing all member {@link Definition
@@ -155,8 +156,8 @@
* Sets original annotations
* <p>
* <b>Note:</b> The invoking of this method will also execute creating of
- * {@link AnnoMeta} content by automate invoke {@link #buildAnnoMeta()}
- * method after all original annotations is setted.
+ * {@link AnnotationMetadata} content by automate invoke
+ * {@link #buildAnnoMeta()} method after all original annotations is
setted.
*
* @param originalAnnotations
* array of original annotations need to be set.
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/reflection/metadata/DefinitionCoreImpl.java
Fri Aug 14 00:45:12 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/reflection/metadata/DefinitionCoreImpl.java
Thu Aug 27 01:41:53 2009
@@ -42,20 +42,19 @@
*/
abstract class DefinitionCoreImpl extends MetadataController implements
IAnnoVisitable, DefinitionCore {
-
/** The Constant serialVersionUID. */
- private static final long serialVersionUID = -4913719040130848081L;
+ private static final long serialVersionUID = -4913719040130848081L;
/**
- * The {@link AnnoMeta} of current {@link Definition}. Its key is key of
- * {@link Definition} but its value is this {@link Definition}.
+ * The {@link AnnotationMetadata} of current {@link Definition}. Its key
is
+ * key of {@link Definition} but its value is this {@link Definition}.
* <p>
- * <b>Note:</b> This {@link AnnoMeta} object may be <b>null</b> if it is a
- * empty {@link AnnoMeta}. In case of this, this {@link Definition} is
- * interpreted of <code>object class</code> but corresponding class is not
- * annotated with any annotation.
+ * <b>Note:</b> This {@link AnnotationMetadata} object may be <b>null</b>
if
+ * it is a empty {@link AnnotationMetadata}. In case of this, this
+ * {@link Definition} is interpreted of <code>object class</code> but
+ * corresponding class is not annotated with any annotation.
*/
- AnnoMeta annoMeta = null;
+ AnnotationMetadata annotationMetadata = null;
/**
* containing {@link Definition} of {@link Constructor} objects in case
this
@@ -78,13 +77,13 @@
/**
* The array containing all original annotations of this {@link
Definition}
*/
- Annotation[] originalAnnotations;
+ Annotation[] originalAnnotations;
/**
* This array contains all {@link Definition} of parameters of method
which
* this {@link Definition} is interpreted of.
*/
- Definition[] parameterDefList = null;
+ Definition[] parameterDefList = null;
/**
* Constructor
@@ -118,9 +117,10 @@
throw new NullPointerException("Annotation List must not be null !");
}
else {
- this.annoMeta = MetaDataFactory.createAnnoMeta(this.key, this);
- this.value = this.annoMeta;
- visitor.visit(this.originalAnnotations, this.annoMeta);
+ this.annotationMetadata = MetaDataFactory.createAnnotationMetadata(
+ this.key, this);
+ this.value = this.annotationMetadata;
+ visitor.visit(this.originalAnnotations, this.annotationMetadata);
}
}
@@ -131,20 +131,22 @@
* (org.jgentleframework.core.reflection.metadata.AnnoMeta)
*/
@Override
- public boolean containsMeta(AnnoMeta annoMeta) {
-
- return this.getAnnoMeta().contains(annoMeta.getKey());
+ public boolean containsMeta(AnnotationMetadata annotationMetadata) {
+
+ return this.getAnnotationMetadata().contains(
+ annotationMetadata.getKey());
}
/*
* (non-Javadoc)
* @see
- *
org.jgentleframework.core.reflection.metadata.DefinitionCore#getAnnoMeta()
+ *
org.jgentleframework.reflection.metadata.DefinitionCore#getAnnotationMetadata
+ * ()
*/
@Override
- public AnnoMeta getAnnoMeta() {
-
- return annoMeta;
+ public AnnotationMetadata getAnnotationMetadata() {
+
+ return annotationMetadata;
}
/*
@@ -333,8 +335,10 @@
final int prime = 31;
int result = super.hashCode();
- result = prime * result
- + ((annoMeta == null) ? 0 : annoMeta.hashCode());
+ result = prime
+ * result
+ + ((annotationMetadata == null) ? 0 : annotationMetadata
+ .hashCode());
result = prime
* result
+ ((constructorDefList == null) ? 0 : constructorDefList
@@ -362,11 +366,11 @@
if (!(obj instanceof DefinitionCoreImpl))
return false;
final DefinitionCoreImpl other = (DefinitionCoreImpl) obj;
- if (annoMeta == null) {
- if (other.annoMeta != null)
+ if (annotationMetadata == null) {
+ if (other.annotationMetadata != null)
return false;
}
- else if (!annoMeta.equals(other.annoMeta))
+ else if (!annotationMetadata.equals(other.annotationMetadata))
return false;
if (constructorDefList == null) {
if (other.constructorDefList != null)
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/reflection/metadata/MetaDataFactory.java
Fri Aug 14 00:45:12 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/reflection/metadata/MetaDataFactory.java
Thu Aug 27 01:41:53 2009
@@ -32,7 +32,7 @@
*/
public abstract class MetaDataFactory {
/**
- * Create a new {@link Definition definition}
+ * Creates a new {@link Definition definition}
*
* @param key
* key of {@link Definition definition}
@@ -46,7 +46,7 @@
}
/**
- * Create a new {@link Definition definition}
+ * Creates a new {@link Definition definition}
*
* @param key
* key of {@link Definition definition}
@@ -63,59 +63,60 @@
}
/**
- * Create a new {@link AnnoMeta annotation metadata}
+ * Creates a new {@link AnnotationMetadata annotation metadata}
*
* @param key
- * key of {@link AnnoMeta annotation metadata}
+ * key of {@link AnnotationMetadata annotation metadata}
* @param value
- * value of {@link AnnoMeta annotation metadata}
+ * value of {@link AnnotationMetadata annotation metadata}
*/
- public static AnnoMeta createAnnoMeta(Object key, Object value) {
-
- return new AnnoMetaImpl(key, value);
+ public static AnnotationMetadata createAnnotationMetadata(Object key,
+ Object value) {
+
+ return new AnnotationMetadataImpl(key, value);
}
/**
- * Create a new {@link AnnoMeta annotation metadata}
+ * Creates a new {@link AnnotationMetadata annotation metadata}
*
* @param key
- * key of {@link AnnoMeta annotation metadata}
+ * key of {@link AnnotationMetadata annotation metadata}
* @param value
- * value of {@link AnnoMeta annotation metadata}
+ * value of {@link AnnotationMetadata annotation metadata}
* @param annoParents
- * annoMeta parents of {@link AnnoMeta annotation metadata}
need
- * to be created.
+ * annotationMetadata parents of {@link AnnotationMetadata
+ * annotation metadata} need to be created.
*/
- public static AnnoMeta createAnnoMeta(Object key, Object value,
- AnnoMeta annoParents) {
-
- return new AnnoMetaImpl(key, value, annoParents);
+ public static AnnotationMetadata createAnnotationMetadata(Object key,
+ Object value, AnnotationMetadata annoParents) {
+
+ return new AnnotationMetadataImpl(key, value, annoParents);
}
/**
- * Create a new {@link AnnoMeta annotation metadata}
+ * Creates a new {@link AnnotationMetadata annotation metadata}
*
* @param key
- * key of {@link AnnoMeta annotation metadata}
+ * key of {@link AnnotationMetadata annotation metadata}
* @param value
- * value of {@link AnnoMeta annotation metadata}
+ * value of {@link AnnotationMetadata annotation metadata}
* @param annoParents
- * annoMeta parents of {@link AnnoMeta annotation metadata}
need
- * to be created.
+ * annotationMetadata parents of {@link AnnotationMetadata
+ * annotation metadata} need to be created.
* @param name
* name of desired annotation metadata.
*/
- public static AnnoMeta createAnnoMeta(Object key, Object value,
- AnnoMeta annoParents, String name) {
-
- return new AnnoMetaImpl(key, value, annoParents, name);
+ public static AnnotationMetadata createAnnotationMetadata(Object key,
+ Object value, AnnotationMetadata annoParents, String name) {
+
+ return new AnnotationMetadataImpl(key, value, annoParents, name);
}
/**
- * Create a new {@link Metadata metadata}
+ * Creates a new {@link Metadata metadata}
*
* @param key
- * key of {@link AnnoMeta annotation metadata}
+ * key of {@link AnnotationMetadata annotation metadata}
*/
public static Metadata createMetaData(Object key) {
@@ -123,7 +124,7 @@
}
/**
- * Create a new {@link Metadata metadata}
+ * Creates a new {@link Metadata metadata}
*
* @param key
* key of {@link Metadata metadata}
=======================================
--- /trunk/JGentleProject/src/org/jgentleframework/utils/ReflectUtils.java
Fri Aug 14 00:45:12 2009
+++ /trunk/JGentleProject/src/org/jgentleframework/utils/ReflectUtils.java
Thu Aug 27 01:41:53 2009
@@ -36,7 +36,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jgentleframework.core.handling.DefinitionManager;
-import org.jgentleframework.reflection.metadata.AnnoMeta;
+import org.jgentleframework.reflection.metadata.AnnotationMetadata;
import org.jgentleframework.reflection.metadata.MetaDataFactory;
import sun.reflect.FieldAccessor;
@@ -57,15 +57,17 @@
private final static Log log = LogFactory.getLog(ReflectUtils.class);
/**
- * Creates {@link AnnoMeta} object.
+ * Creates {@link AnnotationMetadata} object.
*
* @param annos
- * annotation instance need to be create to {@link AnnoMeta}
+ * annotation instance need to be create to
+ * {@link AnnotationMetadata}
* @param container
- * the parrent {@link AnnoMeta} of returned {@link AnnoMeta}
+ * the parrent {@link AnnotationMetadata} of returned
+ * {@link AnnotationMetadata}
* @param definitionManager
* the {@link DefinitionManager} instance
- * @return AnnoMeta
+ * @return AnnotationMetadata
* @throws InvocationTargetException
* the invocation target exception
* @throws IllegalAccessException
@@ -73,16 +75,16 @@
* @throws IllegalArgumentException
* the illegal argument exception
*/
- public static AnnoMeta buildAnnoMeta(Annotation annos, AnnoMeta container,
- DefinitionManager definitionManager)
+ public static AnnotationMetadata buildAnnoMeta(Annotation annos,
+ AnnotationMetadata container, DefinitionManager definitionManager)
throws IllegalArgumentException, IllegalAccessException,
InvocationTargetException {
- AnnoMeta thisMeta = null;
+ AnnotationMetadata thisMeta = null;
Class<?> clazz = annos.annotationType();
Method[] methods = clazz.getDeclaredMethods();
- thisMeta = MetaDataFactory.createAnnoMeta(clazz, annos, container,
- clazz.toString());
+ thisMeta = MetaDataFactory.createAnnotationMetadata(clazz, annos,
+ container, clazz.toString());
if (methods.length > 0) {
for (Method obj : methods) {
Object value = null;
@@ -91,14 +93,14 @@
Metadata part = null;
part = MetaDataFactory.createMetaData(obj.getName(), value);
/*
- * Đưa list sub annoMeta vừa được tạo vào trong annoMeta hiện
- * hành
+ * Đưa list sub annotationMetadata vừa được tạo vào trong
+ * annotationMetadata hiện hành
*/
thisMeta.putMetaData(part);
}
}
/*
- * add annoMeta vào container (annoMeta cha chứ nó)
+ * add annotationMetadata vào container (annotationMetadata cha chứ nó)
*/
container.putMetaData(thisMeta);
return thisMeta;
@@ -421,11 +423,11 @@
* @return an {@link ArrayList} containing returned types if they exist,
* otherwise, returns an empty {@link ArrayList}.
*/
- public static ArrayList<Type> getAllGenericInterfaces(Class<?> clazz,
+ public static List<Type> getAllGenericInterfaces(Class<?> clazz,
boolean superClass) {
Assertor.notNull(clazz);
- ArrayList<Type> result = new ArrayList<Type>();
+ List<Type> result = new ArrayList<Type>();
for (Type type : clazz.getGenericInterfaces()) {
if (!result.contains(type)) {
int i = 0;
=======================================
--- /trunk/JGentleProject/src/org/samples/AnnoMetaTest.java Fri Aug 14
00:45:12 2009
+++ /trunk/JGentleProject/src/org/samples/AnnoMetaTest.java Thu Aug 27
01:41:53 2009
@@ -24,7 +24,7 @@
import org.jgentleframework.context.JGentle;
import org.jgentleframework.context.injecting.Provider;
import org.jgentleframework.core.handling.DefinitionManager;
-import org.jgentleframework.reflection.metadata.AnnoMeta;
+import org.jgentleframework.reflection.metadata.AnnotationMetadata;
import org.jgentleframework.reflection.metadata.Definition;
/**
@@ -43,9 +43,10 @@
defManager.loadDefinition(Client.class);
// Lấy ra thông tin definition
Definition def = defManager.getDefinition(Client.class);
- AnnoMeta root = def.getAnnoMeta();
- AnnoMeta annoMeta = (AnnoMeta) root.getMetadata(MyAnnotation.class);
- Metadata metadata = annoMeta.getMetadata("name");
+ AnnotationMetadata root = def.getAnnotationMetadata();
+ AnnotationMetadata annotationMetadata = (AnnotationMetadata) root
+ .getMetadata(MyAnnotation.class);
+ Metadata metadata = annotationMetadata.getMetadata("name");
System.out.println(metadata.getValue().toString());
}
}
=======================================
--- /trunk/JGentleProject/src/org/samples/PostProcessorTest.java Fri Aug 14
00:45:12 2009
+++ /trunk/JGentleProject/src/org/samples/PostProcessorTest.java Thu Aug 27
01:41:53 2009
@@ -29,7 +29,7 @@
import org.jgentleframework.reflection.AnnotationBeanException;
import org.jgentleframework.reflection.annohandler.AnnotationHandler;
import org.jgentleframework.reflection.annohandler.AnnotationPostProcessor;
-import org.jgentleframework.reflection.metadata.AnnoMeta;
+import org.jgentleframework.reflection.metadata.AnnotationMetadata;
import org.jgentleframework.utils.ReflectUtils;
/**
@@ -49,11 +49,11 @@
class MyAHR implements AnnotationHandler<TestAnno> {
@Override
- public AnnoMeta handleVisit(TestAnno annotation, AnnoMeta annoMeta,
+ public AnnotationMetadata handleVisit(TestAnno annotation,
AnnotationMetadata annotationMetadata,
DefinitionManager defManager) throws Exception {
if (annotation.value() == false) {
- return ReflectUtils.buildAnnoMeta(annotation, annoMeta, defManager);
+ return ReflectUtils.buildAnnoMeta(annotation, annotationMetadata,
defManager);
}
else {
// Thực thi diễn dịch
@@ -65,7 +65,7 @@
class MyAPP implements AnnotationPostProcessor<TestAnno>,
AnnotationHandler<TestAnno> {
@Override
- public void after(TestAnno anno, AnnoMeta parents, AnnoMeta annoMeta,
+ public void after(TestAnno anno, AnnotationMetadata parents,
AnnotationMetadata annotationMetadata,
Annotation[] listAnno, Object objConfig)
throws AnnotationBeanException {
@@ -74,21 +74,21 @@
}
@Override
- public void before(TestAnno anno, AnnoMeta parents, Annotation[] listAnno,
+ public void before(TestAnno anno, AnnotationMetadata parents,
Annotation[] listAnno,
Object objConfig) throws AnnotationBeanException {
System.out.println(anno + "is begun.");
}
@Override
- public void catchException(Exception ex, TestAnno anno, AnnoMeta parents,
- AnnoMeta annoMeta, Annotation[] listAnno, Object objConfig)
+ public void catchException(Exception ex, TestAnno anno,
AnnotationMetadata parents,
+ AnnotationMetadata annotationMetadata, Annotation[] listAnno, Object
objConfig)
throws AnnotationBeanException {
}
@Override
- public AnnoMeta handleVisit(TestAnno annotation, AnnoMeta annoMeta,
+ public AnnotationMetadata handleVisit(TestAnno annotation,
AnnotationMetadata annotationMetadata,
DefinitionManager defManager) throws Exception {
// TODO Auto-generated method stub