[jboss-cvs] JBossAS SVN: r94787 - in projects/jboss-reflect/trunk/src: main/java/org/jboss/joinpoint/plugins and 7 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Oct 13 16:09:11 EDT 2009
Author: flavia.rainone at jboss.com
Date: 2009-10-13 16:09:10 -0400 (Tue, 13 Oct 2009)
New Revision: 94787
Modified:
projects/jboss-reflect/trunk/src/main/java/org/jboss/beans/info/plugins/AbstractBeanInfoFactory.java
projects/jboss-reflect/trunk/src/main/java/org/jboss/beans/info/plugins/FieldFilter.java
projects/jboss-reflect/trunk/src/main/java/org/jboss/joinpoint/plugins/Config.java
projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/AnnotationInfoImpl.java
projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/ClassInfoImpl.java
projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/ConstructorInfoImpl.java
projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/EnumInfoImpl.java
projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/FieldInfoImpl.java
projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/InterfaceInfoImpl.java
projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/MethodInfoImpl.java
projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/introspection/IntrospectionTypeInfoFactoryImpl.java
projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/introspection/ReflectClassInfoImpl.java
projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/introspection/ReflectConstructorInfoImpl.java
projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/introspection/ReflectFieldInfoImpl.java
projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/introspection/ReflectMethodInfoImpl.java
projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/javassist/JavassistConstructorInfo.java
projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/javassist/JavassistFieldInfo.java
projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/javassist/JavassistMethodInfo.java
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/AnnotationInfo.java
projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/ClassInfo.java
projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/DelegateClassInfo.java
projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/MemberInfo.java
projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/ModifierInfo.java
projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/MutableClassInfo.java
projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/NumberInfo.java
projects/jboss-reflect/trunk/src/test/java/org/jboss/test/beaninfo/test/AbstractBeanInfoTest.java
projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/test/AbstractClassInfoTest.java
projects/jboss-reflect/trunk/src/test/java/org/jboss/test/plugins/javassist/JavassistMutableTypeInfoTestCase.java
projects/jboss-reflect/trunk/src/test/java/org/jboss/test/plugins/javassist/ModifierInfoTestCase.java
Log:
[JBREFLECT-59] ModifierInfo reverted from enum to interface.
Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/beans/info/plugins/AbstractBeanInfoFactory.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/beans/info/plugins/AbstractBeanInfoFactory.java 2009-10-13 20:06:03 UTC (rev 94786)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/beans/info/plugins/AbstractBeanInfoFactory.java 2009-10-13 20:09:10 UTC (rev 94787)
@@ -210,7 +210,7 @@
HashSet<ConstructorInfo> result = new HashSet<ConstructorInfo>();
for (int i = 0; i < cinfos.length; ++i)
{
- if (cinfos[i].getModifiers().isPublic() && cinfos[i].getModifiers().isStatic() == false)
+ if (cinfos[i].isPublic() && cinfos[i].isStatic() == false)
result.add(cinfos[i]);
}
return result;
@@ -233,7 +233,7 @@
{
for (int i = 0; i < minfos.length; ++i)
{
- if (result.contains(minfos[i]) == false && minfos[i].getModifiers().isPublic() && minfos[i].getModifiers().isStatic() == false && minfos[i].getModifiers().isVolatile() == false)
+ if (result.contains(minfos[i]) == false && minfos[i].isPublic() && minfos[i].isStatic() == false && minfos[i].isVolatile() == false)
result.add(minfos[i]);
}
}
Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/beans/info/plugins/FieldFilter.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/beans/info/plugins/FieldFilter.java 2009-10-13 20:06:03 UTC (rev 94786)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/beans/info/plugins/FieldFilter.java 2009-10-13 20:09:10 UTC (rev 94787)
@@ -59,7 +59,7 @@
{
public boolean useField(FieldInfo field)
{
- return field.getModifiers().isPublic();
+ return field.isPublic();
}
}
}
Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/joinpoint/plugins/Config.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/joinpoint/plugins/Config.java 2009-10-13 20:06:03 UTC (rev 94786)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/joinpoint/plugins/Config.java 2009-10-13 20:09:10 UTC (rev 94787)
@@ -420,7 +420,7 @@
{
if (name.equals(method.getName()) &&
equals(paramTypes, method.getParameterTypes()) &&
- (strict == false || (method.getModifiers().isStatic() == isStatic && method.getModifiers().isPublic() == isPublic)))
+ (strict == false || (method.isStatic() == isStatic && method.isPublic() == isPublic)))
return method;
}
}
Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/AnnotationInfoImpl.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/AnnotationInfoImpl.java 2009-10-13 20:06:03 UTC (rev 94786)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/AnnotationInfoImpl.java 2009-10-13 20:09:10 UTC (rev 94787)
@@ -57,7 +57,7 @@
* @param name the name
* @param modifiers the modifiers
*/
- public AnnotationInfoImpl(String name, ModifierInfo modifiers)
+ public AnnotationInfoImpl(String name, int modifiers)
{
super(name, modifiers);
}
@@ -88,7 +88,7 @@
}
@Override
- public ModifierInfo getModifiers()
+ public int getModifiers()
{
return modifiers;
}
Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/ClassInfoImpl.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/ClassInfoImpl.java 2009-10-13 20:06:03 UTC (rev 94786)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/ClassInfoImpl.java 2009-10-13 20:09:10 UTC (rev 94787)
@@ -22,6 +22,7 @@
package org.jboss.reflect.plugins;
import java.lang.reflect.Array;
+import java.lang.reflect.Modifier;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
@@ -78,7 +79,7 @@
protected String name;
/** The class modifiers */
- protected ModifierInfo modifiers;
+ protected int modifiers;
/** The interfaces */
protected InterfaceInfo[] interfaces = UNKNOWN_INTERFACES;
@@ -148,7 +149,7 @@
* @param name the class name
* @param modifiers the class modifiers
*/
- public ClassInfoImpl(String name, ModifierInfo modifiers)
+ public ClassInfoImpl(String name, int modifiers)
{
this.name = name;
this.modifiers = modifiers;
@@ -162,7 +163,7 @@
* @param interfaces the interfaces
* @param superclass the super class
*/
- public ClassInfoImpl(String name, ModifierInfo modifiers, InterfaceInfo[] interfaces,
+ public ClassInfoImpl(String name, int modifiers, InterfaceInfo[] interfaces,
ClassInfoImpl superclass)
{
this.name = name;
@@ -270,7 +271,7 @@
{
setAnnotatedElement(type);
if (type != null)
- modifiers = ModifierInfo.getNewModifier(type.getModifiers());
+ modifiers = type.getModifiers();
}
/**
@@ -439,24 +440,24 @@
return genericSuperclass;
}
- public ModifierInfo getModifiers()
+ public int getModifiers()
{
return modifiers;
}
public boolean isStatic()
{
- return (modifiers != null && modifiers.isStatic());
+ return Modifier.isStatic(modifiers);
}
public boolean isPublic()
{
- return (modifiers != null && modifiers.isPublic());
+ return Modifier.isPublic(modifiers);
}
public boolean isVolatile()
{
- return (modifiers != null && modifiers.isVolatile());
+ return Modifier.isVolatile(modifiers);
}
public String getName()
Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/ConstructorInfoImpl.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/ConstructorInfoImpl.java 2009-10-13 20:06:03 UTC (rev 94786)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/ConstructorInfoImpl.java 2009-10-13 20:09:10 UTC (rev 94787)
@@ -21,13 +21,13 @@
*/
package org.jboss.reflect.plugins;
+import java.lang.reflect.Modifier;
import java.util.Arrays;
import org.jboss.reflect.spi.AnnotationValue;
import org.jboss.reflect.spi.ClassInfo;
import org.jboss.reflect.spi.ConstructorInfo;
import org.jboss.reflect.spi.MethodInfo;
-import org.jboss.reflect.spi.ModifierInfo;
import org.jboss.reflect.spi.ParameterInfo;
import org.jboss.reflect.spi.TypeInfo;
import org.jboss.util.JBossStringBuilder;
@@ -57,7 +57,7 @@
protected ClassInfo[] exceptionTypes;
/** The modifiers */
- protected ModifierInfo modifiers;
+ protected int modifiers;
/** The hash code */
protected int hash;
@@ -79,7 +79,7 @@
* @param modifiers the modifiers
* @param declaring the declaring class
*/
- public ConstructorInfoImpl(AnnotationValue[] annotations, TypeInfo[] parameterTypes, AnnotationValue[][] parameterAnnotations, ClassInfo[] exceptionTypes, ModifierInfo modifiers, ClassInfo declaring)
+ public ConstructorInfoImpl(AnnotationValue[] annotations, TypeInfo[] parameterTypes, AnnotationValue[][] parameterAnnotations, ClassInfo[] exceptionTypes, int modifiers, ClassInfo declaring)
{
super(annotations);
if (parameterTypes == null)
@@ -112,7 +112,7 @@
* @param modifiers the modifiers
* @param declaring the declaring class
*/
- public ConstructorInfoImpl(AnnotationValue[] annotations, ParameterInfo[] parameters, ClassInfo[] exceptionTypes, ModifierInfo modifiers, ClassInfo declaring)
+ public ConstructorInfoImpl(AnnotationValue[] annotations, ParameterInfo[] parameters, ClassInfo[] exceptionTypes, int modifiers, ClassInfo declaring)
{
super(annotations);
if (parameters == null || parameters.length == 0)
@@ -156,24 +156,24 @@
return exceptionTypes;
}
- public ModifierInfo getModifiers()
+ public int getModifiers()
{
return modifiers;
}
public boolean isStatic()
{
- return (modifiers != null && modifiers.isStatic());
+ return Modifier.isStatic(modifiers);
}
public boolean isPublic()
{
- return (modifiers != null && modifiers.isPublic());
+ return Modifier.isPublic(modifiers);
}
public boolean isVolatile()
{
- return (modifiers != null && modifiers.isVolatile());
+ return Modifier.isVolatile(modifiers);
}
public Object newInstance(Object[] args) throws Throwable
Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/EnumInfoImpl.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/EnumInfoImpl.java 2009-10-13 20:06:03 UTC (rev 94786)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/EnumInfoImpl.java 2009-10-13 20:09:10 UTC (rev 94787)
@@ -57,7 +57,7 @@
* @param name the enumeration name
* @param modifiers the modifiers
*/
- public EnumInfoImpl(String name, ModifierInfo modifiers)
+ public EnumInfoImpl(String name, int modifiers)
{
super(name, modifiers);
}
Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/FieldInfoImpl.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/FieldInfoImpl.java 2009-10-13 20:06:03 UTC (rev 94786)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/FieldInfoImpl.java 2009-10-13 20:09:10 UTC (rev 94787)
@@ -21,10 +21,11 @@
*/
package org.jboss.reflect.plugins;
+import java.lang.reflect.Modifier;
+
import org.jboss.reflect.spi.AnnotationValue;
import org.jboss.reflect.spi.ClassInfo;
import org.jboss.reflect.spi.FieldInfo;
-import org.jboss.reflect.spi.ModifierInfo;
import org.jboss.reflect.spi.TypeInfo;
import org.jboss.util.JBossStringBuilder;
import org.jboss.util.NotImplementedException;
@@ -47,7 +48,7 @@
protected TypeInfo type;
/** The field modifier */
- protected ModifierInfo modifiers;
+ protected int modifiers;
/** The declaring class */
protected ClassInfo declaringClass;
@@ -71,7 +72,7 @@
* @param modifiers the field modifiers
* @param declaring the declaring class
*/
- public FieldInfoImpl(AnnotationValue[] annotations, String name, TypeInfo type, ModifierInfo modifiers, ClassInfo declaring)
+ public FieldInfoImpl(AnnotationValue[] annotations, String name, TypeInfo type, int modifiers, ClassInfo declaring)
{
super(annotations);
this.name = name;
@@ -96,24 +97,24 @@
return declaringClass;
}
- public ModifierInfo getModifiers()
+ public int getModifiers()
{
return modifiers;
}
public boolean isStatic()
{
- return (modifiers != null && modifiers.isStatic());
+ return Modifier.isStatic(modifiers);
}
public boolean isPublic()
{
- return (modifiers != null && modifiers.isPublic());
+ return Modifier.isPublic(modifiers);
}
public boolean isVolatile()
{
- return (modifiers != null && modifiers.isVolatile());
+ return Modifier.isVolatile(modifiers);
}
public Object get(Object target) throws Throwable
Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/InterfaceInfoImpl.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/InterfaceInfoImpl.java 2009-10-13 20:06:03 UTC (rev 94786)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/InterfaceInfoImpl.java 2009-10-13 20:09:10 UTC (rev 94787)
@@ -58,7 +58,7 @@
* @param name the interface name
* @param modifiers the interface modifier
*/
- public InterfaceInfoImpl(String name, ModifierInfo modifiers)
+ public InterfaceInfoImpl(String name, int modifiers)
{
super(name, modifiers);
}
@@ -70,7 +70,7 @@
* @param modifiers the interface modifier
* @param interfaces the interfaces
*/
- public InterfaceInfoImpl(String name, ModifierInfo modifiers, InterfaceInfo[] interfaces)
+ public InterfaceInfoImpl(String name, int modifiers, InterfaceInfo[] interfaces)
{
super(name, modifiers, interfaces, null);
}
Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/MethodInfoImpl.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/MethodInfoImpl.java 2009-10-13 20:06:03 UTC (rev 94786)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/MethodInfoImpl.java 2009-10-13 20:09:10 UTC (rev 94787)
@@ -21,12 +21,12 @@
*/
package org.jboss.reflect.plugins;
+import java.lang.reflect.Modifier;
import java.util.Arrays;
import org.jboss.reflect.spi.AnnotationValue;
import org.jboss.reflect.spi.ClassInfo;
import org.jboss.reflect.spi.MethodInfo;
-import org.jboss.reflect.spi.ModifierInfo;
import org.jboss.reflect.spi.ParameterInfo;
import org.jboss.reflect.spi.TypeInfo;
import org.jboss.util.JBossStringBuilder;
@@ -59,7 +59,7 @@
protected ClassInfo[] exceptionTypes;
/** The modifiers */
- protected ModifierInfo modifiers;
+ protected int modifiers;
/** The return type */
protected TypeInfo returnType;
@@ -86,7 +86,7 @@
* @param modifiers the modifiers
* @param declaring the declaring class
*/
- public MethodInfoImpl(AnnotationValue[] annotations, String name, TypeInfo returnType, TypeInfo[] parameterTypes, AnnotationValue[][] parameterAnnotations, ClassInfo[] exceptionTypes, ModifierInfo modifiers, ClassInfo declaring)
+ public MethodInfoImpl(AnnotationValue[] annotations, String name, TypeInfo returnType, TypeInfo[] parameterTypes, AnnotationValue[][] parameterAnnotations, ClassInfo[] exceptionTypes, int modifiers, ClassInfo declaring)
{
super(annotations);
this.name = name;
@@ -123,7 +123,7 @@
* @param modifiers the modifiers
* @param declaring the declaring class
*/
- public MethodInfoImpl(AnnotationValue[] annotations, String name, TypeInfo returnType, ParameterInfo[] parameters, ClassInfo[] exceptionTypes, ModifierInfo modifiers, ClassInfo declaring)
+ public MethodInfoImpl(AnnotationValue[] annotations, String name, TypeInfo returnType, ParameterInfo[] parameters, ClassInfo[] exceptionTypes, int modifiers, ClassInfo declaring)
{
super(annotations);
this.name = name;
@@ -179,24 +179,24 @@
return returnType;
}
- public ModifierInfo getModifiers()
+ public int getModifiers()
{
return modifiers;
}
public boolean isStatic()
{
- return (modifiers != null && modifiers.isStatic());
+ return Modifier.isStatic(modifiers);
}
public boolean isPublic()
{
- return (modifiers != null && modifiers.isPublic());
+ return Modifier.isPublic(modifiers);
}
public boolean isVolatile()
{
- return (modifiers != null && modifiers.isVolatile());
+ return Modifier.isVolatile(modifiers);
}
public Object invoke(Object target, Object[] args) throws Throwable
Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/introspection/IntrospectionTypeInfoFactoryImpl.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/introspection/IntrospectionTypeInfoFactoryImpl.java 2009-10-13 20:06:03 UTC (rev 94786)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/introspection/IntrospectionTypeInfoFactoryImpl.java 2009-10-13 20:09:10 UTC (rev 94787)
@@ -160,7 +160,7 @@
if (genericParameterTypes.length != parameterTypes.length)
genericParameterTypes = parameterTypes;
- infos[i] = new ReflectConstructorInfoImpl(annotations, getTypeInfos(genericParameterTypes), getParameterAnnotations(constructors[i].getParameterAnnotations()), getClassInfos(constructors[i].getGenericExceptionTypes()), ModifierInfo.getNewModifier(constructors[i].getModifiers()), (ClassInfo) getTypeInfo(constructors[i].getDeclaringClass()));
+ infos[i] = new ReflectConstructorInfoImpl(annotations, getTypeInfos(genericParameterTypes), getParameterAnnotations(constructors[i].getParameterAnnotations()), getClassInfos(constructors[i].getGenericExceptionTypes()), constructors[i].getModifiers(), (ClassInfo) getTypeInfo(constructors[i].getDeclaringClass()));
infos[i].setConstructor(constructors[i]);
}
}
@@ -184,7 +184,7 @@
for (int i = 0; i < fields.length; ++i)
{
AnnotationValue[] annotations = getAnnotations(fields[i]);
- infos[i] = new ReflectFieldInfoImpl(annotations, fields[i].getName(), getTypeInfo(fields[i].getGenericType()), ModifierInfo.getNewModifier(fields[i].getModifiers()), (ClassInfo) getTypeInfo(fields[i].getDeclaringClass()));
+ infos[i] = new ReflectFieldInfoImpl(annotations, fields[i].getName(), getTypeInfo(fields[i].getGenericType()), fields[i].getModifiers(), (ClassInfo) getTypeInfo(fields[i].getDeclaringClass()));
infos[i].setField(fields[i]);
}
@@ -209,7 +209,7 @@
for (int i = 0; i < methods.length; ++i)
{
AnnotationValue[] annotations = getAnnotations(methods[i]);
- infos[i] = new ReflectMethodInfoImpl(annotations, methods[i].getName(), getTypeInfo(methods[i].getGenericReturnType()), getTypeInfos(methods[i].getGenericParameterTypes()), getParameterAnnotations(methods[i].getParameterAnnotations()), getClassInfos(methods[i].getGenericExceptionTypes()), ModifierInfo.getNewModifier(methods[i].getModifiers()), (ClassInfo) getTypeInfo(methods[i].getDeclaringClass()));
+ infos[i] = new ReflectMethodInfoImpl(annotations, methods[i].getName(), getTypeInfo(methods[i].getGenericReturnType()), getTypeInfos(methods[i].getGenericParameterTypes()), getParameterAnnotations(methods[i].getParameterAnnotations()), getClassInfos(methods[i].getGenericExceptionTypes()), methods[i].getModifiers(), (ClassInfo) getTypeInfo(methods[i].getDeclaringClass()));
infos[i].setMethod(methods[i]);
}
return infos;
@@ -432,7 +432,7 @@
}
else if (clazz.isEnum())
{
- EnumInfoImpl enumInfoImpl = new EnumInfoImpl(clazz.getName(), ModifierInfo.getNewModifier(clazz.getModifiers()));
+ EnumInfoImpl enumInfoImpl = new EnumInfoImpl(clazz.getName(), clazz.getModifiers());
result = enumInfoImpl;
Field[] fields = clazz.getFields();
EnumConstantInfoImpl[] constants = new EnumConstantInfoImpl[fields.length];
@@ -446,7 +446,7 @@
}
else if (clazz.isAnnotation())
{
- result = new AnnotationInfoImpl(clazz.getName(), ModifierInfo.getNewModifier(clazz.getModifiers()));
+ result = new AnnotationInfoImpl(clazz.getName(), clazz.getModifiers());
Method[] methods = getDeclaredMethods(clazz);
AnnotationAttributeImpl[] atttributes = new AnnotationAttributeImpl[methods.length];
for (int i = 0 ; i < methods.length ; i++)
Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/introspection/ReflectClassInfoImpl.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/introspection/ReflectClassInfoImpl.java 2009-10-13 20:06:03 UTC (rev 94786)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/introspection/ReflectClassInfoImpl.java 2009-10-13 20:09:10 UTC (rev 94787)
@@ -23,7 +23,6 @@
import org.jboss.reflect.plugins.ClassInfoImpl;
import org.jboss.reflect.spi.InterfaceInfo;
-import org.jboss.reflect.spi.ModifierInfo;
import org.jboss.reflect.spi.TypeInfoFactory;
/**
@@ -62,7 +61,7 @@
* @param interfaces the interfaces
* @param superclass the super class
*/
- public ReflectClassInfoImpl(String name, ModifierInfo modifiers, InterfaceInfo[] interfaces,
+ public ReflectClassInfoImpl(String name, int modifiers, InterfaceInfo[] interfaces,
ReflectClassInfoImpl superclass)
{
super(name, modifiers, interfaces, superclass);
Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/introspection/ReflectConstructorInfoImpl.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/introspection/ReflectConstructorInfoImpl.java 2009-10-13 20:06:03 UTC (rev 94786)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/introspection/ReflectConstructorInfoImpl.java 2009-10-13 20:09:10 UTC (rev 94787)
@@ -28,7 +28,6 @@
import org.jboss.reflect.plugins.ConstructorInfoImpl;
import org.jboss.reflect.spi.AnnotationValue;
import org.jboss.reflect.spi.ClassInfo;
-import org.jboss.reflect.spi.ModifierInfo;
import org.jboss.reflect.spi.ParameterInfo;
import org.jboss.reflect.spi.TypeInfo;
@@ -63,7 +62,7 @@
* @param modifiers the modifiers
* @param declaring the declaring class
*/
- public ReflectConstructorInfoImpl(AnnotationValue[] annotations, TypeInfo[] parameterTypes, AnnotationValue[][] parameterAnnotations, ClassInfo[] exceptionTypes, ModifierInfo modifiers, ClassInfo declaring)
+ public ReflectConstructorInfoImpl(AnnotationValue[] annotations, TypeInfo[] parameterTypes, AnnotationValue[][] parameterAnnotations, ClassInfo[] exceptionTypes, int modifiers, ClassInfo declaring)
{
super(annotations, parameterTypes, parameterAnnotations, exceptionTypes, modifiers, declaring);
}
@@ -77,7 +76,7 @@
* @param modifiers the modifiers
* @param declaring the declaring class
*/
- public ReflectConstructorInfoImpl(AnnotationValue[] annotations, ParameterInfo[] parameters, ClassInfo[] exceptionTypes, ModifierInfo modifiers, ClassInfo declaring)
+ public ReflectConstructorInfoImpl(AnnotationValue[] annotations, ParameterInfo[] parameters, ClassInfo[] exceptionTypes, int modifiers, ClassInfo declaring)
{
super(annotations, parameters, exceptionTypes, modifiers, declaring);
}
Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/introspection/ReflectFieldInfoImpl.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/introspection/ReflectFieldInfoImpl.java 2009-10-13 20:06:03 UTC (rev 94786)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/introspection/ReflectFieldInfoImpl.java 2009-10-13 20:09:10 UTC (rev 94787)
@@ -33,7 +33,6 @@
import org.jboss.reflect.plugins.FieldInfoImpl;
import org.jboss.reflect.spi.AnnotationValue;
import org.jboss.reflect.spi.ClassInfo;
-import org.jboss.reflect.spi.ModifierInfo;
import org.jboss.reflect.spi.TypeInfo;
/**
@@ -70,7 +69,7 @@
* @param modifiers the field modifiers
* @param declaring the declaring class
*/
- public ReflectFieldInfoImpl(AnnotationValue[] annotations, String name, TypeInfo type, ModifierInfo modifiers, ClassInfo declaring)
+ public ReflectFieldInfoImpl(AnnotationValue[] annotations, String name, TypeInfo type, int modifiers, ClassInfo declaring)
{
super(annotations, name, type, modifiers, declaring);
}
Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/introspection/ReflectMethodInfoImpl.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/introspection/ReflectMethodInfoImpl.java 2009-10-13 20:06:03 UTC (rev 94786)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/introspection/ReflectMethodInfoImpl.java 2009-10-13 20:09:10 UTC (rev 94787)
@@ -24,16 +24,15 @@
import java.io.IOException;
import java.io.ObjectInputStream;
import java.lang.reflect.Method;
-import java.lang.reflect.ReflectPermission;
import java.lang.reflect.Modifier;
-import java.security.Permission;
+import java.lang.reflect.ReflectPermission;
import java.security.AccessController;
+import java.security.Permission;
import java.security.PrivilegedAction;
import org.jboss.reflect.plugins.MethodInfoImpl;
import org.jboss.reflect.spi.AnnotationValue;
import org.jboss.reflect.spi.ClassInfo;
-import org.jboss.reflect.spi.ModifierInfo;
import org.jboss.reflect.spi.ParameterInfo;
import org.jboss.reflect.spi.TypeInfo;
@@ -74,7 +73,7 @@
* @param modifiers the modifiers
* @param declaring the declaring class
*/
- public ReflectMethodInfoImpl(AnnotationValue[] annotations, String name, TypeInfo returnType, TypeInfo[] parameterTypes, AnnotationValue[][] parameterAnnotations, ClassInfo[] exceptionTypes, ModifierInfo modifiers, ClassInfo declaring)
+ public ReflectMethodInfoImpl(AnnotationValue[] annotations, String name, TypeInfo returnType, TypeInfo[] parameterTypes, AnnotationValue[][] parameterAnnotations, ClassInfo[] exceptionTypes, int modifiers, ClassInfo declaring)
{
super(annotations, name, returnType, parameterTypes, parameterAnnotations, exceptionTypes, modifiers, declaring);
}
@@ -90,7 +89,7 @@
* @param modifiers the modifiers
* @param declaring the declaring class
*/
- public ReflectMethodInfoImpl(AnnotationValue[] annotations, String name, TypeInfo returnType, ParameterInfo[] parameters, ClassInfo[] exceptionTypes, ModifierInfo modifiers, ClassInfo declaring)
+ public ReflectMethodInfoImpl(AnnotationValue[] annotations, String name, TypeInfo returnType, ParameterInfo[] parameters, ClassInfo[] exceptionTypes, int modifiers, ClassInfo declaring)
{
super(annotations, name, returnType, parameters, exceptionTypes, modifiers, declaring);
}
Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/javassist/JavassistConstructorInfo.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/javassist/JavassistConstructorInfo.java 2009-10-13 20:06:03 UTC (rev 94786)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/javassist/JavassistConstructorInfo.java 2009-10-13 20:09:10 UTC (rev 94787)
@@ -21,6 +21,7 @@
*/
package org.jboss.reflect.plugins.javassist;
+import java.lang.reflect.Modifier;
import java.util.Arrays;
import javassist.CannotCompileException;
@@ -50,6 +51,8 @@
* @version $Revision$
* @see MutableConstructorInfo
*/
+// TODO: review hierarchy structure. Shouldn't JavassistConstructorInfo extend ConstructorInfoImpl, just like
+// ReflectConstructorInfoImpl?
public class JavassistConstructorInfo extends JavassistAnnotatedParameterInfo implements MutableConstructorInfo
{
/** The serialVersionUID */
@@ -78,24 +81,24 @@
this.ctConstructor = ctConstructor;
}
- public ModifierInfo getModifiers()
+ public int getModifiers()
{
- return ModifierInfo.getNewModifier(ctConstructor.getModifiers());
+ return ctConstructor.getModifiers();
}
public boolean isPublic()
{
- return getModifiers().isPublic();
+ return Modifier.isPublic(ctConstructor.getModifiers());
}
public boolean isStatic()
{
- return getModifiers().isStatic();
+ return Modifier.isStatic(ctConstructor.getModifiers());
}
public boolean isVolatile()
{
- return getModifiers().isVolatile();
+ return Modifier.isVolatile(ctConstructor.getModifiers());
}
public ClassInfo getDeclaringClass()
Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/javassist/JavassistFieldInfo.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/javassist/JavassistFieldInfo.java 2009-10-13 20:06:03 UTC (rev 94786)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/javassist/JavassistFieldInfo.java 2009-10-13 20:09:10 UTC (rev 94787)
@@ -21,6 +21,8 @@
*/
package org.jboss.reflect.plugins.javassist;
+import java.lang.reflect.Modifier;
+
import org.jboss.reflect.plugins.AnnotationHelper;
import org.jboss.reflect.spi.AnnotationValue;
import org.jboss.reflect.spi.ClassInfo;
@@ -45,6 +47,8 @@
* @version $Revision$
* @see MutableFieldInfo
*/
+// TODO shouldn JavassistFieldInfo extend FieldInfoImpl just like
+// ReflectFieldInfoImpl?
public class JavassistFieldInfo extends JavassistAnnotatedInfo implements MutableFieldInfo
{
/** The serialVersionUID */
@@ -84,24 +88,24 @@
return ctField.getName();
}
- public ModifierInfo getModifiers()
+ public int getModifiers()
{
- return ModifierInfo.getNewModifier(ctField.getModifiers());
+ return ctField.getModifiers();
}
public boolean isPublic()
{
- return getModifiers().isPublic();
+ return Modifier.isPublic(getModifiers());
}
public boolean isStatic()
{
- return getModifiers().isStatic();
+ return Modifier.isStatic(getModifiers());
}
public boolean isVolatile()
{
- return getModifiers().isVolatile();
+ return Modifier.isVolatile(getModifiers());
}
public ClassInfo getDeclaringClass()
Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/javassist/JavassistMethodInfo.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/javassist/JavassistMethodInfo.java 2009-10-13 20:06:03 UTC (rev 94786)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/javassist/JavassistMethodInfo.java 2009-10-13 20:09:10 UTC (rev 94787)
@@ -21,6 +21,7 @@
*/
package org.jboss.reflect.plugins.javassist;
+import java.lang.reflect.Modifier;
import java.util.Arrays;
import javassist.CannotCompileException;
@@ -53,6 +54,8 @@
* @version $Revision$
* @see MutableMethodInfo
*/
+// TODO: review hierarchy structure. Shouldn't JavassistMethodInfo extend MethodInfoImpl, just like
+//ReflectMethodInfoImpl?
public class JavassistMethodInfo extends JavassistAnnotatedParameterInfo implements MutableMethodInfo
{
/** The serialVersionUID */
@@ -94,24 +97,24 @@
return typeInfo;
}
- public ModifierInfo getModifiers()
+ public int getModifiers()
{
- return ModifierInfo.getNewModifier(ctMethod.getModifiers());
+ return ctMethod.getModifiers();
}
public boolean isPublic()
{
- return getModifiers().isPublic();
+ return Modifier.isPublic(getModifiers());
}
public boolean isStatic()
{
- return getModifiers().isStatic();
+ return Modifier.isStatic(getModifiers());
}
public boolean isVolatile()
{
- return getModifiers().isVolatile();
+ return Modifier.isVolatile(getModifiers());
}
public ClassInfo[] getExceptionTypes()
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-10-13 20:06:03 UTC (rev 94786)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeInfo.java 2009-10-13 20:09:10 UTC (rev 94787)
@@ -23,6 +23,7 @@
import java.io.IOException;
import java.lang.reflect.Array;
+import java.lang.reflect.Modifier;
import java.util.Collection;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -43,7 +44,6 @@
import org.jboss.reflect.spi.Body;
import org.jboss.reflect.spi.ClassInfo;
import org.jboss.reflect.spi.InterfaceInfo;
-import org.jboss.reflect.spi.ModifierInfo;
import org.jboss.reflect.spi.MutableClassInfo;
import org.jboss.reflect.spi.MutableConstructorInfo;
import org.jboss.reflect.spi.MutableFieldInfo;
@@ -140,24 +140,24 @@
return getType().getSimpleName();
}
- public ModifierInfo getModifiers()
+ public int getModifiers()
{
- return ModifierInfo.getNewModifier(ctClass.getModifiers());
+ return ctClass.getModifiers();
}
public boolean isPublic()
{
- return getModifiers().isPublic();
+ return Modifier.isPublic(getModifiers());
}
public boolean isStatic()
{
- return getModifiers().isStatic();
+ return Modifier.isStatic(getModifiers());
}
public boolean isVolatile()
{
- return getModifiers().isVolatile();
+ return Modifier.isVolatile(getModifiers());
}
@Deprecated
@@ -847,14 +847,14 @@
}
}
- public MutableConstructorInfo createMutableConstructor(ModifierInfo modifier, String[] parameters,
+ public MutableConstructorInfo createMutableConstructor(int modifiers, String[] parameters,
String[] exceptions)
{
try
{
CtConstructor constructor = CtNewConstructor.make(JavassistUtil.toCtClass(parameters),
JavassistUtil.toCtClass(exceptions), ctClass);
- constructor.setModifiers(modifier.getModifiers());
+ constructor.setModifiers(modifiers);
return new JavassistConstructorInfo(factory, this, constructor);
}
catch (CannotCompileException e)
@@ -863,14 +863,14 @@
}
}
- public MutableConstructorInfo createMutableConstructor(ModifierInfo modifier, ClassInfo[] parameters,
+ public MutableConstructorInfo createMutableConstructor(int modifiers, ClassInfo[] parameters,
ClassInfo[] exceptions)
{
try
{
CtConstructor constructor = CtNewConstructor.make(JavassistUtil.toCtClass(parameters),
JavassistUtil.toCtClass(exceptions), ctClass);
- constructor.setModifiers(modifier.getModifiers());
+ constructor.setModifiers(modifiers);
return new JavassistConstructorInfo(factory, this, constructor);
}
catch (CannotCompileException e)
@@ -879,14 +879,14 @@
}
}
- public MutableConstructorInfo createMutableConstructor(ModifierInfo modifier, Body body, String[] parameters,
+ public MutableConstructorInfo createMutableConstructor(int modifiers, Body body, String[] parameters,
String[] exceptions)
{
try
{
CtConstructor constructor = CtNewConstructor.make(JavassistUtil.toCtClass(parameters),
JavassistUtil.toCtClass(exceptions), body.getBody(), ctClass);
- constructor.setModifiers(modifier.getModifiers());
+ constructor.setModifiers(modifiers);
return new JavassistConstructorInfo(factory, this, constructor);
}
catch (CannotCompileException e)
@@ -895,14 +895,14 @@
}
}
- public MutableConstructorInfo createMutableConstructor(ModifierInfo modifier, Body body, ClassInfo[] parameters,
+ public MutableConstructorInfo createMutableConstructor(int modifiers, Body body, ClassInfo[] parameters,
ClassInfo[] exceptions)
{
try
{
CtConstructor constructor = CtNewConstructor.make(JavassistUtil.toCtClass(parameters),
JavassistUtil.toCtClass(exceptions), body.getBody(), ctClass);
- constructor.setModifiers(modifier.getModifiers());
+ constructor.setModifiers(modifiers);
return new JavassistConstructorInfo(factory, this, constructor);
}
catch (CannotCompileException e)
@@ -911,12 +911,12 @@
}
}
- public MutableFieldInfo createMutableField(ModifierInfo modifier, String type, String fieldName)
+ public MutableFieldInfo createMutableField(int modifiers, String type, String fieldName)
{
try
{
CtField field = new CtField(JavassistUtil.toCtClass(type), fieldName, ctClass);
- field.setModifiers(modifier.getModifiers());
+ field.setModifiers(modifiers);
return new JavassistFieldInfo(factory, this, field);
}
catch (CannotCompileException e)
@@ -925,12 +925,12 @@
}
}
- public MutableFieldInfo createMutableField(ModifierInfo modifier, ClassInfo type, String fieldName)
+ public MutableFieldInfo createMutableField(int modifiers, ClassInfo type, String fieldName)
{
try
{
CtField field = new CtField(JavassistUtil.toCtClass(type), fieldName, ctClass);
- field.setModifiers(modifier.getModifiers());
+ field.setModifiers(modifiers);
return new JavassistFieldInfo(factory, this, field);
}
catch (CannotCompileException e)
@@ -952,12 +952,12 @@
}
}
- public MutableMethodInfo createMutableMethod(ModifierInfo modifier, String returnType, String methodName,
+ public MutableMethodInfo createMutableMethod(int modifiers, String returnType, String methodName,
String[] parameters, String[] exceptions)
{
try
{
- CtMethod method = CtNewMethod.make(modifier.getModifiers(), JavassistUtil.toCtClass(returnType),
+ CtMethod method = CtNewMethod.make(modifiers, JavassistUtil.toCtClass(returnType),
methodName, JavassistUtil.toCtClass(parameters), JavassistUtil.toCtClass(exceptions),
new InsertBeforeJavassistBody("{}").getBody(), ctClass);
return new JavassistMethodInfo(factory, this, method);
@@ -968,12 +968,12 @@
}
}
- public MutableMethodInfo createMutableMethod(ModifierInfo modifier, ClassInfo returnType, String methodName,
+ public MutableMethodInfo createMutableMethod(int modifiers, ClassInfo returnType, String methodName,
ClassInfo[] parameters, ClassInfo[] exceptions)
{
try
{
- CtMethod method = CtNewMethod.make(modifier.getModifiers(), JavassistUtil.toCtClass(returnType),
+ CtMethod method = CtNewMethod.make(modifiers, JavassistUtil.toCtClass(returnType),
methodName, JavassistUtil.toCtClass(parameters), JavassistUtil.toCtClass(exceptions),
new InsertBeforeJavassistBody("{}").getBody(), ctClass);
return new JavassistMethodInfo(factory, this, method);
@@ -984,12 +984,12 @@
}
}
- public MutableMethodInfo createMutableMethod(ModifierInfo modifier, String returnType, String methodName, Body body,
+ public MutableMethodInfo createMutableMethod(int modifiers, String returnType, String methodName, Body body,
String[] parameters, String[] exceptions)
{
try
{
- CtMethod method = CtNewMethod.make(modifier.getModifiers(), JavassistUtil.toCtClass(returnType),
+ CtMethod method = CtNewMethod.make(modifiers, JavassistUtil.toCtClass(returnType),
methodName, JavassistUtil.toCtClass(parameters), JavassistUtil.toCtClass(exceptions),
body.getBody(), ctClass);
return new JavassistMethodInfo(factory, this, method);
@@ -1000,12 +1000,12 @@
}
}
- public MutableMethodInfo createMutableMethod(ModifierInfo modifier, ClassInfo returnType, String methodName, Body body,
+ public MutableMethodInfo createMutableMethod(int modifiers, ClassInfo returnType, String methodName, Body body,
ClassInfo[] parameters, ClassInfo[] exceptions)
{
try
{
- CtMethod method = CtNewMethod.make(modifier.getModifiers(), JavassistUtil.toCtClass(returnType),
+ CtMethod method = CtNewMethod.make(modifiers, JavassistUtil.toCtClass(returnType),
methodName, JavassistUtil.toCtClass(parameters), JavassistUtil.toCtClass(exceptions),
body.getBody(), ctClass);
return new JavassistMethodInfo(factory, this, method);
Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/AnnotationInfo.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/AnnotationInfo.java 2009-10-13 20:06:03 UTC (rev 94786)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/AnnotationInfo.java 2009-10-13 20:09:10 UTC (rev 94787)
@@ -28,7 +28,7 @@
* @author <a href="mailto:bill at jboss.org">Bill Burke</a>
* @author <a href="mailto:adrian at jboss.org">Adrian Brock</a>
*/
-public interface AnnotationInfo extends InterfaceInfo
+public interface AnnotationInfo extends InterfaceInfo, ModifierInfo
{
/**
* Get the name
@@ -51,6 +51,4 @@
* @return the attribute
*/
AnnotationAttribute getAttribute(String name);
-
- ModifierInfo getModifiers();
}
Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/ClassInfo.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/ClassInfo.java 2009-10-13 20:06:03 UTC (rev 94786)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/ClassInfo.java 2009-10-13 20:09:10 UTC (rev 94787)
@@ -27,7 +27,7 @@
* @author <a href="mailto:bill at jboss.org">Bill Burke</a>
* @author <a href="mailto:adrian at jboss.org">Adrian Brock</a>
*/
-public interface ClassInfo extends AnnotatedInfo, TypeInfo
+public interface ClassInfo extends AnnotatedInfo, ModifierInfo, TypeInfo
{
/**
* Get the class name
@@ -165,11 +165,4 @@
* @return the package
*/
PackageInfo getPackage();
-
- /**
- * Get the modifiers.
- *
- * @return the modifiers
- */
- ModifierInfo getModifiers();
}
Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/DelegateClassInfo.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/DelegateClassInfo.java 2009-10-13 20:06:03 UTC (rev 94786)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/DelegateClassInfo.java 2009-10-13 20:09:10 UTC (rev 94787)
@@ -203,24 +203,24 @@
return delegate.isAnnotationPresent(annotationType);
}
- public ModifierInfo getModifiers()
+ public int getModifiers()
{
return delegate.getModifiers();
}
public boolean isPublic()
{
- return delegate.getModifiers().isPublic();
+ return delegate.isPublic();
}
public boolean isStatic()
{
- return delegate.getModifiers().isStatic();
+ return delegate.isStatic();
}
public boolean isVolatile()
{
- return delegate.getModifiers().isVolatile();
+ return delegate.isVolatile();
}
public Object convertValue(Object value) throws Throwable
Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/MemberInfo.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/MemberInfo.java 2009-10-13 20:06:03 UTC (rev 94786)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/MemberInfo.java 2009-10-13 20:09:10 UTC (rev 94787)
@@ -27,7 +27,7 @@
* @author <a href="mailto:bill at jboss.org">Bill Burke</a>
* @author <a href="mailto:adrian at jboss.org">Adrian Brock</a>
*/
-public interface MemberInfo
+public interface MemberInfo extends ModifierInfo
{
/**
* Get the declaring class
@@ -35,6 +35,4 @@
* @return the declaring class
*/
ClassInfo getDeclaringClass();
-
- ModifierInfo getModifiers();
}
Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/ModifierInfo.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/ModifierInfo.java 2009-10-13 20:06:03 UTC (rev 94786)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/ModifierInfo.java 2009-10-13 20:09:10 UTC (rev 94787)
@@ -30,223 +30,86 @@
*
* @author <a href="mailto:adrian at jboss.org">Adrian Brock</a>
*/
-public enum ModifierInfo
+public interface ModifierInfo
{
/** Final */
- FINAL(Modifier.FINAL),
+ public static final int FINAL = Modifier.FINAL;
/** Static */
- STATIC(Modifier.STATIC),
+ public static final int STATIC = Modifier.STATIC;
/** Abstract */
- ABSTRACT(Modifier.ABSTRACT),
+ public static final int ABSTRACT = Modifier.ABSTRACT;
/** Public */
- PUBLIC(Modifier.PUBLIC),
+ public static final int PUBLIC = Modifier.PUBLIC;
/** Protected */
- PROTECTED(Modifier.PROTECTED),
+ public static final int PROTECTED = Modifier.PROTECTED;
/** Package */
- PACKAGE(0),
+ public static final int PACKAGE = 0;
/** Private */
- PRIVATE(Modifier.PRIVATE),
+ public static final int PRIVATE = Modifier.PRIVATE;
/** A constant */
- CONSTANT(STATIC.getModifiers() + FINAL.getModifiers()),
+ public static final int CONSTANT = STATIC + FINAL;
/** A public constant */
- PUBLIC_CONSTANT(PUBLIC.getModifiers() + CONSTANT.getModifiers()),
+ public static final int PUBLIC_CONSTANT = PUBLIC + CONSTANT;
/** A protected constant */
- PROTECTED_CONSTANT(PROTECTED.getModifiers() + CONSTANT.getModifiers()),
+ public static final int PROTECTED_CONSTANT = PROTECTED + CONSTANT;
/** A package constant */
-// PACKAGE_CONSTANT(CONSTANT.getModifiers()),
+ public static final int PACKAGE_CONSTANT = CONSTANT;
/** A private constant */
- PRIVATE_CONSTANT(PRIVATE.getModifiers() + CONSTANT.getModifiers()),
+ public static final int PRIVATE_CONSTANT = PRIVATE + CONSTANT;
/** Public Static */
- PUBLIC_STATIC(PUBLIC.getModifiers() + STATIC.getModifiers()),
+ public static final int PUBLIC_STATIC = PUBLIC + STATIC;
/** Protected Static */
- PROTECTED_STATIC(PROTECTED.getModifiers() + STATIC.getModifiers()),
+ public static final int PROTECTED_STATIC = PROTECTED + STATIC;
/** Package Static */
-// PACKAGE_STATIC(STATIC.getModifiers()),
+ public static final int PACKAGE_STATIC = STATIC;
/** Private Static */
- PRIVATE_STATIC(PRIVATE.getModifiers() + STATIC.getModifiers()),
+ public static final int PRIVATE_STATIC = PRIVATE + STATIC;
/** Public Abstract */
- PUBLIC_ABSTRACT(PUBLIC.getModifiers() + ABSTRACT.getModifiers()),
+ public static final int PUBLIC_ABSTRACT = PUBLIC + ABSTRACT;
/** Protected Abstract */
- PROTECTED_ABSTRACT(PROTECTED.getModifiers() + ABSTRACT.getModifiers()),
+ public static final int PROTECTED_ABSTRACT = PROTECTED + ABSTRACT;
/** Package Abstract */
- PACKAGE_ABSTRACT(ABSTRACT.getModifiers()),
-
- PUBLIC_FINAL(PUBLIC.getModifiers() + FINAL.getModifiers()),
-
- PROTECTED_FINAL(PROTECTED.getModifiers() + FINAL.getModifiers()),
-
- PRIVATE_FINAL(PRIVATE.getModifiers() + FINAL.getModifiers()),
+ public static final int PACKAGE_ABSTRACT = ABSTRACT;
- PUBLIC_FINAL_ABSTRACT(PUBLIC_FINAL.getModifiers() + ABSTRACT.getModifiers()),
-
- PROTECTED_FINAL_ABSTRACT(PROTECTED_FINAL.getModifiers() + ABSTRACT.getModifiers()),
-
- PRIVATE_FINAL_ABSTRACT(PRIVATE_FINAL.getModifiers() + ABSTRACT.getModifiers()),
-
- /** Volatile */
- VOLATILE(Modifier.VOLATILE),
-
- PUBLIC_VOLATILE(PUBLIC.getModifiers() + VOLATILE.getModifiers()),
-
- PROTECTED_VOLATILE(PROTECTED.getModifiers() + VOLATILE.getModifiers()),
-
- PRIVATE_VOLATILE(PRIVATE.getModifiers() + VOLATILE.getModifiers()),
-
- SYNCHRONIZED(Modifier.SYNCHRONIZED),
-
- PUBLIC_SYNCHRONIZED(PUBLIC.getModifiers() + SYNCHRONIZED.getModifiers()),
-
- PROTECTED_SYNCHRONIZED(PROTECTED.getModifiers() + SYNCHRONIZED.getModifiers()),
-
- PRIVATE_SYNCHRONIZED(PRIVATE.getModifiers() + SYNCHRONIZED.getModifiers()),
-
- INTERFACE(Modifier.INTERFACE),
- PUBLIC_INTERFACE(PUBLIC.getModifiers() + INTERFACE.getModifiers()),
- PROTECTED_INTERFACE(PROTECTED.getModifiers() + INTERFACE.getModifiers()),
- PRIVATE_INTERFACE(PRIVATE.getModifiers() + INTERFACE.getModifiers()),
-
- PUBLIC_ABSTRACT_INTERFACE(PUBLIC_ABSTRACT.getModifiers() + INTERFACE.getModifiers()),
- PROTECTED_ABSTRACT_INTERFACE(PROTECTED_ABSTRACT.getModifiers() + INTERFACE.getModifiers()),
-
-
- NATIVE(Modifier.NATIVE),
-
- PUBLIC_NATIVE(PUBLIC.getModifiers() + NATIVE.getModifiers()),
-
- PROTECTED_NATIVE(PROTECTED.getModifiers() + NATIVE.getModifiers()),
-
- PRIVATE_NATIVE(PRIVATE.getModifiers() + NATIVE.getModifiers()),
-
- PUBLIC_FINAL_NATIVE(PUBLIC_FINAL.getModifiers() + NATIVE.getModifiers()),
- PROTECTED_FINAL_NATIVE(PROTECTED_FINAL.getModifiers() + NATIVE.getModifiers()),
- PRIVATE_FINAL_NATIVE(PRIVATE_FINAL.getModifiers() + NATIVE.getModifiers()),
- PUBLIC_STATIC_NATIVE(PUBLIC_STATIC.getModifiers() + NATIVE.getModifiers()),
- PROTECTED_STATIC_NATIVE(PROTECTED_STATIC.getModifiers() + NATIVE.getModifiers()),
- PRIVATE_STATIC_NATIVE(PRIVATE_STATIC.getModifiers() + NATIVE.getModifiers()),
-
- STRICTH(Modifier.STRICT),
-
- TRANSIENT(Modifier.TRANSIENT),
- PUBLIC_TRANSIENT(PUBLIC.getModifiers() + TRANSIENT.getModifiers()),
- PROTECTED_TRANSIENT(PROTECTED.getModifiers() + TRANSIENT.getModifiers()),
- PRIVATE_TRANSIENT(PRIVATE.getModifiers() + TRANSIENT.getModifiers()),
-
- PUBLIC_STATIC_TRANSIENT(PUBLIC_STATIC.getModifiers() + TRANSIENT.getModifiers()),
- PROTECTED_STATIC_TRANSIENT(PROTECTED_STATIC.getModifiers() + TRANSIENT.getModifiers()),
- PRIVATE_STATIC_TRANSIENT(PRIVATE_STATIC.getModifiers() + TRANSIENT.getModifiers()),
-
- SYNTHETIC(0x00001000),
- PUBLIC_SYNTHETIC(PUBLIC.getModifiers() + SYNTHETIC.getModifiers()),
- PROTECTED_SYNTHETIC(PROTECTED.getModifiers() + SYNTHETIC.getModifiers()),
- PRIVATE_SYNTHETIC(PRIVATE.getModifiers() + SYNTHETIC.getModifiers()),
-
- PUBLIC_CONSTANT_SYNTHETIC(PUBLIC_CONSTANT.getModifiers() + SYNTHETIC.getModifiers()),
- PROTECTED_CONSTANT_SYNTHETIC(PROTECTED_CONSTANT.getModifiers() + SYNTHETIC.getModifiers()),
- PRIVATE_CONSTANT_SYNTHETIC(PRIVATE_CONSTANT.getModifiers() + SYNTHETIC.getModifiers()),
-
- PUBLIC_VOLATILE_SYNTHETIC(PUBLIC_VOLATILE.getModifiers() + SYNTHETIC.getModifiers()),
- PROTECTED_VOLATILE_SYNTHETIC(PROTECTED_VOLATILE.getModifiers() + SYNTHETIC.getModifiers()),
- PRIVATE_VOLATILE_SYNTHETIC(PRIVATE_VOLATILE.getModifiers() + SYNTHETIC.getModifiers()),
-
-
- ANNOTATION(0x00002000),
- PUBLIC_ANNOTATION(PUBLIC.getModifiers() + ANNOTATION.getModifiers()),
- PROTECTED_ANNOTATION(PROTECTED.getModifiers() + ANNOTATION.getModifiers()),
- PRIVATE_ANNOTATION(PRIVATE.getModifiers() + ANNOTATION.getModifiers()),
-
- PUBLIC_ABSTRACT_ANNOTATION(PUBLIC_ABSTRACT.getModifiers() + ANNOTATION.getModifiers()),
- PROTECTED_ABSTRACT_ANNOTATION(PROTECTED_ABSTRACT.getModifiers() + ANNOTATION.getModifiers()),
-
- PUBLIC_INTERFACE_ANNOTATION(PUBLIC_INTERFACE.getModifiers() + ANNOTATION.getModifiers()),
- PROTECTED_INTERFACE_ANNOTATION(PROTECTED_INTERFACE.getModifiers() + ANNOTATION.getModifiers()),
-
- PUBLIC_ABSTRACT_INTERFACE_ANNOTATION(PUBLIC_ABSTRACT_INTERFACE.getModifiers() + ANNOTATION.getModifiers()),
- PROTECTED_ABSTRACT_INTERFACE_ANNOTATION(PROTECTED_ABSTRACT_INTERFACE.getModifiers() + ANNOTATION.getModifiers()),
-
-
- ENUM(0x00004000),
- PUBLIC_ENUM(PUBLIC.getModifiers() + ENUM.getModifiers()),
- PROTECTED_ENUM(PROTECTED.getModifiers() + ENUM.getModifiers()),
- PRIVATE_ENUM(PRIVATE.getModifiers() +ENUM.getModifiers()),
-
- PUBLIC_CONSTANT_ENUM(PUBLIC_CONSTANT.getModifiers() + ENUM.getModifiers()),
- PROTECTED_CONSTANT_ENUM(PROTECTED_CONSTANT.getModifiers() + ENUM.getModifiers()),
- PRIVATE_CONSTANT_ENUM(PRIVATE_CONSTANT.getModifiers() +ENUM.getModifiers()),
-
- PUBLIC_FINAL_ENUM(PUBLIC_FINAL.getModifiers() + ENUM.getModifiers()),
- PROTECTED_FINAL_ENUM(PROTECTED_FINAL.getModifiers() + ENUM.getModifiers()),
- PRIVATE_FINAL_ENUM(PRIVATE_FINAL.getModifiers() +ENUM.getModifiers()),
-
-
- ;
-
- private final int modifier;
-
- ModifierInfo(int modifier)
- {
- this.modifier = modifier;
- }
-
/**
* Get the modifiers
*
* @return the modifiers
*/
- public int getModifiers()
- {
- return modifier;
- }
+ public int getModifiers();
- public boolean isPublic()
- {
- return (this.name().startsWith("PUBLIC"));
- }
+ public boolean isPublic();
/**
* Whether it is static
*
* @return true when static
*/
- public boolean isStatic()
- {
- return (this.name().contains("STATIC"));
- }
+ public boolean isStatic();
/**
* Whether it is volatile
*
* @return true if volatile
*/
- public boolean isVolatile()
- {
- return (this.name().contains("VOLATILE"));
- }
-
- public static ModifierInfo getNewModifier(int modifiers)
- {
- for(ModifierInfo modifier : values())
- if(modifier.getModifiers() == modifiers)
- return modifier;
-
- throw new RuntimeException("Couldnt find Modifier for: "+modifiers);
- }
-}
+ public boolean isVolatile();
+}
\ No newline at end of file
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-10-13 20:06:03 UTC (rev 94786)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/MutableClassInfo.java 2009-10-13 20:09:10 UTC (rev 94787)
@@ -125,27 +125,27 @@
/**
* Compiles an empty method with the signature given by the params.
*
- * @param modifier
+ * @param modifiers
* @param returnType
* @param name
* @param parameters
* @param exceptions
* @return
*/
- MutableMethodInfo createMutableMethod(ModifierInfo modifier, String returnType,
+ MutableMethodInfo createMutableMethod(int modifiers, String returnType,
String name, String[] parameters, String[] exceptions);
/**
* Compiles an empty method with the signature given by the params.
*
- * @param modifier
+ * @param modifiers
* @param returnType
* @param name
* @param parameters
* @param exceptions
* @return
*/
- MutableMethodInfo createMutableMethod(ModifierInfo modifier, ClassInfo returnType,
+ MutableMethodInfo createMutableMethod(int modifiers, ClassInfo returnType,
String name, ClassInfo[] parameters, ClassInfo[] exceptions);
@@ -153,7 +153,7 @@
* Compile a method with the signature and body given by the params.
* Note that the source code of the body must be surrounded by <code>{}</code>.
*
- * @param modifier
+ * @param modifiers
* @param returnType
* @param name
* @param body
@@ -161,7 +161,7 @@
* @param exceptions
* @return
*/
- MutableMethodInfo createMutableMethod(ModifierInfo modifier, String returnType, String name,
+ MutableMethodInfo createMutableMethod(int modifiers, String returnType, String name,
Body body, String[] parameters, String[] exceptions);
@@ -169,7 +169,7 @@
* Compile a method with the signature and body given by the params.
* Note that the source code of the body must be surrounded by <code>{}</code>.
*
- * @param modifier
+ * @param modifiers
* @param returnType
* @param name
* @param body
@@ -177,7 +177,7 @@
* @param exceptions
* @return
*/
- MutableMethodInfo createMutableMethod(ModifierInfo modifier, ClassInfo returnType, String name,
+ MutableMethodInfo createMutableMethod(int modifiers, ClassInfo returnType, String name,
Body body, ClassInfo[] parameters, ClassInfo[] exceptions);
@@ -194,70 +194,70 @@
/**
* Creates an emptry constructor with params given.
*
- * @param modifier
+ * @param modifiers
* @param parameters
* @param exceptions
* @return
*/
- MutableConstructorInfo createMutableConstructor(ModifierInfo modifier, String[] parameters,
+ MutableConstructorInfo createMutableConstructor(int modifiers, String[] parameters,
String[] exceptions);
/**
* Creates an emptry constructor with params given.
*
- * @param modifier
+ * @param modifiers
* @param parameters
* @param exceptions
* @return
*/
- MutableConstructorInfo createMutableConstructor(ModifierInfo modifier, ClassInfo[] parameters,
+ MutableConstructorInfo createMutableConstructor(int modifiers, ClassInfo[] parameters,
ClassInfo[] exceptions);
/**
* Create a constructor with the params given.
* Note that the source text of the Body must be surrounded by <code>{}</code>.
*
- * @param modifier
+ * @param modifiers
* @param body
* @param parameters
* @param exceptions
* @return
*/
- MutableConstructorInfo createMutableConstructor(ModifierInfo modifier, Body body,
+ MutableConstructorInfo createMutableConstructor(int modifiers, Body body,
String[] parameters, String[] exceptions);
/**
* Create a constructor with the params given.
* Note that the source text of the Body must be surrounded by <code>{}</code>.
*
- * @param modifier
+ * @param modifiers
* @param body
* @param parameters
* @param exceptions
* @return
*/
- MutableConstructorInfo createMutableConstructor(ModifierInfo modifier, Body body,
+ MutableConstructorInfo createMutableConstructor(int modifiers, Body body,
ClassInfo[] parameters, ClassInfo[] exceptions);
/**
* Create a field connected to this class with the params given.
*
- * @param modifier
+ * @param modifiers
* @param type
* @param name
* @return
*/
- MutableFieldInfo createMutableField(ModifierInfo modifier, String type, String name);
+ MutableFieldInfo createMutableField(int modifiers, String type, String name);
/**
* Create a field connected to this class with the params given.
*
- * @param modifier
+ * @param modifiers
* @param type
* @param name
* @return
*/
- MutableFieldInfo createMutableField(ModifierInfo modifier, ClassInfo type, String name);
+ MutableFieldInfo createMutableField(int modifiers, ClassInfo type, String name);
/**
* Add a method
Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/NumberInfo.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/NumberInfo.java 2009-10-13 20:06:03 UTC (rev 94786)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/spi/NumberInfo.java 2009-10-13 20:09:10 UTC (rev 94787)
@@ -270,24 +270,24 @@
return delegate.isAnnotationPresent(annotationType);
}
- public ModifierInfo getModifiers()
+ public int getModifiers()
{
return delegate.getModifiers();
}
public boolean isPublic()
{
- return delegate.getModifiers().isPublic();
+ return delegate.isPublic();
}
public boolean isStatic()
{
- return delegate.getModifiers().isStatic();
+ return delegate.isStatic();
}
public boolean isVolatile()
{
- return delegate.getModifiers().isVolatile();
+ return delegate.isVolatile();
}
@Override
Modified: projects/jboss-reflect/trunk/src/test/java/org/jboss/test/beaninfo/test/AbstractBeanInfoTest.java
===================================================================
--- projects/jboss-reflect/trunk/src/test/java/org/jboss/test/beaninfo/test/AbstractBeanInfoTest.java 2009-10-13 20:06:03 UTC (rev 94786)
+++ projects/jboss-reflect/trunk/src/test/java/org/jboss/test/beaninfo/test/AbstractBeanInfoTest.java 2009-10-13 20:09:10 UTC (rev 94787)
@@ -34,8 +34,8 @@
import org.jboss.beans.info.plugins.DefaultPropertyInfo;
import org.jboss.beans.info.plugins.FieldPropertyInfo;
-import org.jboss.beans.info.plugins.SetterAndFieldPropertyInfo;
import org.jboss.beans.info.plugins.GetterAndFieldPropertyInfo;
+import org.jboss.beans.info.plugins.SetterAndFieldPropertyInfo;
import org.jboss.beans.info.spi.BeanAccessMode;
import org.jboss.beans.info.spi.BeanInfo;
import org.jboss.beans.info.spi.PropertyInfo;
@@ -46,12 +46,11 @@
import org.jboss.reflect.spi.AnnotationValue;
import org.jboss.reflect.spi.ClassInfo;
import org.jboss.reflect.spi.ConstructorInfo;
+import org.jboss.reflect.spi.FieldInfo;
import org.jboss.reflect.spi.MethodInfo;
-import org.jboss.reflect.spi.ModifierInfo;
import org.jboss.reflect.spi.PrimitiveInfo;
import org.jboss.reflect.spi.TypeInfo;
import org.jboss.reflect.spi.TypeInfoFactory;
-import org.jboss.reflect.spi.FieldInfo;
import org.jboss.test.classinfo.test.AbstractClassInfoTest;
/**
@@ -98,7 +97,7 @@
int i = 0;
for (Class<?> c : paramClasses)
paramTypes[i++] = factory.getTypeInfo(c);
- ConstructorInfo c = new ConstructorInfoImpl(null, paramTypes, paramAnnotations, null, ModifierInfo.getNewModifier(constructor.getModifiers()), classInfo);
+ ConstructorInfo c = new ConstructorInfoImpl(null, paramTypes, paramAnnotations, null, constructor.getModifiers(), classInfo);
expected.add(c);
}
@@ -135,7 +134,7 @@
for (Class<?> c : paramClasses)
paramTypes[i++] = factory.getTypeInfo(c);
ClassInfo classInfo = (ClassInfo) factory.getTypeInfo(method.getDeclaringClass());
- MethodInfo m = new MethodInfoImpl(null, method.getName(), returnType, paramTypes, paramAnnotations, null, ModifierInfo.getNewModifier(method.getModifiers()), classInfo);
+ MethodInfo m = new MethodInfoImpl(null, method.getName(), returnType, paramTypes, paramAnnotations, null, method.getModifiers(), classInfo);
expected.add(m);
}
@@ -275,7 +274,7 @@
TypeInfo type = factory.getTypeInfo(getter.getGenericReturnType());
ClassInfo declaringType = (ClassInfo) factory.getTypeInfo(getter.getDeclaringClass());
- MethodInfo getterInfo = new MethodInfoImpl(null, getter.getName(), type, new TypeInfo[0], null, null, ModifierInfo.getNewModifier(getter.getModifiers()), declaringType);
+ MethodInfo getterInfo = new MethodInfoImpl(null, getter.getName(), type, new TypeInfo[0], null, null, getter.getModifiers(), declaringType);
MethodInfo setterInfo = null;
if (setter != null)
{
@@ -283,7 +282,7 @@
AnnotationValue[][] paramAnnotations = new AnnotationValue[1][];
setterAnnotations = getExpectedAnnotations(setter.getParameterAnnotations()[0]);
paramAnnotations[0] = setterAnnotations.toArray(new AnnotationValue[setterAnnotations.size()]);
- setterInfo = new MethodInfoImpl(null, setter.getName(), PrimitiveInfo.VOID, new TypeInfo[] { type }, paramAnnotations, null, ModifierInfo.getNewModifier(setter.getModifiers()), declaringType);
+ setterInfo = new MethodInfoImpl(null, setter.getName(), PrimitiveInfo.VOID, new TypeInfo[] { type }, paramAnnotations, null, setter.getModifiers(), declaringType);
}
properties.put(lowerName, new DefaultPropertyInfo(lowerName, name, type, getterInfo, setterInfo, annotations));
}
@@ -308,7 +307,7 @@
AnnotationValue[][] paramAnnotations = new AnnotationValue[1][];
setterAnnotations = getExpectedAnnotations(setter.getParameterAnnotations()[0]);
paramAnnotations[0] = setterAnnotations.toArray(new AnnotationValue[setterAnnotations.size()]);
- MethodInfo setterInfo = new MethodInfoImpl(null, setter.getName(), PrimitiveInfo.VOID, new TypeInfo[] { type }, paramAnnotations, null, ModifierInfo.getNewModifier(setter.getModifiers()), declaringType);
+ MethodInfo setterInfo = new MethodInfoImpl(null, setter.getName(), PrimitiveInfo.VOID, new TypeInfo[] { type }, paramAnnotations, null, setter.getModifiers(), declaringType);
properties.put(lowerName, new DefaultPropertyInfo(lowerName, name, type, null, setterInfo, annotations));
}
}
@@ -354,7 +353,7 @@
ClassInfo declaringType = (ClassInfo) factory.getTypeInfo(method.getDeclaringClass());
Set<AnnotationValue> getterAnnotations = getExpectedAnnotations(method.getAnnotations());
AnnotationValue[] annotations = getterAnnotations.toArray(new AnnotationValue[getterAnnotations.size()]);
- MethodInfo getter = new MethodInfoImpl(null, name, returnType, new TypeInfo[0], new AnnotationValue[0][], null, ModifierInfo.getNewModifier(method.getModifiers()), declaringType);
+ MethodInfo getter = new MethodInfoImpl(null, name, returnType, new TypeInfo[0], new AnnotationValue[0][], null, method.getModifiers(), declaringType);
properties.add(new DefaultPropertyInfo(name, name, returnType, getter, null, annotations));
}
}
@@ -379,7 +378,7 @@
for (int i = 0; i < finfos.length; ++i)
{
FieldInfo field = finfos[i];
- if ((mode == BeanAccessMode.FIELDS && field.getModifiers().isPublic()) || (mode == BeanAccessMode.ALL))
+ if ((mode == BeanAccessMode.FIELDS && field.isPublic()) || (mode == BeanAccessMode.ALL))
fields.add(field);
}
}
Modified: projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/test/AbstractClassInfoTest.java
===================================================================
--- projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/test/AbstractClassInfoTest.java 2009-10-13 20:06:03 UTC (rev 94786)
+++ projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/test/AbstractClassInfoTest.java 2009-10-13 20:09:10 UTC (rev 94787)
@@ -43,7 +43,6 @@
import org.jboss.reflect.spi.FieldInfo;
import org.jboss.reflect.spi.InterfaceInfo;
import org.jboss.reflect.spi.MethodInfo;
-import org.jboss.reflect.spi.ModifierInfo;
import org.jboss.reflect.spi.PackageInfo;
import org.jboss.reflect.spi.ParameterInfo;
import org.jboss.reflect.spi.TypeInfo;
@@ -148,7 +147,7 @@
protected void assertModifiers(Class<?> clazz, ClassInfo classInfo) throws Throwable
{
int expected = clazz.getModifiers();
- int actual = classInfo.getModifiers().getModifiers();
+ int actual = classInfo.getModifiers();
getLog().debug(clazz + " modifier expected=" + expected + " actual=" + actual);
assertEquals(expected, actual);
}
@@ -225,7 +224,7 @@
for (Field field : clazz.getDeclaredFields())
{
TypeInfo type = factory.getTypeInfo(field.getGenericType());
- FieldInfo f = new FieldInfoImpl(null, field.getName(), type, ModifierInfo.getNewModifier(field.getModifiers()), classInfo);
+ FieldInfo f = new FieldInfoImpl(null, field.getName(), type, field.getModifiers(), classInfo);
expected.add(f);
}
@@ -258,7 +257,7 @@
TypeInfo type = factory.getTypeInfo(field.getGenericType());
assertTypeEquals(field.getName(), type, fieldInfo.getType());
assertEquals(classInfo, fieldInfo.getDeclaringClass());
- assertEquals(field.getModifiers(), fieldInfo.getModifiers().getModifiers());
+ assertEquals(field.getModifiers(), fieldInfo.getModifiers());
assertFieldAnnotations(field, fieldInfo);
}
@@ -275,7 +274,7 @@
int i = 0;
for (Class<?> c : paramClasses)
paramTypes[i++] = factory.getTypeInfo(c);
- MethodInfo m = new MethodInfoImpl(null, method.getName(), returnType, paramTypes, paramAnnotations, null, ModifierInfo.getNewModifier(method.getModifiers()), classInfo);
+ MethodInfo m = new MethodInfoImpl(null, method.getName(), returnType, paramTypes, paramAnnotations, null, method.getModifiers(), classInfo);
expected.add(m);
}
@@ -322,7 +321,7 @@
assertTypeEquals(method.getName() + " exception" + i, expectedExceptionTypes[i], actualExceptionTypes[i]);
assertTypeEquals(method.getName() + " returnType", returnType, methodInfo.getReturnType());
assertEquals(classInfo, methodInfo.getDeclaringClass());
- assertEquals(method.getModifiers(), methodInfo.getModifiers().getModifiers());
+ assertEquals(method.getModifiers(), methodInfo.getModifiers());
assertMethodAnnotations(method, methodInfo);
assertParameterAnnotations(method, methodInfo);
}
@@ -339,7 +338,7 @@
int i = 0;
for (Class<?> c : paramClasses)
paramTypes[i++] = factory.getTypeInfo(c);
- ConstructorInfo c = new ConstructorInfoImpl(null, paramTypes, paramAnnotations, null, ModifierInfo.getNewModifier(constructor.getModifiers()), classInfo);
+ ConstructorInfo c = new ConstructorInfoImpl(null, paramTypes, paramAnnotations, null, constructor.getModifiers(), classInfo);
expected.add(c);
}
@@ -391,7 +390,7 @@
for (int i = 0; i < exceptionClasses.length; ++i)
assertTypeEquals(clazz + " constructorException" + i, expectedExceptionTypes[i], actualExceptionTypes[i]);
assertEquals(classInfo, constructorInfo.getDeclaringClass());
- assertEquals(constructor.getModifiers(), constructorInfo.getModifiers().getModifiers());
+ assertEquals(constructor.getModifiers(), constructorInfo.getModifiers());
assertConstructorAnnotations(constructor, constructorInfo);
assertParameterAnnotations(constructor, constructorInfo);
}
@@ -532,7 +531,7 @@
for (Annotation annotation : annotations)
{
Class<?> type = annotation.annotationType();
- AnnotationInfoImpl info = new AnnotationInfoImpl(type.getName(), ModifierInfo.getNewModifier(type.getModifiers()));
+ AnnotationInfoImpl info = new AnnotationInfoImpl(type.getName(), type.getModifiers());
// TODO JBMICROCONT-127 attributes
AnnotationValue a = new AnnotationValueImpl(info, new HashMap<String, Value>(), annotation);
expected.add(a);
Modified: projects/jboss-reflect/trunk/src/test/java/org/jboss/test/plugins/javassist/JavassistMutableTypeInfoTestCase.java
===================================================================
--- projects/jboss-reflect/trunk/src/test/java/org/jboss/test/plugins/javassist/JavassistMutableTypeInfoTestCase.java 2009-10-13 20:06:03 UTC (rev 94786)
+++ projects/jboss-reflect/trunk/src/test/java/org/jboss/test/plugins/javassist/JavassistMutableTypeInfoTestCase.java 2009-10-13 20:09:10 UTC (rev 94787)
@@ -54,7 +54,7 @@
{
MutableClassInfo mci = new JavassistTypeInfoFactoryImpl().createNewMutableClass("org.jboss.test.plugins.javassist.PojoNew");
assertEquals(mci.getName(), "org.jboss.test.plugins.javassist.PojoNew");
- assertEquals(mci.getModifiers().isPublic(), true);
+ assertEquals(mci.isPublic(), true);
MutableMethodInfo mmi1 = mci.createMutableMethod(new InsertBeforeJavassistBody("public String getFoo() { return \"foo\"; }"));
mci.addMethod(mmi1);
assertEquals(mci.getDeclaredMethods().length, 1);
Modified: projects/jboss-reflect/trunk/src/test/java/org/jboss/test/plugins/javassist/ModifierInfoTestCase.java
===================================================================
--- projects/jboss-reflect/trunk/src/test/java/org/jboss/test/plugins/javassist/ModifierInfoTestCase.java 2009-10-13 20:06:03 UTC (rev 94786)
+++ projects/jboss-reflect/trunk/src/test/java/org/jboss/test/plugins/javassist/ModifierInfoTestCase.java 2009-10-13 20:09:10 UTC (rev 94787)
@@ -1,3 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.test.plugins.javassist;
import javassist.Modifier;
@@ -5,6 +26,13 @@
import org.jboss.reflect.spi.ModifierInfo;
import org.jboss.test.ContainerTest;
+/**
+ * ModifierInfoTestCase.
+ *
+ * @author Stale Pedersen
+ * @author Flavia Rainone
+ * @version $Revision: 1.1 $
+ */
public class ModifierInfoTestCase extends ContainerTest
{
@@ -15,37 +43,30 @@
public void testModifiers()
{
- assertEquals(ModifierInfo.PUBLIC.getModifiers(), Modifier.PUBLIC);
- assertEquals(ModifierInfo.PRIVATE.getModifiers(), Modifier.PRIVATE);
- assertEquals(ModifierInfo.PROTECTED.getModifiers(), Modifier.PROTECTED);
- assertEquals(ModifierInfo.STATIC.getModifiers(), Modifier.STATIC);
- assertEquals(ModifierInfo.PUBLIC_STATIC.getModifiers(), Modifier.PUBLIC + Modifier.STATIC);
+ assertEquals(ModifierInfo.PUBLIC, Modifier.PUBLIC);
+ assertEquals(ModifierInfo.PRIVATE, Modifier.PRIVATE);
+ assertEquals(ModifierInfo.PROTECTED, Modifier.PROTECTED);
+ assertEquals(ModifierInfo.STATIC, Modifier.STATIC);
+ assertEquals(ModifierInfo.PUBLIC_STATIC, Modifier.PUBLIC + Modifier.STATIC);
}
public void testNewModifiers()
{
- assertEquals(Modifier.PRIVATE, ModifierInfo.getNewModifier(Modifier.PRIVATE).getModifiers());
+ assertEquals(Modifier.PRIVATE, ModifierInfo.PRIVATE);
}
public void testIsPublic()
{
- assertTrue(ModifierInfo.PUBLIC.isPublic());
- assertTrue(ModifierInfo.PUBLIC_ABSTRACT_ANNOTATION.isPublic());
- assertTrue(ModifierInfo.PUBLIC_ABSTRACT_INTERFACE.isPublic());
- assertFalse(ModifierInfo.STATIC.isPublic());
- assertFalse(ModifierInfo.PRIVATE_CONSTANT_SYNTHETIC.isPublic());
- assertFalse(ModifierInfo.PRIVATE_CONSTANT_ENUM.isPublic());
+ assertTrue(Modifier.isPublic(ModifierInfo.PUBLIC));
+ assertFalse(Modifier.isPublic(ModifierInfo.STATIC));
}
public void testIsStatic()
{
- assertTrue(ModifierInfo.STATIC.isStatic());
- assertTrue(ModifierInfo.PUBLIC_STATIC.isStatic());
- assertTrue(ModifierInfo.PROTECTED_STATIC_TRANSIENT.isStatic());
- assertFalse(ModifierInfo.PROTECTED_ABSTRACT_INTERFACE_ANNOTATION.isStatic());
- assertFalse(ModifierInfo.PACKAGE_ABSTRACT.isStatic());
-
+ assertTrue(Modifier.isStatic(ModifierInfo.STATIC));
+ assertTrue(Modifier.isStatic(ModifierInfo.PUBLIC_STATIC));
+ assertFalse(Modifier.isStatic(ModifierInfo.PACKAGE_ABSTRACT));
}
-}
+}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list