[jboss-cvs] JBossAS SVN: r85905 - in projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect: spi and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Mar 16 07:37:17 EDT 2009
Author: stalep
Date: 2009-03-16 07:37:16 -0400 (Mon, 16 Mar 2009)
New Revision: 85905
Modified:
projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeInfo.java
projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/MutableClassInfo.java
Log:
[JBREFLECT-49]
changed MutableClassInfo to override getDeclared...(.) methods defined
in ClassInfo.
Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeInfo.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeInfo.java 2009-03-16 11:37:05 UTC (rev 85904)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeInfo.java 2009-03-16 11:37:16 UTC (rev 85905)
@@ -43,11 +43,8 @@
import org.jboss.reflect.spi.AnnotationValue;
import org.jboss.reflect.spi.Body;
import org.jboss.reflect.spi.ClassInfo;
-import org.jboss.reflect.spi.ConstructorInfo;
-import org.jboss.reflect.spi.FieldInfo;
import org.jboss.reflect.spi.InsertBeforeJavassistBody;
import org.jboss.reflect.spi.InterfaceInfo;
-import org.jboss.reflect.spi.MethodInfo;
import org.jboss.reflect.spi.ModifierInfo;
import org.jboss.reflect.spi.MutableClassInfo;
import org.jboss.reflect.spi.MutableConstructorInfo;
@@ -82,19 +79,19 @@
private Map<SignatureKey, JavassistConstructorInfo> constructors = new ConcurrentHashMap<SignatureKey, JavassistConstructorInfo>();
/** The constructors */
- private ConstructorInfo[] constructorArray;
+ private MutableConstructorInfo[] constructorArray;
/** The fields */
private Map<String, JavassistFieldInfo> fields = new ConcurrentHashMap<String, JavassistFieldInfo>();
/** The fields */
- private FieldInfo[] fieldArray;
+ private MutableFieldInfo[] fieldArray;
/** The methods */
private Map<SignatureKey, JavassistMethodInfo> methods = new ConcurrentHashMap<SignatureKey, JavassistMethodInfo>();
/** The methods */
- private MethodInfo[] methodArray;
+ private MutableMethodInfo[] methodArray;
/** The package info */
private PackageInfo packageInfo;
@@ -221,13 +218,13 @@
throw new org.jboss.util.NotImplementedException("getGenericInterfaces");
}
- public ConstructorInfo[] getDeclaredConstructors()
+ public MutableConstructorInfo[] getDeclaredConstructors()
{
if (constructorArray == null)
{
CtConstructor[] declaredConstructors = ctClass.getDeclaredConstructors();
if (declaredConstructors == null || declaredConstructors.length == 0)
- constructorArray = new ConstructorInfo[0];
+ constructorArray = new MutableConstructorInfo[0];
else
{
synchronized (constructors)
@@ -235,19 +232,19 @@
for (int i = 0; i < declaredConstructors.length; ++i)
generateConstructorInfo(declaredConstructors[i]);
Collection<JavassistConstructorInfo> constructorCollection = constructors.values();
- constructorArray = constructorCollection.toArray(new ConstructorInfo[constructorCollection.size()]);
+ constructorArray = constructorCollection.toArray(new MutableConstructorInfo[constructorCollection.size()]);
}
}
}
return constructorArray;
}
- public ConstructorInfo getDeclaredConstructor(TypeInfo[] parameters)
+ public MutableConstructorInfo getDeclaredConstructor(TypeInfo[] parameters)
{
SignatureKey key = new SignatureKey(null, parameters);
synchronized (constructors)
{
- ConstructorInfo constructor = constructors.get(key);
+ MutableConstructorInfo constructor = constructors.get(key);
if (constructor != null)
return constructor;
}
@@ -256,11 +253,11 @@
return generateConstructorInfo(key);
}
- public FieldInfo getDeclaredField(String fieldName)
+ public MutableFieldInfo getDeclaredField(String fieldName)
{
synchronized (fields)
{
- FieldInfo field = fields.get(fieldName);
+ MutableFieldInfo field = fields.get(fieldName);
if (field != null)
return field;
}
@@ -279,13 +276,13 @@
}
}
- public FieldInfo[] getDeclaredFields()
+ public MutableFieldInfo[] getDeclaredFields()
{
if (fieldArray == null)
{
CtField[] declaredFields = ctClass.getDeclaredFields();
if (declaredFields == null || declaredFields.length == 0)
- fieldArray = new FieldInfo[0];
+ fieldArray = new MutableFieldInfo[0];
else
{
synchronized (fields)
@@ -293,19 +290,19 @@
for (int i = 0; i < declaredFields.length; ++i)
generateFieldInfo(declaredFields[i]);
Collection<JavassistFieldInfo> fieldCollection = fields.values();
- fieldArray = fieldCollection.toArray(new FieldInfo[fieldCollection.size()]);
+ fieldArray = fieldCollection.toArray(new MutableFieldInfo[fieldCollection.size()]);
}
}
}
return fieldArray;
}
- public MethodInfo getDeclaredMethod(String methodName, TypeInfo[] parameters)
+ public MutableMethodInfo getDeclaredMethod(String methodName, TypeInfo[] parameters)
{
SignatureKey key = new SignatureKey(methodName, parameters);
synchronized (methods)
{
- MethodInfo method = methods.get(key);
+ MutableMethodInfo method = methods.get(key);
if (method != null)
return method;
}
@@ -314,13 +311,13 @@
return generateMethodInfo(key);
}
- public MethodInfo[] getDeclaredMethods()
+ public MutableMethodInfo[] getDeclaredMethods()
{
if (methodArray == null)
{
CtMethod[] declaredMethods = ctClass.getDeclaredMethods();
if (declaredMethods == null || declaredMethods.length == 0)
- methodArray = new MethodInfo[0];
+ methodArray = new MutableMethodInfo[0];
else
{
synchronized (methods)
@@ -328,7 +325,7 @@
for (int i = 0; i < declaredMethods.length; ++i)
generateMethodInfo(declaredMethods[i]);
Collection<JavassistMethodInfo> methodCollection = methods.values();
- methodArray = methodCollection.toArray(new MethodInfo[methodCollection.size()]);
+ methodArray = methodCollection.toArray(new MutableMethodInfo[methodCollection.size()]);
}
}
}
@@ -473,7 +470,7 @@
* @param constructor the constructor
* @return the constructor info
*/
- protected ConstructorInfo generateConstructorInfo(CtConstructor constructor)
+ protected MutableConstructorInfo generateConstructorInfo(CtConstructor constructor)
{
try
{
@@ -501,7 +498,7 @@
* @param key the key
* @return the constructor info
*/
- protected ConstructorInfo generateConstructorInfo(SignatureKey key)
+ protected MutableConstructorInfo generateConstructorInfo(SignatureKey key)
{
CtClass[] params = getParameterTypes(key);
try
@@ -521,7 +518,7 @@
* @param field the field
* @return the field info
*/
- protected FieldInfo generateFieldInfo(CtField field)
+ protected MutableFieldInfo generateFieldInfo(CtField field)
{
JavassistFieldInfo info = new JavassistFieldInfo(factory, this, field);
synchronized (fields)
@@ -537,7 +534,7 @@
* @param key the key
* @return the method info
*/
- protected MethodInfo generateMethodInfo(SignatureKey key)
+ protected MutableMethodInfo generateMethodInfo(SignatureKey key)
{
CtClass[] params = getParameterTypes(key);
try
@@ -557,7 +554,7 @@
* @param method the method
* @return the method info
*/
- protected MethodInfo generateMethodInfo(CtMethod method)
+ protected MutableMethodInfo generateMethodInfo(CtMethod method)
{
try
{
@@ -581,7 +578,7 @@
* @param method the method
* @return the method info
*/
- protected MethodInfo generateMethodInfo(SignatureKey key, CtMethod method)
+ protected MutableMethodInfo generateMethodInfo(SignatureKey key, CtMethod method)
{
JavassistMethodInfo info = new JavassistMethodInfo(factory, this, method);
synchronized (methods)
Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/MutableClassInfo.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/MutableClassInfo.java 2009-03-16 11:37:05 UTC (rev 85904)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/MutableClassInfo.java 2009-03-16 11:37:16 UTC (rev 85905)
@@ -31,6 +31,52 @@
{
/**
+ * Get the declared method
+ *
+ * @param name the method name
+ * @param parameters the parameters
+ * @return the method info
+ */
+ MutableMethodInfo getDeclaredMethod(String name, TypeInfo[] parameters);
+
+ /**
+ * Get the declared methods
+ *
+ * @return the methods
+ */
+ MutableMethodInfo[] getDeclaredMethods();
+
+ /**
+ * Get the declared constructors
+ *
+ * @return the constructors
+ */
+ MutableConstructorInfo[] getDeclaredConstructors();
+
+ /**
+ * Get a declared constructor
+ *
+ * @param parameters the parameters
+ * @return the constructor
+ */
+ MutableConstructorInfo getDeclaredConstructor(TypeInfo[] parameters);
+
+ /**
+ * Get the declared field
+ *
+ * @param name the field name
+ * @return the field
+ */
+ MutableFieldInfo getDeclaredField(String name);
+
+ /**
+ * Get the declared fields
+ *
+ * @return the fields
+ */
+ MutableFieldInfo[] getDeclaredFields();
+
+ /**
* Compiles the code included in Body and returns a MutableMethodInfo representation of it.
* The Body must include the whole declaration of the method.
*
More information about the jboss-cvs-commits
mailing list