libjboss-reflect-java-2.0.3.GA.orig/0000755000175000017500000000000011620314127017044 5ustar twernertwernerlibjboss-reflect-java-2.0.3.GA.orig/.classpath0000644000175000017500000000436111060213534021031 0ustar twernertwerner libjboss-reflect-java-2.0.3.GA.orig/pom.xml0000644000175000017500000000664111375171612020377 0ustar twernertwerner org.jboss jboss-parent 5 4.0.0 jboss-reflect 2.0.3.GA jar JBoss Reflection http://www.jboss.com/products/jbossmc JBoss Reflection scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/jboss-reflect/tags/2.0.3.GA scm:svn:https://svn.jboss.org/repos/jbossas/projects/jboss-reflect/tags/2.0.3.GA http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas/projects/jboss-reflect/tags/2.0.3.GA 2.2.12.GA 2.0.5.GA 2.0.5.GA 3.10.0.GA 1.1.1.GA 4.4 1.0.0.CR5 ${artifactId} org.apache.maven.plugins maven-surefire-plugin 2.4.3 true org/jboss/test/**/*TestCase.java true org.apache.maven.plugins maven-compiler-plugin 2.0.2 1.5 1.5 javassist javassist ${version.javassist} true org.jboss.logging jboss-logging-spi ${version.jboss.logging.spi} org.jboss jboss-common-core ${version.jboss.common.core} org.jboss.test jboss-test ${version.org.jboss.test} test junit junit ${version.junit} test jboss.profiler.jvmti jboss-profiler-jvmti ${version.jboss.profiler.jvmti} test libjboss-reflect-java-2.0.3.GA.orig/src/0000755000175000017500000000000011620314121017625 5ustar twernertwernerlibjboss-reflect-java-2.0.3.GA.orig/src/test/0000755000175000017500000000000011620314115020607 5ustar twernertwernerlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/0000755000175000017500000000000011620314115021530 5ustar twernertwernerlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/0000755000175000017500000000000011620314115022317 5ustar twernertwernerlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/0000755000175000017500000000000011620314115023437 5ustar twernertwernerlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/0000755000175000017500000000000011620314121024413 5ustar twernertwernerlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/ContainerTest.java0000644000175000017500000000332710756326650030070 0ustar twernertwerner/* * 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; /** * A ContainerTest. * * @author Adrian Brock * @version $Revision: 69888 $ */ public class ContainerTest extends AbstractTestCaseWithSetup { /** * Create a new ContainerTest. * * @param name the test name */ public ContainerTest(String name) { super(name); } /** * Default setup with security manager enabled * * @param clazz the class * @return the delegate * @throws Exception for any error */ public static AbstractTestDelegate getDelegate(Class clazz) throws Exception { AbstractTestDelegate delegate = new AbstractTestDelegate(clazz); //delegate.enableSecurity = true; return delegate; } } libjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/ContainerAllTestSuite.java0000644000175000017500000000356111112776757031537 0ustar twernertwerner/* * 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; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; import org.jboss.test.beaninfo.test.BeanInfoTestSuite; import org.jboss.test.classinfo.test.ClassInfoTestSuite; import org.jboss.test.joinpoint.test.JoinpointTestSuite; import org.jboss.test.typeinfo.test.TypeInfoTestSuite; /** * All Test Suite. * * @author Adrian Brock * @version $Revision: 81545 $ */ public class ContainerAllTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("All Tests"); suite.addTest(TypeInfoTestSuite.suite()); suite.addTest(ClassInfoTestSuite.suite()); suite.addTest(JoinpointTestSuite.suite()); suite.addTest(BeanInfoTestSuite.suite()); return suite; } } libjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/typeinfo/0000755000175000017500000000000011620314121026250 5ustar twernertwernerlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/typeinfo/test/0000755000175000017500000000000011620314121027227 5ustar twernertwerner././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/typeinfo/test/IntrospectionTypeInfoTestCase.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/typeinfo/test/IntrospectionTypeInfo0000644000175000017500000000351711112776757033525 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2008, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file 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.typeinfo.test; import junit.framework.Test; import org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactory; import org.jboss.reflect.spi.TypeInfoFactory; /** * Introspection test info tests. * * @author Ales Justin */ public class IntrospectionTypeInfoTestCase extends AbstractTypeInfoTest { private TypeInfoFactory factory = new IntrospectionTypeInfoFactory(); public IntrospectionTypeInfoTestCase(String name) { super(name); } public static Test suite() { return suite(IntrospectionTypeInfoTestCase.class); } protected TypeInfoFactory getTypeInfoFactory() { return factory; } protected boolean isTypeSupported() { return true; } }././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/typeinfo/test/AbstractTypeInfoTest.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/typeinfo/test/AbstractTypeInfoTest.0000644000175000017500000001116311112776757033342 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2008, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file 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.typeinfo.test; import java.lang.reflect.Method; import java.lang.reflect.Type; import java.util.Date; import org.jboss.reflect.spi.TypeInfo; import org.jboss.reflect.spi.TypeInfoFactory; import org.jboss.test.ContainerTest; import org.jboss.test.typeinfo.support.GenericInterface; import org.jboss.test.typeinfo.support.TestImpl; import org.jboss.test.typeinfo.support.TestInterface; import org.jboss.test.typeinfo.support.GenericStringImpl; import org.jboss.test.typeinfo.support.GenericIntegerImpl; /** * Type info test. * * @author Ales Justin */ public abstract class AbstractTypeInfoTest extends ContainerTest { protected AbstractTypeInfoTest(String name) { super(name); } protected abstract TypeInfoFactory getTypeInfoFactory(); // TODO - remove this after JBMICROCONT-129 is done protected abstract boolean isTypeSupported(); protected TypeInfo getTypeInfo(Type type) throws Exception { return getTypeInfoFactory().getTypeInfo(type); } public void testIsAssignableFrom() throws Throwable { TypeInfo first = getTypeInfo(int.class); TypeInfo second = getTypeInfo(double.class); assertIsAssignableFrom(first, second, true); second = getTypeInfo(Date.class); assertIsAssignableFrom(first, second, false); first = getTypeInfo(TestInterface.class); assertIsAssignableFrom(first, second, false); second = getTypeInfo(TestInterface.class); assertIsAssignableFrom(first, second, true); second = getTypeInfo(TestImpl.class); assertIsAssignableFrom(first, second, true); if (isTypeSupported()) { first = getTypeInfo(getType("getGenericStringInterface")); second = getTypeInfo(GenericStringImpl.class); assertIsAssignableFrom(first, second, true); second = getTypeInfo(GenericIntegerImpl.class); // TODO - better impl could return false? assertIsAssignableFrom(first, second, true); } } public void testIsInstance() throws Throwable { TypeInfo first = getTypeInfo(int.class); Object second = 123d; assertIsInstance(first, second, true); second = (byte)123; assertIsInstance(first, second, true); second = new Date(); assertIsInstance(first, second, false); first = getTypeInfo(TestInterface.class); assertIsInstance(first, second, false); second = new TestImpl(); assertIsInstance(first, second, true); if (isTypeSupported()) { first = getTypeInfo(getType("getGenericStringInterface")); second = new GenericStringImpl(); assertIsInstance(first, second, true); second = new GenericIntegerImpl(); // TODO - better impl could return false? assertIsInstance(first, second, true); } } protected void assertIsAssignableFrom(TypeInfo first, TypeInfo second, boolean expected) throws Throwable { assertEquals(expected, first.isAssignableFrom(second)); } protected void assertIsInstance(TypeInfo typeInfo, Object object, boolean expected) throws Throwable { assertEquals(expected, typeInfo.isInstance(object)); } protected Type getType(String methodName, Class... parameters) throws Exception { Method method = getClass().getMethod(methodName, parameters); return method.getGenericReturnType(); } public GenericInterface getGenericStringInterface() { return null; } }././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/typeinfo/test/TypeInfoTestSuite.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/typeinfo/test/TypeInfoTestSuite.jav0000644000175000017500000000323111112776757033366 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2008, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file 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.typeinfo.test; import junit.framework.TestSuite; import junit.framework.Test; import junit.textui.TestRunner; /** * TypeInfo test suite. * * @author Ales Justin */ public class TypeInfoTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("TypeInfo Tests"); suite.addTest(IntrospectionTypeInfoTestCase.suite()); suite.addTest(JavassistTypeInfoTestCase.suite()); return suite; } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/typeinfo/test/JavassistTypeInfoTestCase.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/typeinfo/test/JavassistTypeInfoTest0000644000175000017500000000346411112776757033475 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2008, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file 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.typeinfo.test; import junit.framework.Test; import org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactory; import org.jboss.reflect.spi.TypeInfoFactory; /** * Javassist type info tests. * * @author Ales Justin */ public class JavassistTypeInfoTestCase extends AbstractTypeInfoTest { private TypeInfoFactory factory = new JavassistTypeInfoFactory(); public JavassistTypeInfoTestCase(String name) { super(name); } public static Test suite() { return suite(JavassistTypeInfoTestCase.class); } protected TypeInfoFactory getTypeInfoFactory() { return factory; } protected boolean isTypeSupported() { return false; } }libjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/typeinfo/support/0000755000175000017500000000000011620314121027764 5ustar twernertwerner././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/typeinfo/support/GenericStringImpl.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/typeinfo/support/GenericStringImpl.0000644000175000017500000000233611112776757033405 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2008, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file 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.typeinfo.support; /** * @author Ales Justin */ public class GenericStringImpl implements GenericInterface { }././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/typeinfo/support/GenericInterface.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/typeinfo/support/GenericInterface.j0000644000175000017500000000233411112776757033365 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2008, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file 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.typeinfo.support; /** * @param generic type * @author Ales Justin */ public interface GenericInterface { }././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/typeinfo/support/GenericIntegerImpl.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/typeinfo/support/GenericIntegerImpl0000644000175000017500000000234011112776757033451 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2008, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file 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.typeinfo.support; /** * @author Ales Justin */ public class GenericIntegerImpl implements GenericInterface { }././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/typeinfo/support/TestInterface.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/typeinfo/support/TestInterface.java0000644000175000017500000000227411112776757033423 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2008, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file 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.typeinfo.support; /** * @author Ales Justin */ public interface TestInterface { } libjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/typeinfo/support/TestImpl.java0000644000175000017500000000231211112776757032415 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2008, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file 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.typeinfo.support; /** * @author Ales Justin */ public class TestImpl implements TestInterface { }libjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/0000755000175000017500000000000011620314120026373 5ustar twernertwernerlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/0000755000175000017500000000000011620314120027352 5ustar twernertwerner././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/AbstractClassInfoTest.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/AbstractClassInfoTes0000644000175000017500000005557011033445047033345 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.test; import java.lang.annotation.Annotation; import java.lang.reflect.Array; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Type; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Set; import org.jboss.reflect.plugins.AnnotationInfoImpl; import org.jboss.reflect.plugins.AnnotationValueImpl; import org.jboss.reflect.plugins.ConstructorInfoImpl; import org.jboss.reflect.plugins.FieldInfoImpl; import org.jboss.reflect.plugins.MethodInfoImpl; 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.InterfaceInfo; import org.jboss.reflect.spi.MethodInfo; import org.jboss.reflect.spi.PackageInfo; import org.jboss.reflect.spi.ParameterInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.reflect.spi.TypeInfoFactory; import org.jboss.reflect.spi.Value; import org.jboss.test.ContainerTest; /** * AbstractClassInfoTest. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public abstract class AbstractClassInfoTest extends ContainerTest { public AbstractClassInfoTest(String name) { super(name); } @SuppressWarnings("deprecation") protected TypeInfo testBasics(Class clazz, TypeInfo expected) throws Throwable { TypeInfoFactory factory = getTypeInfoFactory(); getLog().debug("Using typeInfoFactory: " + factory); TypeInfo info = factory.getTypeInfo(clazz.getName(), getClass().getClassLoader()); getLog().debug("Got: " + info + " from " + clazz); assertNotNull(info); assertEquals(info, expected); ClassLoader cl = getClass().getClassLoader(); info = factory.getTypeInfo(clazz); getLog().debug("Got: " + info + " from " + clazz.getName() + " cl=" + cl); assertNotNull(info); assertEquals(info, expected); getLog().debug("Name: " + info.getName()); assertEquals(clazz.getName(), info.getName()); getLog().debug("Type: " + info.getType()); assertEquals(clazz, info.getType()); // TODO JBMICROCONT-128 fix the serialization if (isJavassistTestCase() == false) { byte[] bytes = serialize(info); Object deserialized = deserialize(bytes); assertTrue("Not the same object: " + info + " != " + deserialized, info == deserialized); } return info; } protected boolean isJavassistTestCase() { return (getClass().getName().contains("Javassist")); } @SuppressWarnings("deprecation") protected void testArray(Class clazz, TypeInfo info) throws Throwable { TypeInfo arrayType = info.getArrayType(); getLog().debug("ArrayType(0): " + arrayType); assertTrue(arrayType.isArray()); Class arrayClass = Array.newInstance(clazz, 0).getClass(); assertEquals(arrayClass, arrayType.getType()); arrayType = info.getArrayType(); getLog().debug("ArrayType(0): " + arrayType); assertTrue(arrayType.isArray()); arrayClass = Array.newInstance(clazz, 0).getClass(); assertEquals(arrayClass, arrayType.getType()); } protected void testValues(Class clazz, TypeInfo info, String[] values, T[] types) throws Throwable { int i = 0; for (String value : values) { Object result = info.convertValue(value); getLog().debug("Converted: " + value + " to " + result); assertEquals(result, types[i++]); } } protected void assertClassInfo(ClassInfo classInfo, Class clazz) throws Throwable { assertEquals(clazz.isInterface(), classInfo.isInterface()); assertInterfaces(clazz, classInfo); assertDeclaredMethods(clazz, classInfo); assertDeclaredFields(clazz, classInfo); assertDeclaredConstructors(clazz, classInfo); assertSuperClass(clazz, classInfo); assertModifiers(clazz, classInfo); assertPackage(clazz, classInfo); assertAnnotations(clazz, classInfo); testArray(clazz, classInfo); } protected void assertModifiers(Class clazz, ClassInfo classInfo) throws Throwable { int expected = clazz.getModifiers(); int actual = classInfo.getModifiers(); getLog().debug(clazz + " modifier expected=" + expected + " actual=" + actual); assertEquals(expected, actual); } protected void assertPackage(Class clazz, ClassInfo classInfo) throws Throwable { Package pkg = clazz.getPackage(); PackageInfo packageInfo = classInfo.getPackage(); getLog().debug(clazz + " package=" + pkg + " packageInfo=" + packageInfo); if (pkg == null) { assertNullPackageInfo(packageInfo); return; } assertNotNull(packageInfo); String expected = pkg.getName(); String actual = packageInfo.getName(); getLog().debug(clazz + " package expected=" + expected + " actual=" + actual); assertEquals(expected, actual); assertPackageAnnotations(pkg, packageInfo); } protected void assertNullPackageInfo(PackageInfo packageInfo) { assertNull(packageInfo); } protected void assertSuperClass(Class clazz, ClassInfo classInfo) throws Throwable { TypeInfoFactory factory = getTypeInfoFactory(); Class superClass = clazz.getSuperclass(); TypeInfo superType = classInfo.getSuperclass(); getLog().debug(clazz + " superClass: " + superClass + " superType=" + superType); if (superClass == null) { assertNull(classInfo.getSuperclass()); return; } TypeInfo expected = factory.getTypeInfo(clazz.getSuperclass()); TypeInfo actual = classInfo.getSuperclass(); assertEquals(expected, actual); } protected void assertInterfaces(Class clazz, ClassInfo classInfo) throws Throwable { TypeInfoFactory factory = getTypeInfoFactory(); Set expected = new HashSet(); for (Class c : clazz.getInterfaces()) { TypeInfo type = factory.getTypeInfo(c); expected.add(type); } InterfaceInfo[] interfaces = classInfo.getInterfaces(); if (expected.isEmpty()) { assertEmpty(interfaces); return; } assertNotNull(interfaces); assertEquals(expected.size(), interfaces.length); Set actual = new HashSet(); for (TypeInfo intf : interfaces) actual.add(intf); getLog().debug(clazz + " expected interfaces=" + expected + " actual=" + actual); assertEquals(expected, actual); } protected void assertDeclaredFields(Class clazz, ClassInfo classInfo) throws Throwable { TypeInfoFactory factory = getTypeInfoFactory(); Set expected = new HashSet(); for (Field field : clazz.getDeclaredFields()) { TypeInfo type = factory.getTypeInfo(field.getGenericType()); FieldInfo f = new FieldInfoImpl(null, field.getName(), type, field.getModifiers(), classInfo); expected.add(f); } FieldInfo[] result = classInfo.getDeclaredFields(); if (expected.isEmpty()) { assertEmpty(result); return; } assertNotNull(result); assertEquals(expected.size(), result.length); Set actual = new HashSet(); for (FieldInfo f : result) actual.add(f); getLog().debug(clazz + " expected fields=" + expected + " actual=" + actual); assertEquals(expected, actual); for (Field field : clazz.getDeclaredFields()) assertDeclaredField(clazz, field, classInfo); } protected void assertDeclaredField(Class clazz, Field field, ClassInfo classInfo) throws Throwable { getLog().debug("Checking field " + field.getName()); TypeInfoFactory factory = getTypeInfoFactory(); FieldInfo fieldInfo = classInfo.getDeclaredField(field.getName()); assertNotNull(field.getName(), fieldInfo); TypeInfo type = factory.getTypeInfo(field.getGenericType()); assertTypeEquals(field.getName(), type, fieldInfo.getType()); assertEquals(classInfo, fieldInfo.getDeclaringClass()); assertEquals(field.getModifiers(), fieldInfo.getModifiers()); assertFieldAnnotations(field, fieldInfo); } protected void assertDeclaredMethods(Class clazz, ClassInfo classInfo) throws Throwable { TypeInfoFactory factory = getTypeInfoFactory(); Set expected = new HashSet(); for (Method method : clazz.getDeclaredMethods()) { TypeInfo returnType = factory.getTypeInfo(method.getReturnType()); Class[] paramClasses = method.getParameterTypes(); TypeInfo[] paramTypes = new TypeInfo[paramClasses.length]; AnnotationValue[][] paramAnnotations = new AnnotationValue[paramClasses.length][0]; int i = 0; for (Class c : paramClasses) paramTypes[i++] = factory.getTypeInfo(c); MethodInfo m = new MethodInfoImpl(null, method.getName(), returnType, paramTypes, paramAnnotations, null, method.getModifiers(), classInfo); expected.add(m); } MethodInfo[] result = classInfo.getDeclaredMethods(); if (expected.isEmpty()) { assertEmpty(result); return; } assertNotNull(result); assertEquals(expected.size(), result.length); Set actual = new HashSet(); for (MethodInfo f : result) actual.add(f); getLog().debug(clazz + " expected methods=" + expected + " actual=" + actual); assertEquals(expected, actual); for (Method method : clazz.getDeclaredMethods()) assertDeclaredMethod(clazz, method, classInfo); } protected void assertDeclaredMethod(Class clazz, Method method, ClassInfo classInfo) throws Throwable { getLog().debug("Checking method " + method.getName() + Arrays.asList(method.getParameterTypes())); TypeInfoFactory factory = getTypeInfoFactory(); Type[] paramClasses = method.getGenericParameterTypes(); TypeInfo[] paramTypes = new TypeInfo[paramClasses.length]; for (int i = 0; i < paramClasses.length; ++i) paramTypes[i] = factory.getTypeInfo(paramClasses[i]); MethodInfo methodInfo = classInfo.getDeclaredMethod(method.getName(), paramTypes); assertNotNull(method.getName(), methodInfo); TypeInfo returnType = factory.getTypeInfo(method.getGenericReturnType()); TypeInfo[] actualParamTypes = methodInfo.getParameterTypes(); for (int i = 0; i < paramTypes.length; ++i) assertTypeEquals(method.getName() + " param" + i, paramTypes[i], actualParamTypes[i]); Class[] exceptionClasses = method.getExceptionTypes(); TypeInfo[] expectedExceptionTypes = new TypeInfo[exceptionClasses.length]; for (int i = 0; i < exceptionClasses.length; ++i) expectedExceptionTypes[i] = factory.getTypeInfo(exceptionClasses[i]); TypeInfo[] actualExceptionTypes = methodInfo.getExceptionTypes(); for (int i = 0; i < exceptionClasses.length; ++i) 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()); assertMethodAnnotations(method, methodInfo); assertParameterAnnotations(method, methodInfo); } protected void assertDeclaredConstructors(Class clazz, ClassInfo classInfo) throws Throwable { TypeInfoFactory factory = getTypeInfoFactory(); Set expected = new HashSet(); for (Constructor constructor : clazz.getDeclaredConstructors()) { Class[] paramClasses = constructor.getParameterTypes(); TypeInfo[] paramTypes = new TypeInfo[paramClasses.length]; AnnotationValue[][] paramAnnotations = new AnnotationValue[paramClasses.length][0]; int i = 0; for (Class c : paramClasses) paramTypes[i++] = factory.getTypeInfo(c); ConstructorInfo c = new ConstructorInfoImpl(null, paramTypes, paramAnnotations, null, constructor.getModifiers(), classInfo); expected.add(c); } ConstructorInfo[] result = classInfo.getDeclaredConstructors(); if (expected.isEmpty()) { assertEmpty(result); return; } assertNotNull(result); assertEquals(expected.size(), result.length); Set actual = new HashSet(); for (ConstructorInfo f : result) actual.add(f); getLog().debug(clazz + " expected constructors=" + expected + " actual=" + actual); assertEquals(expected, actual); for (Constructor constructor : clazz.getDeclaredConstructors()) assertDeclaredConstructor(clazz, constructor, classInfo); } protected void assertDeclaredConstructor(Class clazz, Constructor constructor, ClassInfo classInfo) throws Throwable { getLog().debug("Checking constructor " + Arrays.asList(constructor.getParameterTypes())); TypeInfoFactory factory = getTypeInfoFactory(); Type[] paramClasses = constructor.getGenericParameterTypes(); // HACK: This is to workaround a bug in Sun's compiler related to enum constructors // having no generic parameters? Type[] parameterTypes = constructor.getParameterTypes(); if (paramClasses.length != parameterTypes.length) paramClasses = parameterTypes; TypeInfo[] paramTypes = new TypeInfo[paramClasses.length]; for (int i = 0; i < paramClasses.length; ++i) paramTypes[i] = factory.getTypeInfo(paramClasses[i]); ConstructorInfo constructorInfo = classInfo.getDeclaredConstructor(paramTypes); assertNotNull(constructorInfo); TypeInfo[] actualParamTypes = constructorInfo.getParameterTypes(); for (int i = 0; i < paramTypes.length; ++i) assertTypeEquals(clazz + " constructorParameter" + i, paramTypes[i], actualParamTypes[i]); Class[] exceptionClasses = constructor.getExceptionTypes(); TypeInfo[] expectedExceptionTypes = new TypeInfo[exceptionClasses.length]; for (int i = 0; i < exceptionClasses.length; ++i) expectedExceptionTypes[i] = factory.getTypeInfo(exceptionClasses[i]); TypeInfo[] actualExceptionTypes = constructorInfo.getExceptionTypes(); 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()); assertConstructorAnnotations(constructor, constructorInfo); assertParameterAnnotations(constructor, constructorInfo); } protected void assertAnnotations(Class clazz, ClassInfo classInfo) throws Throwable { Set expected = getExpectedAnnotations(clazz.getDeclaredAnnotations()); AnnotationValue[] result = classInfo.getAnnotations(); if (expected.isEmpty()) { assertEmpty(result); return; } assertNotNull(result); assertEquals(expected.size(), result.length); Set actual = new HashSet(); for (AnnotationValue f : result) actual.add(f); getLog().debug(clazz + " expected annotations=" + expected + " actual=" + actual); assertEquals(expected, actual); } protected void assertFieldAnnotations(Field field, FieldInfo fieldInfo) throws Throwable { Set expected = getExpectedAnnotations(field.getDeclaredAnnotations()); AnnotationValue[] result = fieldInfo.getAnnotations(); if (expected.isEmpty()) { assertEmpty(result); return; } assertNotNull(result); assertEquals(expected.size(), result.length); Set actual = new HashSet(); for (AnnotationValue f : result) actual.add(f); getLog().debug(field.getName() + " expected annotations=" + expected + " actual=" + actual); assertEquals(expected, actual); } protected void assertMethodAnnotations(Method method, MethodInfo methodInfo) throws Throwable { Set expected = getExpectedAnnotations(method.getDeclaredAnnotations()); AnnotationValue[] result = methodInfo.getAnnotations(); if (expected.isEmpty()) { assertEmpty(result); return; } assertNotNull(result); assertEquals(expected.size(), result.length); Set actual = new HashSet(); for (AnnotationValue f : result) actual.add(f); getLog().debug(method.getName() + " expected annotations=" + expected + " actual=" + actual); assertEquals(expected, actual); } protected void assertParameterAnnotations(Method method, MethodInfo methodInfo) throws Throwable { Annotation[][] annotations = method.getParameterAnnotations(); ParameterInfo[] parameters = methodInfo.getParameters(); for (int i = 0; i < annotations.length; ++i) assertParameterAnnotations(annotations[i], parameters[i]); } protected void assertConstructorAnnotations(Constructor constructor, ConstructorInfo constructorInfo) throws Throwable { Set expected = getExpectedAnnotations(constructor.getDeclaredAnnotations()); AnnotationValue[] result = constructorInfo.getAnnotations(); if (expected.isEmpty()) { assertEmpty(result); return; } assertNotNull(result); assertEquals(expected.size(), result.length); Set actual = new HashSet(); for (AnnotationValue f : result) actual.add(f); getLog().debug("Expected annotations=" + expected + " actual=" + actual); assertEquals(expected, actual); } protected void assertPackageAnnotations(Package pkg, PackageInfo packageInfo) throws Throwable { Set expected = getExpectedAnnotations(pkg.getDeclaredAnnotations()); AnnotationValue[] result = packageInfo.getAnnotations(); if (expected.isEmpty()) { assertEmpty(result); return; } assertNotNull(result); assertEquals(expected.size(), result.length); Set actual = new HashSet(); for (AnnotationValue f : result) actual.add(f); getLog().debug("Expected annotations=" + expected + " actual=" + actual); assertEquals(expected, actual); } protected void assertParameterAnnotations(Constructor constructor, ConstructorInfo constructorInfo) throws Throwable { Annotation[][] annotations = constructor.getParameterAnnotations(); ParameterInfo[] parameters = constructorInfo.getParameters(); for (int i = 0; i < annotations.length; ++i) assertParameterAnnotations(annotations[i], parameters[i]); } protected void assertParameterAnnotations(Annotation[] annotations, ParameterInfo parameter) throws Throwable { Set expected = getExpectedAnnotations(annotations); AnnotationValue[] result = parameter.getAnnotations(); if (expected.isEmpty()) { assertEmpty(result); return; } assertNotNull(result); assertEquals(expected.size(), result.length); Set actual = new HashSet(); for (AnnotationValue f : result) actual.add(f); getLog().debug(parameter.getName() + " expected parameter annotations=" + expected + " actual=" + actual); assertEquals(expected, actual); } protected Set getExpectedAnnotations(Annotation[] annotations) { Set expected = new HashSet(); for (Annotation annotation : annotations) { Class type = annotation.annotationType(); AnnotationInfoImpl info = new AnnotationInfoImpl(type.getName(), type.getModifiers()); // TODO JBMICROCONT-127 attributes AnnotationValue a = new AnnotationValueImpl(info, new HashMap(), annotation); expected.add(a); } return expected; } protected void assertTypeEquals(String context, TypeInfo expected, TypeInfo actual) throws Exception { assertEquals(expected, actual); if (expected instanceof ClassInfo) { ClassInfo expectedClassInfo = (ClassInfo) expected; ClassInfo actualClassInfo = (ClassInfo) actual; assertEquals(context, expectedClassInfo.getOwnerType(), actualClassInfo.getOwnerType()); assertEquals(context, expectedClassInfo.getRawType(), actualClassInfo.getRawType()); TypeInfo[] expectedTypeArgs = expectedClassInfo.getActualTypeArguments(); TypeInfo[] actualTypeArgs = expectedClassInfo.getActualTypeArguments(); if (expectedTypeArgs == null) assertNull(context, actualTypeArgs); else { assertNotNull(context, actualTypeArgs); getLog().debug("Checking type args for " + context + " expected: " + Arrays.asList(expectedTypeArgs) + " actual: " + Arrays.asList(actualTypeArgs)); assertEquals(expectedTypeArgs.length, actualTypeArgs.length); for (int i = 0; i < expectedTypeArgs.length; ++i) assertTypeEquals(context + "arg" + i, expectedTypeArgs[i], actualTypeArgs[i]); } } } protected abstract TypeInfoFactory getTypeInfoFactory(); protected void configureLogging() { enableTrace("org.jboss.reflect"); } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/JavassistEnumUnitTestCase.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/JavassistEnumUnitTes0000644000175000017500000000351210560664062033425 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.test; import junit.framework.Test; import org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactory; import org.jboss.reflect.spi.PackageInfo; import org.jboss.reflect.spi.TypeInfoFactory; /** * JavassistEnumUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class JavassistEnumUnitTestCase extends ClassInfoEnumTest { public JavassistEnumUnitTestCase(String name) { super(name); } public static Test suite() { return suite(JavassistEnumUnitTestCase.class); } protected void assertPackageAnnotations(Package pkg, PackageInfo packageInfo) throws Throwable { // TODO JBMICROCONT-130 this is broken for javassist } protected TypeInfoFactory getTypeInfoFactory() { return new JavassistTypeInfoFactory(); } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/ClassInfoPrimitiveTest.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/ClassInfoPrimitiveTe0000644000175000017500000000633610533536206033365 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.test; import org.jboss.reflect.spi.PrimitiveInfo; import org.jboss.reflect.spi.TypeInfo; /** * ClassInfoPrimitiveTest. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public abstract class ClassInfoPrimitiveTest extends AbstractClassInfoTest { public ClassInfoPrimitiveTest(String name) { super(name); } public void testBoolean() throws Throwable { testPrimitive(Boolean.TYPE, PrimitiveInfo.BOOLEAN, new String[] { "true", "false" }, new Boolean[] { true, false } ); } public void testByte() throws Throwable { testPrimitive(Byte.TYPE, PrimitiveInfo.BYTE, new String[] { "1", "2" }, new Byte[] { 1, 2 }); } public void testChar() throws Throwable { testPrimitive(Character.TYPE, PrimitiveInfo.CHAR, new String[] { "a", "b" }, new Character[] { 'a', 'b' }); } public void testDouble() throws Throwable { testPrimitive(Double.TYPE, PrimitiveInfo.DOUBLE, new String[] { "1.2", "3.14" }, new Double[] { 1.2, 3.14 }); } public void testFloat() throws Throwable { testPrimitive(Float.TYPE, PrimitiveInfo.FLOAT, new String[] { "1.0e10", "4.2e5" }, new Float[] { 1.0e10f, 4.2e5f }); } public void testInt() throws Throwable { testPrimitive(Integer.TYPE, PrimitiveInfo.INT, new String[] { "1", "2" }, new Integer[] { 1, 2 }); } public void testLong() throws Throwable { testPrimitive(Long.TYPE, PrimitiveInfo.LONG, new String[] { "1", "2" }, new Long[] { 1l, 2l }); } public void testShort() throws Throwable { testPrimitive(Short.TYPE, PrimitiveInfo.SHORT, new String[] { "1", "2" }, new Short[] { 1, 2 }); } public void testVoid() throws Throwable { testPrimitive(Void.TYPE, PrimitiveInfo.VOID, null, null); } protected void testPrimitive(Class clazz, PrimitiveInfo primitive, String[] values, T[] types) throws Throwable { TypeInfo info = testBasics(clazz, primitive); assertFalse(info.isArray()); assertFalse(info.isEnum()); assertTrue(info.isPrimitive()); if (values == null) return; testArray(clazz, info); testValues(clazz, info, values, types); } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/ClassInfoGenericClassTest.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/ClassInfoGenericClas0000644000175000017500000003317710770506700033305 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.test; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.lang.reflect.Type; import java.util.Arrays; import java.util.Collection; import java.util.Date; import java.util.Map; import org.jboss.reflect.plugins.ClassInfoImpl; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.InterfaceInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.reflect.spi.TypeInfoFactory; import org.jboss.test.classinfo.support.ClassInfoEmptyClass; import org.jboss.test.classinfo.support.ClassInfoGenericClass; import org.jboss.test.classinfo.support.ClassInfoGenericConstructorsClass; import org.jboss.test.classinfo.support.ClassInfoGenericExtendsCollection; import org.jboss.test.classinfo.support.ClassInfoGenericExtendsCollectionAndChangesParameter; import org.jboss.test.classinfo.support.ClassInfoGenericExtendsCollectionInComplicatedWay; import org.jboss.test.classinfo.support.ClassInfoGenericExtendsCollectionInComplicatedWayWIthSpecificType; import org.jboss.test.classinfo.support.ClassInfoGenericExtendsCollectionNotGeneric; import org.jboss.test.classinfo.support.ClassInfoGenericExtendsMap; import org.jboss.test.classinfo.support.ClassInfoGenericExtendsMapAndChangesParameters; import org.jboss.test.classinfo.support.ClassInfoGenericExtendsMapInComplicatedWay; import org.jboss.test.classinfo.support.ClassInfoGenericExtendsMapInComplicatedWayWIthSpecificType; import org.jboss.test.classinfo.support.ClassInfoGenericExtendsMapNotGeneric; import org.jboss.test.classinfo.support.ClassInfoGenericFieldsClass; import org.jboss.test.classinfo.support.ClassInfoGenericImplementsCollection; import org.jboss.test.classinfo.support.ClassInfoGenericImplementsCollectionNotGeneric; import org.jboss.test.classinfo.support.ClassInfoGenericImplementsMap; import org.jboss.test.classinfo.support.ClassInfoGenericImplementsMapNotGeneric; import org.jboss.test.classinfo.support.ClassInfoGenericInterface; import org.jboss.test.classinfo.support.ClassInfoGenericMethodsClass; import org.jboss.test.classinfo.support.ClassInfoGenericSuperClassEmptyClass; import org.jboss.test.classinfo.support.ClassInfoGenericSuperClassString; import org.jboss.test.classinfo.support.ClassInfoGenericSuperInterfaceEmptyClass; import org.jboss.test.classinfo.support.ClassInfoGenericSuperInterfaceString; /** * ClassInfoGenericClassTest. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public abstract class ClassInfoGenericClassTest extends AbstractClassInfoTest { public ClassInfoGenericClassTest(String name) { super(name); } public void testGenericSuperClassString() { testGenericSuperClass(ClassInfoGenericSuperClassString.class, ClassInfoGenericClass.class, new Class[] { String.class }); } public void testGenericSuperClassEmptyClass() { testGenericSuperClass(ClassInfoGenericSuperClassEmptyClass.class, ClassInfoGenericClass.class, new Class[] { ClassInfoEmptyClass.class }); } public void testGenericSuperInterfaceString() { testGenericSuperInterface(ClassInfoGenericSuperInterfaceString.class, ClassInfoGenericInterface.class, new Class[] { String.class }); } public void testGenericSuperInterfaceEmptyClass() { testGenericSuperInterface(ClassInfoGenericSuperInterfaceEmptyClass.class, ClassInfoGenericInterface.class, new Class[] { ClassInfoEmptyClass.class }); } public void testGenericSuperClass(Class clazz, Class genericClass, Class[] genericTypes) { TypeInfoFactory factory = getTypeInfoFactory(); ClassInfo typeInfo = (ClassInfo) factory.getTypeInfo(clazz); ClassInfo superClassInfo = typeInfo.getGenericSuperclass(); ClassInfo genericClassInfo = (ClassInfo) factory.getTypeInfo(genericClass); getLog().debug("Checking superClass: " + genericClass + " against " + superClassInfo); assertEquals(genericClassInfo, superClassInfo); TypeInfo[] types = new TypeInfo[genericTypes.length]; for (int i = 0; i < types.length; ++i) types[i] = factory.getTypeInfo(genericTypes[i]); TypeInfo[] actualTypes = superClassInfo.getActualTypeArguments(); getLog().debug("Checking superClass types: " + Arrays.asList(genericTypes) + " against " + Arrays.asList(actualTypes)); assertEquals(types.length, actualTypes.length); for (int i = 0; i < types.length; ++i) assertEquals(types[i], actualTypes[i]); } public void testGenericSuperInterface(Class clazz, Class genericClass, Class[] genericTypes) { TypeInfoFactory factory = getTypeInfoFactory(); ClassInfo typeInfo = (ClassInfo) factory.getTypeInfo(clazz); InterfaceInfo[] superInterfaces = typeInfo.getGenericInterfaces(); assertNotNull(superInterfaces); assertEquals(1, superInterfaces.length); InterfaceInfo superInterface = superInterfaces[0]; getLog().debug("Checking superInterface: " + genericClass + " against " + superInterface); ClassInfo genericClassInfo = (ClassInfo) factory.getTypeInfo(genericClass); assertEquals(genericClassInfo, superInterface); TypeInfo[] types = new TypeInfo[genericTypes.length]; for (int i = 0; i < types.length; ++i) types[i] = factory.getTypeInfo(genericTypes[i]); TypeInfo[] actualTypes = superInterface.getActualTypeArguments(); getLog().debug("Checking superInterface types: " + Arrays.asList(genericTypes) + " against " + Arrays.asList(actualTypes)); assertEquals(types.length, actualTypes.length); for (int i = 0; i < types.length; ++i) assertEquals(types[i], actualTypes[i]); } public void testGenericMethodsClass() throws Throwable { testGenericClass(ClassInfoGenericMethodsClass.class); } public void testGenericConstructorsClass() throws Throwable { testGenericClass(ClassInfoGenericConstructorsClass.class); } public void testGenericFieldsClass() throws Throwable { testGenericClass(ClassInfoGenericFieldsClass.class); } public void testComponentTypeNotGeneric() throws Throwable { assertComponentType(Collection.class, Object.class); } public void testComponentTypeImplementsCollectionNotGeneric() throws Throwable { assertComponentType(ClassInfoGenericImplementsCollectionNotGeneric.class, Object.class); } public void testComponentTypeExtendsCollectionNotGeneric() throws Throwable { assertComponentType(ClassInfoGenericExtendsCollectionNotGeneric.class, Object.class); } public static Collection signatureCollectionBoolean() { return null; } public void testComponentTypeCollectionBoolean() throws Throwable { assertComponentType("signatureCollectionBoolean", Boolean.class); } public void testComponentTypeImplementsCollection() throws Throwable { assertComponentType(ClassInfoGenericImplementsCollection.class, Long.class); } public void testComponentTypeExtendsCollection() throws Throwable { assertComponentType(ClassInfoGenericExtendsCollection.class, Short.class); } public void testComponentTypeExtendsCollectionAndChangesParameter() throws Throwable { assertComponentType(ClassInfoGenericExtendsCollectionAndChangesParameter.class, Object.class); } public static ClassInfoGenericExtendsCollectionAndChangesParameter signatureChangesParameter() { return null; } public void testComponentTypeExtendsCollectionAndChangesParameterExplicit() throws Throwable { assertComponentType("signatureChangesParameter", Float.class); } public void testComponentTypeExtendsCollectionInAComplicatedWay() throws Throwable { assertComponentType(ClassInfoGenericExtendsCollectionInComplicatedWay.class, Object.class); } public static ClassInfoGenericExtendsCollectionInComplicatedWay signatureComplicatedWay() { return null; } public void testComponentTypeExtendsCollectionInAComplicatedWayExplicit() throws Throwable { assertComponentType("signatureComplicatedWay", Date.class); } public void testComponentTypeExtendsCollectionInAComplicatedWayWithSpecificType() throws Throwable { assertComponentType(ClassInfoGenericExtendsCollectionInComplicatedWayWIthSpecificType.class, Double.class); } public void testKeyValueTypeNotGeneric() throws Throwable { assertKeyValueType(Map.class, Object.class, Object.class); } public void testKeyValueTypeImplementsMapNotGeneric() throws Throwable { assertKeyValueType(ClassInfoGenericImplementsMapNotGeneric.class, Object.class, Object.class); } public void testKeyValueTypeExtendsMapNotGeneric() throws Throwable { assertKeyValueType(ClassInfoGenericExtendsMapNotGeneric.class, Object.class, Object.class); } public static Map signatureMapBooleanDate() { return null; } public void testKeyValueTypeMapBooleanDate() throws Throwable { assertKeyValueType("signatureMapBooleanDate", Boolean.class, Date.class); } public void testKeyValueTypeImplementsMap() throws Throwable { assertKeyValueType(ClassInfoGenericImplementsMap.class, Long.class, Integer.class); } public void testKeyValueTypeExtendsMap() throws Throwable { assertKeyValueType(ClassInfoGenericExtendsMap.class, Short.class, Double.class); } public void testKeyValueTypeExtendsMapAndChangesParameters() throws Throwable { assertKeyValueType(ClassInfoGenericExtendsMapAndChangesParameters.class, Object.class, Object.class); } public static ClassInfoGenericExtendsMapAndChangesParameters signatureMapChangesParameter() { return null; } public void testKeyValueTypeExtendsMapAndChangesParameterExplicit() throws Throwable { assertKeyValueType("signatureMapChangesParameter", Float.class, Double.class); } public void testKeyValueTypeExtendsMapInAComplicatedWay() throws Throwable { assertKeyValueType(ClassInfoGenericExtendsMapInComplicatedWay.class, Object.class, Object.class); } public static ClassInfoGenericExtendsMapInComplicatedWay signatureMapComplicatedWay() { return null; } public void testComponentTypeExtendsMapInAComplicatedWayExplicit() throws Throwable { assertKeyValueType("signatureMapComplicatedWay", Date.class, StringBuffer.class); } public void testComponentTypeExtendsMapInAComplicatedWayWithSpecificType() throws Throwable { assertKeyValueType(ClassInfoGenericExtendsMapInComplicatedWayWIthSpecificType.class, Double.class, Short.class); } private void assertComponentType(String methodName, Class expected) throws Exception { Method method = ClassInfoGenericClassTest.class.getMethod(methodName, (Class[]) null); Type type = method.getGenericReturnType(); assertComponentType(type, expected); } private void assertComponentType(Type type, Class expected) throws Exception { TypeInfoFactory factory = getTypeInfoFactory(); TypeInfo typeInfo = factory.getTypeInfo(type); ClassInfo classInfo = assertInstanceOf(typeInfo, ClassInfo.class); assertTrue(classInfo.isCollection()); TypeInfo expectedInfo = factory.getTypeInfo(expected); assertEquals(expectedInfo, classInfo.getComponentType()); } private void assertKeyValueType(String methodName, Class keyExpected, Class valueExpected) throws Exception { Method method = ClassInfoGenericClassTest.class.getMethod(methodName, (Class[]) null); Type type = method.getGenericReturnType(); assertKeyValueType(type, keyExpected, valueExpected); } private void assertKeyValueType(Type type, Class keyExpected, Class valueExpected) throws Exception { TypeInfoFactory factory = getTypeInfoFactory(); TypeInfo typeInfo = factory.getTypeInfo(type); ClassInfo classInfo = assertInstanceOf(typeInfo, ClassInfo.class); assertTrue(classInfo.isMap()); TypeInfo expectedInfo = factory.getTypeInfo(keyExpected); assertEquals(expectedInfo, classInfo.getKeyType()); expectedInfo = factory.getTypeInfo(valueExpected); assertEquals(expectedInfo, classInfo.getValueType()); } private void testGenericClass(Class clazz) throws Throwable { ClassInfoImpl expected = new ClassInfoImpl(clazz.getName(), Modifier.PUBLIC); TypeInfo info = testBasics(clazz, expected); assertFalse(info.isArray()); assertFalse(info.isEnum()); assertFalse(info.isPrimitive()); ClassInfo classInfo = (ClassInfo) info; assertClassInfo(classInfo, clazz); } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/IntrospectionGenericInterfaceUnitTestCase.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/IntrospectionGeneric0000644000175000017500000000331510535031562033446 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.test; import junit.framework.Test; import org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactory; import org.jboss.reflect.spi.TypeInfoFactory; /** * IntrospectionGenericInterfaceUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class IntrospectionGenericInterfaceUnitTestCase extends ClassInfoGenericInterfaceTest { public IntrospectionGenericInterfaceUnitTestCase(String name) { super(name); } public static Test suite() { return suite(IntrospectionGenericInterfaceUnitTestCase.class); } protected TypeInfoFactory getTypeInfoFactory() { return new IntrospectionTypeInfoFactory(); } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/JavassistCustomValueValueOfTestCase.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/JavassistCustomValue0000644000175000017500000000302711374537405033461 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file 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.classinfo.test; import org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactory; import org.jboss.reflect.spi.TypeInfoFactory; /** * * @author Kabir Khan * @version $Revision: 1.1 $ */ public class JavassistCustomValueValueOfTestCase extends CustomValueValueOfTest { public JavassistCustomValueValueOfTestCase(String name) { super(name); } @Override protected TypeInfoFactory getTypeInfoFactory() { return new JavassistTypeInfoFactory(); } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/IntrospectionArrayUnitTestCase.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/IntrospectionArrayUn0000644000175000017500000000322610533536206033457 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.test; import junit.framework.Test; import org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactory; import org.jboss.reflect.spi.TypeInfoFactory; /** * IntrospectionArrayUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class IntrospectionArrayUnitTestCase extends ClassInfoArrayTest { public IntrospectionArrayUnitTestCase(String name) { super(name); } public static Test suite() { return suite(IntrospectionArrayUnitTestCase.class); } protected TypeInfoFactory getTypeInfoFactory() { return new IntrospectionTypeInfoFactory(); } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/JavassistAnnotatedClassInfoTestCase.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/JavassistAnnotatedCl0000644000175000017500000000324010444315516033375 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.test; import junit.framework.Test; import org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactory; import org.jboss.reflect.spi.TypeInfoFactory; /** * Javassist ClassInfo Test Case. * * @author Adrian Brock * @version $Revision: 45654 $ */ public class JavassistAnnotatedClassInfoTestCase extends AnnotatedClassInfoTest { public static Test suite() { return suite(JavassistAnnotatedClassInfoTestCase.class); } public JavassistAnnotatedClassInfoTestCase(String name) { super(name); } protected TypeInfoFactory getTypeInfoFactory() { return new JavassistTypeInfoFactory(); } }././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/CustomValueValueOfTest.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/CustomValueValueOfTe0000644000175000017500000000345511374537405033351 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file 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.classinfo.test; import org.jboss.reflect.spi.TypeInfo; import org.jboss.test.classinfo.support.CustomValueOf; /** * Tests that public static XXX.valueOf(Object o) is called when calling ClassInfo.convertValue() * * @author Kabir Khan * @version $Revision: 1.1 $ */ public abstract class CustomValueValueOfTest extends AbstractClassInfoTest { public CustomValueValueOfTest(String name) { super(name); } public void testCustomValueOf() throws Throwable { TypeInfo info = getTypeInfoFactory().getTypeInfo(CustomValueOf.class); Object value = info.convertValue("1234"); assertNotNull(value); assertInstanceOf(value, CustomValueOf.class); assertEquals("1234", ((CustomValueOf)value).getString()); } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/JavassistInterfaceUnitTestCase.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/JavassistInterfaceUn0000644000175000017500000000354310560664062033414 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.test; import junit.framework.Test; import org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactory; import org.jboss.reflect.spi.PackageInfo; import org.jboss.reflect.spi.TypeInfoFactory; /** * JavassistInterfaceUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class JavassistInterfaceUnitTestCase extends ClassInfoInterfaceTest { public JavassistInterfaceUnitTestCase(String name) { super(name); } public static Test suite() { return suite(JavassistInterfaceUnitTestCase.class); } protected void assertPackageAnnotations(Package pkg, PackageInfo packageInfo) throws Throwable { // TODO JBMICROCONT-130 this is broken for javassist } protected TypeInfoFactory getTypeInfoFactory() { return new JavassistTypeInfoFactory(); } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/ClassInfoEnumTest.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/ClassInfoEnumTest.ja0000644000175000017500000001054010756326650033260 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.test; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.HashSet; import java.util.Set; import org.jboss.reflect.plugins.EnumConstantInfoImpl; import org.jboss.reflect.plugins.EnumInfoImpl; import org.jboss.reflect.spi.AnnotationValue; import org.jboss.reflect.spi.EnumConstantInfo; import org.jboss.reflect.spi.EnumInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.test.classinfo.support.ClassInfoEnum; import org.jboss.test.classinfo.support.ClassInfoEnumAnnotation; import org.jboss.test.classinfo.support.ClassInfoEnumFieldAnnotation; /** * ClassInfoEnumTest. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public abstract class ClassInfoEnumTest extends AbstractClassInfoTest { public ClassInfoEnumTest(String name) { super(name); } public void testEnum() throws Throwable { testEnum(ClassInfoEnum.class); } public void testEnumAnnotation() throws Throwable { testEnum(ClassInfoEnumAnnotation.class); } public void testEnumFieldAnnotation() throws Throwable { testEnum(ClassInfoEnumFieldAnnotation.class); } @SuppressWarnings("unchecked") private void testEnum(Class enumClass) throws Throwable { EnumInfoImpl expected = new EnumInfoImpl(enumClass.getName(), Modifier.PUBLIC); TypeInfo info = testBasics(enumClass, expected); assertFalse(info.isArray()); assertTrue(info.isEnum()); assertFalse(info.isPrimitive()); EnumInfo enumInfo = (EnumInfo) info; assertEnumConstants(enumClass, enumInfo); assertClassInfo(enumInfo, enumClass); } protected void assertEnumConstants(Class> enumClass, EnumInfo enumInfo) throws Throwable { HashSet expected = new HashSet(); for (Enum enumeration : enumClass.getEnumConstants()) { EnumConstantInfo constant = new EnumConstantInfoImpl(enumeration.name(), enumInfo); expected.add(constant); } EnumConstantInfo[] constants = enumInfo.getEnumConstants(); assertNotNull(constants); HashSet actual = new HashSet(); for (EnumConstantInfo c : constants) actual.add(c); assertEquals(expected, actual); for (Enum enumeration : enumClass.getEnumConstants()) { String name = enumeration.name(); Field field = enumClass.getField(name); EnumConstantInfo constant = enumInfo.getEnumConstant(name); assertEnumConstantAnnotations(field, constant); } } protected void assertEnumConstantAnnotations(Field field, EnumConstantInfo enumConstantInfo) throws Throwable { Set expected = getExpectedAnnotations(field.getDeclaredAnnotations()); AnnotationValue[] result = enumConstantInfo.getAnnotations(); if (expected.isEmpty()) { assertEmpty(result); return; } assertNotNull(result); assertEquals(expected.size(), result.length); Set actual = new HashSet(); for (AnnotationValue f : result) actual.add(f); getLog().debug(field.getName() + " expected annotations=" + expected + " actual=" + actual); assertEquals(expected, actual); } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/IntrospectionClassInfoTestCase.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/IntrospectionClassIn0000644000175000017500000000323010376104627033430 0ustar twernertwerner/* * 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.classinfo.test; import junit.framework.Test; import org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactory; import org.jboss.reflect.spi.TypeInfoFactory; /** * Introspection ClassInfo Test Case. * * @author Adrian Brock * @version $Revision: 41300 $ */ public class IntrospectionClassInfoTestCase extends ClassInfoTest { public static Test suite() { return suite(IntrospectionClassInfoTestCase.class); } public IntrospectionClassInfoTestCase(String name) { super(name); } protected TypeInfoFactory getTypeInfoFactory() { return new IntrospectionTypeInfoFactory(); } }././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/ClassInfoTestSuite.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/ClassInfoTestSuite.j0000644000175000017500000000530011033445047033271 0ustar twernertwerner/* * 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.classinfo.test; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; /** * ClassInfo Test Suite. * * @author Adrian Brock * @version $Revision: 75394 $ */ public class ClassInfoTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("ClassInfo Tests"); suite.addTest(IntrospectionPrimitiveUnitTestCase.suite()); suite.addTest(JavassistPrimitiveUnitTestCase.suite()); suite.addTest(IntrospectionNumberUnitTestCase.suite()); suite.addTest(JavassistNumberUnitTestCase.suite()); suite.addTest(IntrospectionArrayUnitTestCase.suite()); suite.addTest(JavassistArrayUnitTestCase.suite()); suite.addTest(IntrospectionEnumUnitTestCase.suite()); suite.addTest(JavassistEnumUnitTestCase.suite()); suite.addTest(IntrospectionInterfaceUnitTestCase.suite()); suite.addTest(JavassistInterfaceUnitTestCase.suite()); suite.addTest(IntrospectionClassUnitTestCase.suite()); suite.addTest(JavassistClassUnitTestCase.suite()); suite.addTest(IntrospectionClassInfoTestCase.suite()); suite.addTest(JavassistClassInfoTestCase.suite()); suite.addTest(IntrospectionAnnotatedClassInfoTestCase.suite()); suite.addTest(JavassistAnnotatedClassInfoTestCase.suite()); suite.addTest(IntrospectionGenericInterfaceUnitTestCase.suite()); suite.addTest(IntrospectionGenericClassUnitTestCase.suite()); suite.addTest(FieldAccessRestrictionTestCase.suite()); suite.addTest(MethodAccessRestrictionTestCase.suite()); return suite; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/ClassInfoNumberTest.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/ClassInfoNumberTest.0000644000175000017500000000614111033445047033262 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.test; import org.jboss.reflect.spi.NumberInfo; import org.jboss.reflect.spi.TypeInfo; /** * ClassInfoNumberTest. * * @author Ales Justin */ public abstract class ClassInfoNumberTest extends AbstractClassInfoTest { public ClassInfoNumberTest(String name) { super(name); } public void testByte() throws Throwable { testNumber(Byte.class, NumberInfo.BYTE_OBJECT, new String[] { "1", "2" }, new Byte[] { 1, 2 }); } public void testDouble() throws Throwable { testNumber(Double.class, NumberInfo.DOUBLE_OBJECT, new String[] { "1.2", "3.14" }, new Double[] { 1.2, 3.14 }); } public void testFloat() throws Throwable { testNumber(Float.class, NumberInfo.FLOAT_OBJECT, new String[] { "1.0e10", "4.2e5" }, new Float[] { 1.0e10f, 4.2e5f }); } public void testInt() throws Throwable { testNumber(Integer.class, NumberInfo.INT_OBJECT, new String[] { "1", "2" }, new Integer[] { 1, 2 }); } public void testLong() throws Throwable { testNumber(Long.class, NumberInfo.LONG_OBJECT, new String[] { "1", "2" }, new Long[] { 1l, 2l }); } public void testShort() throws Throwable { testNumber(Short.class, NumberInfo.SHORT_OBJECT, new String[] { "1", "2" }, new Short[] { 1, 2 }); } /* public void testAtomicInt() throws Throwable { testNumber(AtomicInteger.class, NumberInfo.ATOMIC_INT, new String[] { "1", "2" }, new AtomicInteger[] {new AtomicInteger(1), new AtomicInteger(2)}); } public void testAtomicLong() throws Throwable { testNumber(AtomicLong.class, NumberInfo.ATOMIC_INT, new String[] { "1", "2" }, new AtomicLong[] {new AtomicLong(1), new AtomicLong(2)}); } */ protected void testNumber(Class clazz, NumberInfo number, String[] values, T[] types) throws Throwable { TypeInfo info = testBasics(clazz, number); assertFalse(info.isArray()); assertFalse(info.isEnum()); assertFalse(info.isPrimitive()); if (values == null) return; testArray(clazz, info); testValues(clazz, info, values, types); } }././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/JavassistPrimitiveUnitTestCase.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/JavassistPrimitiveUn0000644000175000017500000000321610533536206033457 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.test; import junit.framework.Test; import org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactory; import org.jboss.reflect.spi.TypeInfoFactory; /** * JavassistPrimitiveUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class JavassistPrimitiveUnitTestCase extends ClassInfoPrimitiveTest { public JavassistPrimitiveUnitTestCase(String name) { super(name); } public static Test suite() { return suite(JavassistPrimitiveUnitTestCase.class); } protected TypeInfoFactory getTypeInfoFactory() { return new JavassistTypeInfoFactory(); } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/ClassInfoGenericInterfaceTest.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/ClassInfoGenericInte0000644000175000017500000000445310756326650033325 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.test; import java.lang.reflect.Modifier; import org.jboss.reflect.plugins.ClassInfoImpl; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.test.classinfo.support.ClassInfoGenericFieldsInterface; import org.jboss.test.classinfo.support.ClassInfoGenericMethodsInterface; /** * ClassInfoInterfaceTest. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public abstract class ClassInfoGenericInterfaceTest extends AbstractClassInfoTest { public ClassInfoGenericInterfaceTest(String name) { super(name); } public void testGenericMethodsInterface() throws Throwable { testGenericInterface(ClassInfoGenericMethodsInterface.class); } public void testGenericFieldsInterface() throws Throwable { testGenericInterface(ClassInfoGenericFieldsInterface.class); } private void testGenericInterface(Class clazz) throws Throwable { ClassInfoImpl expected = new ClassInfoImpl(clazz.getName(), Modifier.PUBLIC); TypeInfo info = testBasics(clazz, expected); assertFalse(info.isArray()); assertFalse(info.isEnum()); assertFalse(info.isPrimitive()); ClassInfo classInfo = (ClassInfo) info; assertClassInfo(classInfo, clazz); } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/IntrospectionPrimitiveUnitTestCase.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/IntrospectionPrimiti0000644000175000017500000000325210533536206033512 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.test; import junit.framework.Test; import org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactory; import org.jboss.reflect.spi.TypeInfoFactory; /** * IntrospectionPrimitiveUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class IntrospectionPrimitiveUnitTestCase extends ClassInfoPrimitiveTest { public IntrospectionPrimitiveUnitTestCase(String name) { super(name); } public static Test suite() { return suite(IntrospectionPrimitiveUnitTestCase.class); } protected TypeInfoFactory getTypeInfoFactory() { return new IntrospectionTypeInfoFactory(); } } libjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/ClassInfoTest.java0000644000175000017500000007254210756326650032774 0ustar twernertwerner/* * 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.classinfo.test; import java.io.Serializable; import java.net.URL; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import org.jboss.reflect.plugins.ConstructorInfoImpl; import org.jboss.reflect.plugins.FieldInfoImpl; import org.jboss.reflect.plugins.MethodInfoImpl; import org.jboss.reflect.plugins.ParameterInfoImpl; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.ConstructorInfo; 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.ParameterInfo; import org.jboss.reflect.spi.PrimitiveInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.reflect.spi.TypeInfoFactory; import org.jboss.test.ContainerTest; import org.jboss.test.classinfo.support.AnotherBean; import org.jboss.test.classinfo.support.AnotherInterface; import org.jboss.test.classinfo.support.SimpleBean; import org.jboss.test.classinfo.support.SimpleInterface; /** * ClassInfo Test Case. * * @author Adrian Brock * @version $Revision: 69888 $ */ public abstract class ClassInfoTest extends ContainerTest { public ClassInfoTest(String name) { super(name); } public void testSimpleBeanClassInfo() throws Throwable { ClassInfo cinfo = getClassInfo(SimpleBean.class); assertEquals(SimpleBean.class.getName(), cinfo.getName()); ClassInfo supercinfo = cinfo.getSuperclass(); assertNotNull(supercinfo); assertEquals(Object.class.getName(), supercinfo.getName()); HashSet expected = new HashSet(); expected.add(Serializable.class.getName()); expected.add(SimpleInterface.class.getName()); checkTypeSet(expected, cinfo.getInterfaces()); } public void testSimpleInterfaceClassInfo() throws Throwable { InterfaceInfo simpleInterfaceInfo = getSimpleInterfaceInfo(); assertEquals(SimpleInterface.class.getName(), simpleInterfaceInfo.getName()); InterfaceInfo[] superInterfaces = simpleInterfaceInfo.getInterfaces(); assertTrue("No super interfaces ", superInterfaces == null); } public void testSimpleInterfaceFields() throws Throwable { InterfaceInfo simpleInterfaceInfo = getSimpleInterfaceInfo(); checkFields(getSimpleInterfaceFields(), simpleInterfaceInfo.getDeclaredFields()); } public void testSimpleInterfaceMethods() throws Throwable { InterfaceInfo simpleInterfaceInfo = getSimpleInterfaceInfo(); checkMethods(getSimpleInterfaceMethods(), simpleInterfaceInfo.getDeclaredMethods()); } public void testAnotherInterfaceMethod() throws Throwable { InterfaceInfo anotherInterfaceInfo = getAnotherInterfaceInfo(); compareMethod(getAnotherInterfaceSomeMethod(), anotherInterfaceInfo.getDeclaredMethod("someMethod", null)); } public void testSimpleBeanFields() throws Throwable { ClassInfo cinfo = getClassInfo(SimpleBean.class); checkFields(getSimpleBeanFields(), cinfo.getDeclaredFields()); } public void testSimpleBeanMethods() throws Throwable { ClassInfo cinfo = getClassInfo(SimpleBean.class); checkMethods(getSimpleBeanMethods(), cinfo.getDeclaredMethods()); } public void testAnotherBeanMethod() throws Throwable { ClassInfo anotherBeanInfo = getClassInfo(AnotherBean.class); compareMethod(getAnotherBeanSomeMethod(), anotherBeanInfo.getDeclaredMethod("someMethod", null)); } public void testSimpleBeanConstructors() throws Throwable { ClassInfo cinfo = getClassInfo(SimpleBean.class); checkConstructors(getSimpleBeanConstructors(), cinfo.getDeclaredConstructors()); } protected ClassInfo getClassInfo(Class clazz) { TypeInfoFactory factory = getTypeInfoFactory(); TypeInfo info = factory.getTypeInfo(clazz); assertNotNull(info); assertTrue(info instanceof ClassInfo); ClassInfo cinfo = (ClassInfo) info; getLog().debug(cinfo); return cinfo; } protected InterfaceInfo getSimpleInterfaceInfo() { ClassInfo cinfo = getClassInfo(SimpleBean.class); InterfaceInfo simpleInterfaceInfo = null; InterfaceInfo[] interfaces = cinfo.getInterfaces(); for (int i = 0; i < interfaces.length; ++i) { if (SimpleInterface.class.getName().equals(interfaces[i].getName())) { simpleInterfaceInfo = interfaces[i]; break; } } assertNotNull(simpleInterfaceInfo); getLog().debug(simpleInterfaceInfo); return simpleInterfaceInfo; } protected InterfaceInfo getAnotherInterfaceInfo() { ClassInfo cinfo = getClassInfo(AnotherBean.class); InterfaceInfo anotherInterfaceInfo = null; InterfaceInfo[] interfaces = cinfo.getInterfaces(); for (int i = 0; i < interfaces.length; ++i) { if (AnotherInterface.class.getName().equals(interfaces[i].getName())) { anotherInterfaceInfo = interfaces[i]; break; } } assertNotNull(anotherInterfaceInfo); getLog().debug(anotherInterfaceInfo); return anotherInterfaceInfo; } protected void checkTypeSet(HashSet expected, TypeInfo[] typeInfos) throws Throwable { HashSet actual = new HashSet(); for (int i = 0; i < typeInfos.length; ++i) actual.add(typeInfos[i].getName()); HashSet expectClone = new HashSet(expected); HashSet actualClone = new HashSet(actual); getLog().debug("checkTypeSet expect=" + expected); getLog().debug("checkTypeSet actual=" + actual); expectClone.removeAll(actual); assertTrue("Expected " + expectClone, expectClone.isEmpty()); actualClone.removeAll(expected); assertTrue("Did not expect " + actualClone, actualClone.isEmpty()); } protected void checkFields(Set expected, FieldInfo[] actually) throws Throwable { HashSet expectClone = new HashSet(expected); ArrayList actualClone = new ArrayList(Arrays.asList(actually)); getLog().debug("checkFields expect=" + expectClone); getLog().debug("checkFields actual=" + actualClone); expectClone.removeAll(actualClone); assertTrue("Expected " + expectClone, expectClone.isEmpty()); actualClone.removeAll(expected); assertTrue("Did not expect " + actualClone, actualClone.isEmpty()); expectClone = new HashSet(expected); actualClone = new ArrayList(Arrays.asList(actually)); for (Iterator i = expectClone.iterator(); i.hasNext();) { FieldInfo expect = i.next(); int j = actualClone.indexOf(expect); FieldInfo actual = actualClone.get(j); compareField(expect, actual); } } protected void compareField(FieldInfo expect, FieldInfo actual) throws Throwable { getLog().debug("CompareField expect=" + expect + " actual=" + actual); assertEquals("Name", expect.getName(), actual.getName()); assertEquals("Type", expect.getType(), actual.getType()); assertEquals("Modifiers", expect.getModifiers(), actual.getModifiers()); assertEquals("Declaring Class", expect.getDeclaringClass(), actual.getDeclaringClass()); assertEquals("Annotations", expect.getAnnotations(), actual.getAnnotations()); } protected void checkMethods(Set expected, MethodInfo[] actually) throws Throwable { HashSet expectClone = new HashSet(expected); ArrayList actualClone = new ArrayList(Arrays.asList(actually)); getLog().debug("checkMethods expect=" + expectClone); getLog().debug("checkMethods actual=" + actualClone); expectClone.removeAll(actualClone); assertTrue("Expected " + expectClone, expectClone.isEmpty()); actualClone.removeAll(expected); assertTrue("Did not expect " + actualClone, actualClone.isEmpty()); expectClone = new HashSet(expected); actualClone = new ArrayList(Arrays.asList(actually)); for (Iterator i = expectClone.iterator(); i.hasNext();) { MethodInfo expect = i.next(); int j = actualClone.indexOf(expect); MethodInfo actual = actualClone.get(j); compareMethod(expect, actual); } } protected void compareMethod(MethodInfo expect, MethodInfo actual) throws Throwable { getLog().debug("MethodField expect=" + expect + " actual=" + actual); assertNotNull("Null method info", actual); assertEquals("Name", expect.getName(), actual.getName()); assertEquals("ReturnType", expect.getReturnType(), actual.getReturnType()); assertEquals("ParameterTypes", expect.getParameterTypes(), actual.getParameterTypes()); assertEquals("Parameters", expect.getParameters(), actual.getParameters()); assertEquals("Exceptions", expect.getExceptionTypes(), actual.getExceptionTypes()); assertEquals("Modifiers", expect.getModifiers(), actual.getModifiers()); assertEquals("Declaring Class", expect.getDeclaringClass(), actual.getDeclaringClass()); assertEquals("Annotations", expect.getAnnotations(), actual.getAnnotations()); } protected void checkConstructors(Set expected, ConstructorInfo[] actually) throws Throwable { HashSet expectClone = new HashSet(expected); ArrayList actualClone = new ArrayList(Arrays.asList(actually)); getLog().debug("checkConstructors expect=" + expectClone); getLog().debug("checkConstructors actual=" + actualClone); expectClone.removeAll(actualClone); assertTrue("Expected " + expectClone, expectClone.isEmpty()); actualClone.removeAll(expected); assertTrue("Did not expect " + actualClone, actualClone.isEmpty()); expectClone = new HashSet(expected); actualClone = new ArrayList(Arrays.asList(actually)); for (Iterator i = expectClone.iterator(); i.hasNext();) { ConstructorInfo expect = i.next(); int j = actualClone.indexOf(expect); ConstructorInfo actual = actualClone.get(j); compareConstructor(expect, actual); } } protected void compareConstructor(ConstructorInfo expect, ConstructorInfo actual) throws Throwable { getLog().debug("ConstructorField expect=" + expect + " actual=" + actual); assertEquals("ParameterTypes", expect.getParameterTypes(), actual.getParameterTypes()); assertEquals("Parameters", expect.getParameters(), actual.getParameters()); assertEquals("Exceptions", expect.getExceptionTypes(), actual.getExceptionTypes()); assertEquals("Modifiers", expect.getModifiers(), actual.getModifiers()); assertEquals("Declaring Class", expect.getDeclaringClass(), actual.getDeclaringClass()); assertEquals("Annotations", expect.getAnnotations(), actual.getAnnotations()); } protected Set getSimpleInterfaceFields() { TypeInfoFactory factory = getTypeInfoFactory(); ClassInfo simpleInterface = (ClassInfo) factory.getTypeInfo(SimpleInterface.class); TypeInfo objectType = factory.getTypeInfo(Object.class); HashSet result = new HashSet(); result.add(new FieldInfoImpl(null, "A_CONSTANT", objectType, ModifierInfo.PUBLIC_CONSTANT, simpleInterface)); return result; } protected Set getSimpleInterfaceMethods() { TypeInfoFactory factory = getTypeInfoFactory(); ClassInfo simpleInterface = (ClassInfo) factory.getTypeInfo(SimpleInterface.class); TypeInfo boolType = PrimitiveInfo.BOOLEAN; ParameterInfo boolParam = new ParameterInfoImpl(null, "arg0", boolType); ParameterInfo[] boolParameters = new ParameterInfo[] { boolParam }; TypeInfo booleanType = factory.getTypeInfo(Boolean.class); TypeInfo intType = PrimitiveInfo.INT; ParameterInfo intParam = new ParameterInfoImpl(null, "arg0", intType); ParameterInfo[] intParameters = new ParameterInfo[] { intParam }; TypeInfo objectType = factory.getTypeInfo(Object.class); ParameterInfo objectParam = new ParameterInfoImpl(null, "arg0", objectType); ParameterInfo[] objectParameters = new ParameterInfo[] { objectParam }; TypeInfo stringType = factory.getTypeInfo(String.class); ParameterInfo stringParam = new ParameterInfoImpl(null, "arg0", stringType); ParameterInfo[] stringParameters = new ParameterInfo[] { stringParam }; TypeInfo urlType = factory.getTypeInfo(URL.class); ParameterInfo urlParam = new ParameterInfoImpl(null, "arg1", urlType); ParameterInfo[] twoParameters = new ParameterInfo[] { stringParam, urlParam }; TypeInfo voidType = PrimitiveInfo.VOID; HashSet result = new HashSet(); result.add(new MethodInfoImpl(null, "getWithoutSetter", stringType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC_ABSTRACT, simpleInterface)); result.add(new MethodInfoImpl(null, "getWithNoSetterOnInterface", stringType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC_ABSTRACT, simpleInterface)); result.add(new MethodInfoImpl(null, "setWithNoGetterOnInterface", voidType, objectParameters, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC_ABSTRACT, simpleInterface)); result.add(new MethodInfoImpl(null, "setWithoutGetter", voidType, stringParameters, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC_ABSTRACT, simpleInterface)); result.add(new MethodInfoImpl(null, "getWithSetter", stringType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC_ABSTRACT, simpleInterface)); result.add(new MethodInfoImpl(null, "setWithSetter", voidType, stringParameters, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC_ABSTRACT, simpleInterface)); result.add(new MethodInfoImpl(null, "isPrimitiveIS", boolType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC_ABSTRACT, simpleInterface)); result.add(new MethodInfoImpl(null, "isBooleanIS", booleanType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC_ABSTRACT, simpleInterface)); result.add(new MethodInfoImpl(null, "getA", stringType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC_ABSTRACT, simpleInterface)); result.add(new MethodInfoImpl(null, "setA", voidType, stringParameters, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC_ABSTRACT, simpleInterface)); result.add(new MethodInfoImpl(null, "isB", boolType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC_ABSTRACT, simpleInterface)); result.add(new MethodInfoImpl(null, "setB", voidType, boolParameters, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC_ABSTRACT, simpleInterface)); result.add(new MethodInfoImpl(null, "getDoesNotMatchSetter", stringType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC_ABSTRACT, simpleInterface)); result.add(new MethodInfoImpl(null, "setDoesNotMatchGetter", voidType, objectParameters, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC_ABSTRACT, simpleInterface)); result.add(new MethodInfoImpl(null, "methodWithNoReturnTypeNoParameters", voidType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC_ABSTRACT, simpleInterface)); result.add(new MethodInfoImpl(null, "methodWithNoReturnTypeOneParameter", voidType, stringParameters, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC_ABSTRACT, simpleInterface)); result.add(new MethodInfoImpl(null, "methodWithNoReturnTypeTwoParameters", voidType, twoParameters, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC_ABSTRACT, simpleInterface)); result.add(new MethodInfoImpl(null, "methodWithReturnTypeNoParameters", objectType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC_ABSTRACT, simpleInterface)); result.add(new MethodInfoImpl(null, "methodWithReturnTypeOneParameter", stringType, stringParameters, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC_ABSTRACT, simpleInterface)); result.add(new MethodInfoImpl(null, "methodWithReturnTypeTwoParameters", urlType, twoParameters, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC_ABSTRACT, simpleInterface)); result.add(new MethodInfoImpl(null, "get", objectType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC_ABSTRACT, simpleInterface)); result.add(new MethodInfoImpl(null, "is", boolType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC_ABSTRACT, simpleInterface)); result.add(new MethodInfoImpl(null, "set", voidType, objectParameters, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC_ABSTRACT, simpleInterface)); result.add(new MethodInfoImpl(null, "methodWithPrimitiveReturnType", intType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC_ABSTRACT, simpleInterface)); result.add(new MethodInfoImpl(null, "methodWithPrimitiveParameter", voidType, intParameters, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC_ABSTRACT, simpleInterface)); result.add(new MethodInfoImpl(null, "overloadedMethod", voidType, objectParameters, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC_ABSTRACT, simpleInterface)); result.add(new MethodInfoImpl(null, "overloadedMethod", voidType, stringParameters, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC_ABSTRACT, simpleInterface)); return result; } protected MethodInfo getAnotherInterfaceSomeMethod() { TypeInfoFactory factory = getTypeInfoFactory(); TypeInfo voidType = PrimitiveInfo.VOID; ClassInfo anotherInterface = (ClassInfo) factory.getTypeInfo(AnotherInterface.class); return new MethodInfoImpl(null, "someMethod", voidType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC_ABSTRACT, anotherInterface); } protected Set getSimpleBeanFields() { TypeInfoFactory factory = getTypeInfoFactory(); TypeInfo longType = PrimitiveInfo.LONG; ClassInfo simpleBean = (ClassInfo) factory.getTypeInfo(SimpleBean.class); TypeInfo objectType = factory.getTypeInfo(Object.class); HashSet result = new HashSet(); result.add(new FieldInfoImpl(null, "PUBLIC_CONSTANT", objectType, ModifierInfo.PUBLIC_CONSTANT, simpleBean)); result.add(new FieldInfoImpl(null, "PACKAGE_PRIVATE_CONSTANT", objectType, ModifierInfo.PACKAGE_CONSTANT, simpleBean)); result.add(new FieldInfoImpl(null, "PROTECTED_CONSTANT", objectType, ModifierInfo.PROTECTED_CONSTANT, simpleBean)); result.add(new FieldInfoImpl(null, "PRIVATE_CONSTANT", objectType, ModifierInfo.PRIVATE_CONSTANT, simpleBean)); result.add(new FieldInfoImpl(null, "serialVersionUID", longType, ModifierInfo.PRIVATE_CONSTANT, simpleBean)); result.add(new FieldInfoImpl(null, "publicAttribute", objectType, ModifierInfo.PUBLIC, simpleBean)); result.add(new FieldInfoImpl(null, "packagePrivateAttribute", objectType, ModifierInfo.PACKAGE, simpleBean)); result.add(new FieldInfoImpl(null, "protectedAttribute", objectType, ModifierInfo.PROTECTED, simpleBean)); result.add(new FieldInfoImpl(null, "privateAttribute", objectType, ModifierInfo.PRIVATE, simpleBean)); return result; } protected Set getSimpleBeanMethods() { TypeInfoFactory factory = getTypeInfoFactory(); ClassInfo simpleBean = (ClassInfo) factory.getTypeInfo(SimpleBean.class); TypeInfo boolType = PrimitiveInfo.BOOLEAN; ParameterInfo boolParam = new ParameterInfoImpl(null, "arg0", boolType); ParameterInfo[] boolParameters = new ParameterInfo[] { boolParam }; TypeInfo booleanType = factory.getTypeInfo(Boolean.class); TypeInfo intType = PrimitiveInfo.INT; ParameterInfo intParam = new ParameterInfoImpl(null, "arg0", intType); ParameterInfo[] intParameters = new ParameterInfo[] { intParam }; TypeInfo objectType = factory.getTypeInfo(Object.class); ParameterInfo objectParam = new ParameterInfoImpl(null, "arg0", objectType); ParameterInfo[] objectParameters = new ParameterInfo[] { objectParam }; TypeInfo stringType = factory.getTypeInfo(String.class); ParameterInfo stringParam = new ParameterInfoImpl(null, "arg0", stringType); ParameterInfo[] stringParameters = new ParameterInfo[] { stringParam }; TypeInfo urlType = factory.getTypeInfo(URL.class); ParameterInfo urlParam = new ParameterInfoImpl(null, "arg1", urlType); ParameterInfo[] twoParameters = new ParameterInfo[] { stringParam, urlParam }; TypeInfo voidType = PrimitiveInfo.VOID; HashSet result = new HashSet(); result.add(new MethodInfoImpl(null, "getWithoutSetter", stringType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC, simpleBean)); result.add(new MethodInfoImpl(null, "getWithNoSetterOnInterface", stringType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC, simpleBean)); result.add(new MethodInfoImpl(null, "setWithNoGetterOnInterface", voidType, objectParameters, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC, simpleBean)); result.add(new MethodInfoImpl(null, "setWithoutGetter", voidType, stringParameters, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC, simpleBean)); result.add(new MethodInfoImpl(null, "getWithSetter", stringType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC, simpleBean)); result.add(new MethodInfoImpl(null, "setWithSetter", voidType, stringParameters, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC, simpleBean)); result.add(new MethodInfoImpl(null, "isPrimitiveIS", boolType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC, simpleBean)); result.add(new MethodInfoImpl(null, "isBooleanIS", booleanType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC, simpleBean)); result.add(new MethodInfoImpl(null, "getA", stringType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC, simpleBean)); result.add(new MethodInfoImpl(null, "setA", voidType, stringParameters, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC, simpleBean)); result.add(new MethodInfoImpl(null, "isB", boolType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC, simpleBean)); result.add(new MethodInfoImpl(null, "setB", voidType, boolParameters, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC, simpleBean)); result.add(new MethodInfoImpl(null, "getDoesNotMatchSetter", stringType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC, simpleBean)); result.add(new MethodInfoImpl(null, "setDoesNotMatchGetter", voidType, objectParameters, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC, simpleBean)); result.add(new MethodInfoImpl(null, "methodWithNoReturnTypeNoParameters", voidType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC, simpleBean)); result.add(new MethodInfoImpl(null, "methodWithNoReturnTypeOneParameter", voidType, stringParameters, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC, simpleBean)); result.add(new MethodInfoImpl(null, "methodWithNoReturnTypeTwoParameters", voidType, twoParameters, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC, simpleBean)); result.add(new MethodInfoImpl(null, "methodWithReturnTypeNoParameters", objectType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC, simpleBean)); result.add(new MethodInfoImpl(null, "methodWithReturnTypeOneParameter", stringType, stringParameters, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC, simpleBean)); result.add(new MethodInfoImpl(null, "methodWithReturnTypeTwoParameters", urlType, twoParameters, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC, simpleBean)); result.add(new MethodInfoImpl(null, "get", objectType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC, simpleBean)); result.add(new MethodInfoImpl(null, "is", boolType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC, simpleBean)); result.add(new MethodInfoImpl(null, "set", voidType, objectParameters, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC, simpleBean)); result.add(new MethodInfoImpl(null, "methodWithPrimitiveReturnType", intType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC, simpleBean)); result.add(new MethodInfoImpl(null, "methodWithPrimitiveParameter", voidType, intParameters, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC, simpleBean)); result.add(new MethodInfoImpl(null, "overloadedMethod", voidType, objectParameters, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC, simpleBean)); result.add(new MethodInfoImpl(null, "overloadedMethod", voidType, stringParameters, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC, simpleBean)); result.add(new MethodInfoImpl(null, "publicStaticMethod", voidType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC_STATIC, simpleBean)); result.add(new MethodInfoImpl(null, "packagePrivateStaticMethod", voidType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PACKAGE_STATIC, simpleBean)); result.add(new MethodInfoImpl(null, "protectedStaticMethod", voidType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PROTECTED_STATIC, simpleBean)); result.add(new MethodInfoImpl(null, "privateStaticMethod", voidType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PRIVATE_STATIC, simpleBean)); result.add(new MethodInfoImpl(null, "packagePrivateMethod", voidType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PACKAGE, simpleBean)); result.add(new MethodInfoImpl(null, "protectedMethod", voidType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PROTECTED, simpleBean)); result.add(new MethodInfoImpl(null, "privateMethod", voidType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PRIVATE, simpleBean)); return result; } protected MethodInfo getAnotherBeanSomeMethod() { TypeInfoFactory factory = getTypeInfoFactory(); TypeInfo voidType = PrimitiveInfo.VOID; ClassInfo anotherBean = (ClassInfo) factory.getTypeInfo(AnotherBean.class); return new MethodInfoImpl(null, "someMethod", voidType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC, anotherBean); } protected Set getSimpleBeanConstructors() { TypeInfoFactory factory = getTypeInfoFactory(); ClassInfo simpleBean = (ClassInfo) factory.getTypeInfo(SimpleBean.class); TypeInfo stringType = factory.getTypeInfo(String.class); ParameterInfo stringParam = new ParameterInfoImpl(null, "arg0", stringType); ParameterInfo[] stringParameters = new ParameterInfo[] { stringParam }; TypeInfo boolType = PrimitiveInfo.BOOLEAN; ParameterInfo boolParam = new ParameterInfoImpl(null, "arg0", boolType); ParameterInfo[] boolParameters = new ParameterInfo[] { boolParam }; TypeInfo intType = PrimitiveInfo.INT; ParameterInfo intParam = new ParameterInfoImpl(null, "arg0", intType); ParameterInfo[] intParameters = new ParameterInfo[] { intParam }; TypeInfo objectType = factory.getTypeInfo(Object.class); ParameterInfo objectParam = new ParameterInfoImpl(null, "arg0", objectType); ParameterInfo[] objectParameters = new ParameterInfo[] { objectParam }; HashSet result = new HashSet(); result.add(new ConstructorInfoImpl(null, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC, simpleBean)); result.add(new ConstructorInfoImpl(null, stringParameters, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC, simpleBean)); result.add(new ConstructorInfoImpl(null, objectParameters, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PACKAGE, simpleBean)); result.add(new ConstructorInfoImpl(null, intParameters, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PROTECTED, simpleBean)); result.add(new ConstructorInfoImpl(null, boolParameters, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PRIVATE, simpleBean)); return result; } protected abstract TypeInfoFactory getTypeInfoFactory(); protected void configureLogging() { enableTrace("org.jboss.reflect"); } }././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/MethodAccessRestrictionTestCase.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/MethodAccessRestrict0000644000175000017500000000751011010514643033367 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.test; import java.lang.reflect.Method; import junit.framework.Test; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.MethodInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl; import org.jboss.test.classinfo.support.MethodsClass; /** * Access restriction test. * * @author Ales Justin */ public class MethodAccessRestrictionTestCase extends AccessRestrictionTest { /** * Create a new MethodAccessRestrictionTestCase. * * @param name the test name */ public MethodAccessRestrictionTestCase(String name) { super(name); } public static Test suite() { return suite(MethodAccessRestrictionTestCase.class); } protected MethodsClass getInstance() { return new MethodsClass(); } protected Class getInstanceClass() { return MethodsClass.class; } protected MethodInfo getInfo() { return new ReflectMethodInfoImpl(); } protected String getGetter(String member) { return "get" + member.substring(0, 1).toUpperCase() + member.substring(1); } protected String getSetter(String member) { return "set" + member.substring(0, 1).toUpperCase() + member.substring(1); } protected MethodInfo getSetAnnotatedInfo(ClassInfo info, String member) { return info.getDeclaredMethod(getSetter(member), new TypeInfo[]{configuration.getClassInfo(String.class)}); } protected MethodInfo getGetAnnotatedInfo(ClassInfo info, String member) { return info.getDeclaredMethod(getGetter(member), new TypeInfo[]{}); } protected Method getAccessibleObject(String member) throws NoSuchMethodException { return getInstanceClass().getDeclaredMethod(getGetter(member)); } protected void set(MethodInfo annotatedInfo, MethodsClass instance, String string) throws Throwable { annotatedInfo.invoke(instance, new Object[]{string}); } protected Object get(MethodInfo annotatedInfo, MethodsClass instance) throws Throwable { return annotatedInfo.invoke(instance, new Object[]{}); } protected void set(Method accessibleObject, MethodsClass instance, String string) throws Exception { accessibleObject.invoke(instance, string); } protected void set(MethodInfo info, Method accessibleObject) { ((ReflectMethodInfoImpl)info).setMethod(accessibleObject); } protected String getPrivateString(MethodsClass instance) { return instance.getPrivStringNotGetter(); } protected Method getAccessibleObject(MethodInfo info) { return ((ReflectMethodInfoImpl)info).getMethod(); } }././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/ClassInfoArrayTest.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/ClassInfoArrayTest.j0000644000175000017500000001124610656207500033264 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.test; import org.jboss.reflect.plugins.ArrayInfoImpl; import org.jboss.reflect.spi.ArrayInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.reflect.spi.TypeInfoFactory; import org.jboss.test.classinfo.support.ClassInfoAnnotationClass; /** * ClassInfoArrayTest. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public abstract class ClassInfoArrayTest extends AbstractClassInfoTest { public ClassInfoArrayTest(String name) { super(name); } public void testSimpleArray() throws Throwable { String[] array = new String[0]; testArray(array); } public void testByteArray() throws Throwable { byte[] array = {1, 2, 3, 4}; testArray(array); } public void test2DByteArray() throws Throwable { byte[][] array = {{1, 2, 3, 4}, {5, 6, 7, 8}}; testArray(array); } public void testCharArray() throws Throwable { char[] array = {'h', 'e', 'l', 'l', 'o'}; testArray(array); } public void testCharacterArray() throws Throwable { Character[] array = {'h', 'e', 'l', 'l', 'o'}; testArray(array); } public void test2DCharacterArray() throws Throwable { Character[][] array = {{'h', 'e', 'l', 'l', 'o'}, {'w', 'o', 'r', 'l', 'd'}}; testArray(array); } public void testfloatArray() throws Throwable { float[] array = {1.0f, 2.0f, 3f, 4f}; testArray(array); } public void testFloatArray() throws Throwable { Float[] array = {1.0f, 2.0f, 3f, 4f}; testArray(array); } public void testNumberArray() throws Throwable { Number[] array = {1, 2, 3, 4}; testArray(array); } public void testArrayType() { String[] array = {"hello", "world"}; TypeInfoFactory factory = getTypeInfoFactory(); ArrayInfo info = (ArrayInfo) factory.getTypeInfo(array.getClass()); assertEquals(info.getName(), "[Ljava.lang.String;", info.getName()); TypeInfo info0 = info.getComponentType(); assertEquals(info0.getName(), "java.lang.String", info0.getName()); } public void test2DArrayType() { String[][] array = {{"hello"}, {"world"}}; TypeInfoFactory factory = getTypeInfoFactory(); ArrayInfo info = (ArrayInfo) factory.getTypeInfo(array.getClass()); assertEquals(info.getName(), "[[Ljava.lang.String;", info.getName()); ArrayInfo info0 = (ArrayInfo) info.getComponentType(); assertEquals(info0.getName(), "[Ljava.lang.String;", info0.getName()); TypeInfo info1 = info0.getComponentType(); assertEquals(info1.getName(), "java.lang.String", info1.getName()); } public void testDeepArray() throws Throwable { String[][][][][] array = new String[1][2][3][4][0]; testArray(array); } public void testAnnotationArray() throws Throwable { ClassInfoAnnotationClass[] array = new ClassInfoAnnotationClass[0]; testArray(array); } private void testArray(Object array) throws Throwable { TypeInfoFactory factory = getTypeInfoFactory(); Class arrayClass = array.getClass(); Class componentClass = arrayClass.getComponentType(); TypeInfo componentType = factory.getTypeInfo(componentClass); ArrayInfoImpl expected = new ArrayInfoImpl(componentType); TypeInfo info = testBasics(array.getClass(), expected); assertTrue(info.isArray()); assertFalse(info.isEnum()); assertFalse(info.isPrimitive()); ArrayInfo arrayInfo = (ArrayInfo) info; assertEquals(componentType, arrayInfo.getComponentType()); assertClassInfo(arrayInfo, arrayClass); } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/JavassistClassInfoTestCase.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/JavassistClassInfoTe0000644000175000017500000000317410376314651033364 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.test; import junit.framework.Test; import org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactory; import org.jboss.reflect.spi.TypeInfoFactory; /** * Javassist ClassInfo Test Case. * * @author Adrian Brock * @version $Revision: 41318 $ */ public class JavassistClassInfoTestCase extends ClassInfoTest { public static Test suite() { return suite(JavassistClassInfoTestCase.class); } public JavassistClassInfoTestCase(String name) { super(name); } protected TypeInfoFactory getTypeInfoFactory() { return new JavassistTypeInfoFactory(); } }././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/IntrospectionAnnotatedClassInfoTestCase.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/IntrospectionAnnotat0000644000175000017500000000327510445500635033505 0ustar twernertwerner/* * 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.classinfo.test; import junit.framework.Test; import org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactory; import org.jboss.reflect.spi.TypeInfoFactory; /** * Introspection ClassInfo Test Case. * * @author Adrian Brock * @version $Revision: 45663 $ */ public class IntrospectionAnnotatedClassInfoTestCase extends AnnotatedClassInfoTest { public static Test suite() { return suite(IntrospectionAnnotatedClassInfoTestCase.class); } public IntrospectionAnnotatedClassInfoTestCase(String name) { super(name); } protected TypeInfoFactory getTypeInfoFactory() { return new IntrospectionTypeInfoFactory(); } }././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/IntrospectionInterfaceUnitTestCase.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/IntrospectionInterfa0000644000175000017500000000325210533536206033465 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.test; import junit.framework.Test; import org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactory; import org.jboss.reflect.spi.TypeInfoFactory; /** * IntrospectionInterfaceUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class IntrospectionInterfaceUnitTestCase extends ClassInfoInterfaceTest { public IntrospectionInterfaceUnitTestCase(String name) { super(name); } public static Test suite() { return suite(IntrospectionInterfaceUnitTestCase.class); } protected TypeInfoFactory getTypeInfoFactory() { return new IntrospectionTypeInfoFactory(); } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/ClassInfoInterfaceTest.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/ClassInfoInterfaceTe0000644000175000017500000000671210756326650033322 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.test; import java.lang.reflect.Modifier; import org.jboss.reflect.plugins.ClassInfoImpl; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.test.classinfo.support.ClassInfoAnnotationInterface; import org.jboss.test.classinfo.support.ClassInfoEmptyInterface; import org.jboss.test.classinfo.support.ClassInfoFieldAnnotationInterface; import org.jboss.test.classinfo.support.ClassInfoFieldsInterface; import org.jboss.test.classinfo.support.ClassInfoInterfacesInterface; import org.jboss.test.classinfo.support.ClassInfoMethodAnnotationInterface; import org.jboss.test.classinfo.support.ClassInfoMethodParameterAnnotationInterface; import org.jboss.test.classinfo.support.ClassInfoMethodsInterface; /** * ClassInfoInterfaceTest. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public abstract class ClassInfoInterfaceTest extends AbstractClassInfoTest { public ClassInfoInterfaceTest(String name) { super(name); } public void testEmptyInterface() throws Throwable { testInterface(ClassInfoEmptyInterface.class); } public void testInterfacesInterface() throws Throwable { testInterface(ClassInfoInterfacesInterface.class); } public void testMethodsInterface() throws Throwable { testInterface(ClassInfoMethodsInterface.class); } public void testFieldsInterface() throws Throwable { testInterface(ClassInfoFieldsInterface.class); } public void testAnnotationInterface() throws Throwable { testInterface(ClassInfoAnnotationInterface.class); } public void testFieldAnnotationInterface() throws Throwable { testInterface(ClassInfoFieldAnnotationInterface.class); } public void testMethodAnnotationInterface() throws Throwable { testInterface(ClassInfoMethodAnnotationInterface.class); } public void testMethodParameterAnnotationInterface() throws Throwable { testInterface(ClassInfoMethodParameterAnnotationInterface.class); } private void testInterface(Class clazz) throws Throwable { ClassInfoImpl expected = new ClassInfoImpl(clazz.getName(), Modifier.PUBLIC); TypeInfo info = testBasics(clazz, expected); assertFalse(info.isArray()); assertFalse(info.isEnum()); assertFalse(info.isPrimitive()); ClassInfo classInfo = (ClassInfo) info; assertClassInfo(classInfo, clazz); } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/FieldAccessRestrictionTestCase.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/FieldAccessRestricti0000644000175000017500000000651511010514643033347 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.test; import java.lang.reflect.Field; import junit.framework.Test; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.FieldInfo; import org.jboss.reflect.plugins.introspection.ReflectFieldInfoImpl; import org.jboss.test.classinfo.support.FieldsClass; /** * Access restriction test. * * @author Ales Justin */ public class FieldAccessRestrictionTestCase extends AccessRestrictionTest { /** * Create a new FieldAccessRestrictionTestCase. * * @param name the test name */ public FieldAccessRestrictionTestCase(String name) { super(name); } public static Test suite() { return suite(FieldAccessRestrictionTestCase.class); } protected FieldsClass getInstance() { return new FieldsClass(); } protected Class getInstanceClass() { return FieldsClass.class; } protected FieldInfo getInfo() { return new ReflectFieldInfoImpl(); } protected FieldInfo getSetAnnotatedInfo(ClassInfo info, String member) { return info.getDeclaredField(member); } protected FieldInfo getGetAnnotatedInfo(ClassInfo info, String member) { return info.getDeclaredField(member); } protected Field getAccessibleObject(String member) throws NoSuchFieldException { return getInstanceClass().getDeclaredField(member); } protected void set(FieldInfo annotatedInfo, FieldsClass instance, String string) throws Throwable { annotatedInfo.set(instance, string); } protected Object get(FieldInfo annotatedInfo, FieldsClass instance) throws Throwable { return annotatedInfo.get(instance); } protected void set(Field accessibleObject, FieldsClass instance, String string) throws IllegalAccessException { accessibleObject.set(instance, string); } protected void set(FieldInfo info, Field accessibleObject) { ((ReflectFieldInfoImpl)info).setField(accessibleObject); } protected String getPrivateString(FieldsClass instance) { return instance.getPrivString(); } protected Field getAccessibleObject(FieldInfo info) { return ((ReflectFieldInfoImpl)info).getField(); } }././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/IntrospectionGenericClassUnitTestCase.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/IntrospectionGeneric0000644000175000017500000000327210535031562033450 0ustar twernertwerner/* * 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.classinfo.test; import junit.framework.Test; import org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactory; import org.jboss.reflect.spi.TypeInfoFactory; /** * Introspection ClassInfo Test Case. * * @author Adrian Brock * @version $Revision: 45663 $ */ public class IntrospectionGenericClassUnitTestCase extends ClassInfoGenericClassTest { public static Test suite() { return suite(IntrospectionGenericClassUnitTestCase.class); } public IntrospectionGenericClassUnitTestCase(String name) { super(name); } protected TypeInfoFactory getTypeInfoFactory() { return new IntrospectionTypeInfoFactory(); } }././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/AnnotatedClassInfoTest.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/AnnotatedClassInfoTe0000644000175000017500000005376310756326650033347 0ustar twernertwerner/* * 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.classinfo.test; import java.util.HashSet; import org.jboss.reflect.spi.AnnotatedInfo; import org.jboss.reflect.spi.AnnotationInfo; import org.jboss.reflect.spi.AnnotationValue; import org.jboss.reflect.spi.ArrayInfo; import org.jboss.reflect.spi.ArrayValue; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.ClassValue; import org.jboss.reflect.spi.ConstructorInfo; import org.jboss.reflect.spi.EnumValue; import org.jboss.reflect.spi.FieldInfo; import org.jboss.reflect.spi.MethodInfo; import org.jboss.reflect.spi.ParameterInfo; import org.jboss.reflect.spi.PrimitiveInfo; import org.jboss.reflect.spi.PrimitiveValue; import org.jboss.reflect.spi.StringValue; import org.jboss.reflect.spi.TypeInfo; import org.jboss.reflect.spi.TypeInfoFactory; import org.jboss.reflect.spi.Value; import org.jboss.test.ContainerTest; import org.jboss.test.classinfo.support.AnnotatedClass; import org.jboss.test.classinfo.support.AnnotatedSubClass; import org.jboss.test.classinfo.support.AnotherAnnotation; import org.jboss.test.classinfo.support.ComplexAnnotation; import org.jboss.test.classinfo.support.ExpectedAnnotations; import org.jboss.test.classinfo.support.JDK14ExpectedAnnotations; import org.jboss.test.classinfo.support.JDK50ExpectedAnnotations; import org.jboss.test.classinfo.support.SimpleAnnotation; import org.jboss.test.classinfo.support.TestEnum; import org.jboss.test.classinfo.support.ValueAnnotation; /** * * @author Kabir Khan * @version $Revision: 69888 $ */ public abstract class AnnotatedClassInfoTest extends ContainerTest { /** @Retention and @Target are ignored for JDK 1.4 */ final static ExpectedAnnotations expected; static { boolean haveJDK5 = false; try { Class.forName("java.lang.annotation.Target"); haveJDK5 = true; } catch(Exception e) { } if (haveJDK5) { expected = new JDK50ExpectedAnnotations(); } else { expected = new JDK14ExpectedAnnotations(); } } final static Class[] EXPECTED_ANNOTATIONS = expected.getExpectedAnnotations(); final static Class[] ANNOTATION_EXPECTED_ANNOTATIONS = expected.getAnnotationExpectedAnnotations(); final static Class[] COMPLEXANNOTATION_EXPECTED_ANNOTATIONS = expected.getComplexExpectedAnnotations(); final static Class[] FIRST_PARAM_EXPECTED_ANNOTATIONS = expected.getFirstParamExpectedAnnotations(); final static Class[] SECOND_PARAM_EXPECTED_ANNOTATIONS = expected.getSecondParamExpectedAnnotations(); final static ExpectedComplexAnnotationData CLASS_DATA = new ExpectedComplexAnnotationData( "_class", 1, "class_", AnnotatedClass.class, "CLASS", new String[] {"A", "class"}, new Integer[] {new Integer(10), new Integer(1)}, new String[] {"stuffer", "class"}, new Class[] {AnnotatedClass.class}, new String[] {"CLASS", "ARRAY_STUFF"}); final static ExpectedComplexAnnotationData CONSTRUCTOR_DATA = new ExpectedComplexAnnotationData( "_ctor", 3, "ctor_", AnnotatedClass.class, "CONSTRUCTOR", new String[] {"A", "ctor"}, new Integer[] {new Integer(10), new Integer(3)}, new String[] {"stuffer", "ctor"}, new Class[] {AnnotatedClass.class}, new String[] {"CONSTRUCTOR", "ARRAY_STUFF"}); final static ExpectedComplexAnnotationData FIELD_DATA = new ExpectedComplexAnnotationData( "_field", 2, "field_", AnnotatedClass.class, "FIELD", new String[] {"A", "field"}, new Integer[] {new Integer(10), new Integer(2)}, new String[] {"stuffer", "field"}, new Class[] {AnnotatedClass.class}, new String[] {"FIELD", "ARRAY_STUFF"}); final static ExpectedComplexAnnotationData METHOD_DATA = new ExpectedComplexAnnotationData( "The answer is", 42, "method_", Integer.class, "METHOD", new String[] {"The", "answer", "is"}, new Integer[] {new Integer(4), new Integer(2)}, new String[] {"Ann1", "Ann2"}, new Class[] {Integer.class, Long.class}, new String[] {"ARRAY_STUFF", "METHOD"}); final static ExpectedComplexAnnotationData PARAM_DATA = new ExpectedComplexAnnotationData( "1", 42, "method_", Integer.class, "METHOD", new String[] {"The", "answer", "is"}, new Integer[] {new Integer(1)}, new String[] {"Ann1", "Ann2"}, new Class[] {Integer.class, Long.class}, new String[] {"ARRAY_STUFF", "METHOD"}); public AnnotatedClassInfoTest(String name) { super(name); } public void testClassAnnotations() throws Exception { ClassInfo info = getClassInfo(AnnotatedClass.class); checkAnnotations(info, CLASS_DATA); } public void testSubClassAnnotations() throws Exception { ClassInfo info = getClassInfo(AnnotatedSubClass.class); System.out.println("---> Getting annotations"); AnnotationValue[] annotations = info.getAnnotations(); assertEquals(2, annotations.length); AnnotationValue anotherAnnotation = getAnnotationCheckTypeAndName(info, AnotherAnnotation.class.getName()); AnnotationValue simpleAnnotation = getAnnotationCheckTypeAndName(info, SimpleAnnotation.class.getName()); HashSet set = new HashSet(); set.add(anotherAnnotation); set.add(simpleAnnotation); for (int i = 0 ; i < annotations.length ; i++) { set.remove(annotations[i]); } assertTrue("Not found annotations " + set, set.isEmpty()); ConstructorInfo[] ctors = info.getDeclaredConstructors(); assertEquals(1, ctors.length); ConstructorInfo ctor = ctors[0]; annotations = ctor.getAnnotations(); assertEquals(1, annotations.length); anotherAnnotation = getAnnotationCheckTypeAndName(ctor, AnotherAnnotation.class.getName()); } public void testClassArrayAnnotations() throws Exception { Class classArray = new AnnotatedClass[0].getClass(); ClassInfo info = getClassInfo(classArray); assertTrue(ArrayInfo.class.isAssignableFrom(info.getClass())); assertTrue(info.getAnnotations().length == 0); for (Class annotation : EXPECTED_ANNOTATIONS) { assertNull(info.getAnnotation(annotation.getName())); assertFalse(info.isAnnotationPresent(annotation.getName())); } ClassInfo componentInfo = (ClassInfo)((ArrayInfo)info).getComponentType(); checkAnnotations(componentInfo, CLASS_DATA); } public void testSubClassArrayAnnotations() throws Exception { Class classArray = new AnnotatedSubClass[0].getClass(); ClassInfo info = getClassInfo(classArray); assertTrue(ArrayInfo.class.isAssignableFrom(info.getClass())); assertTrue(info.getAnnotations().length == 0); assertNull(info.getAnnotation(AnotherAnnotation.class.getName())); assertFalse(info.isAnnotationPresent(AnotherAnnotation.class.getName())); assertNull(info.getAnnotation(SimpleAnnotation.class.getName())); assertFalse(info.isAnnotationPresent(SimpleAnnotation.class.getName())); ClassInfo componentInfo = (ClassInfo)((ArrayInfo)info).getComponentType(); AnnotationValue[] annotations = componentInfo.getAnnotations(); assertEquals(2, annotations.length); AnnotationValue anotherAnnotation = getAnnotationCheckTypeAndName(componentInfo, AnotherAnnotation.class.getName()); AnnotationValue simpleAnnotation = getAnnotationCheckTypeAndName(componentInfo, SimpleAnnotation.class.getName()); HashSet set = new HashSet(); set.add(anotherAnnotation); set.add(simpleAnnotation); for (int i = 0 ; i < annotations.length ; i++) { set.remove(annotations[i]); } assertTrue("Not found annotations " + set, set.isEmpty()); } public void testConstructorAnnotations() throws Exception { ClassInfo info = getClassInfo(AnnotatedClass.class); ConstructorInfo[] constructors = info.getDeclaredConstructors(); assertEquals(1, constructors.length); checkAnnotations(constructors[0], CONSTRUCTOR_DATA); } public void testFieldAnnotations() throws Exception { ClassInfo info = getClassInfo(AnnotatedClass.class); FieldInfo[] fields = info.getDeclaredFields(); assertEquals(1, fields.length); checkAnnotations(fields[0], FIELD_DATA); } public void testMethodAnnotations() throws Exception { ClassInfo info = getClassInfo(AnnotatedClass.class); MethodInfo[] methods = info.getDeclaredMethods(); assertEquals(1, methods.length); checkAnnotations(methods[0], METHOD_DATA); } public void testConstructorParameterAnnotations() throws Exception { ClassInfo info = getClassInfo(AnnotatedClass.class); ConstructorInfo[] constructors = info.getDeclaredConstructors(); assertEquals(1, constructors.length); checkParameterAnnotations(constructors[0].getParameters()); } public void testMethodParameterAnnotations() throws Exception { ClassInfo info = getClassInfo(AnnotatedClass.class); MethodInfo[] methods = info.getDeclaredMethods(); assertEquals(1, methods.length); checkParameterAnnotations(methods[0].getParameters()); } private void checkAnnotations(AnnotatedInfo info, ExpectedComplexAnnotationData expectedComplexAnnotationData) { AnnotationValue[] annotations = info.getAnnotations(); checkExpectedAnnotations(annotations, EXPECTED_ANNOTATIONS); checkSimpleAnnotation(info); checkComplexAnnotation(info, expectedComplexAnnotationData); } private void checkSimpleAnnotation(AnnotatedInfo info) { AnnotationValue annotation = getAnnotationCheckTypeAndName(info, SimpleAnnotation.class.getName()); AnnotationValue[] annotationAnns = annotation.getAnnotationType().getAnnotations(); assertNotNull(annotationAnns); checkExpectedAnnotations(annotationAnns, ANNOTATION_EXPECTED_ANNOTATIONS); } private void checkComplexAnnotation(AnnotatedInfo info, ExpectedComplexAnnotationData expectedComplexAnnotationData) { AnnotationValue complexAnnotation = getAnnotationCheckTypeAndName(info, ComplexAnnotation.class.getName()); checkComplexAnnotation(complexAnnotation, expectedComplexAnnotationData); } private void checkComplexAnnotation(AnnotationValue complexAnnotation, ExpectedComplexAnnotationData expectedComplexAnnotationData) { AnnotationValue[] annotationAnns = complexAnnotation.getAnnotationType().getAnnotations(); assertNotNull(annotationAnns); checkExpectedAnnotations(annotationAnns, COMPLEXANNOTATION_EXPECTED_ANNOTATIONS); Value value = complexAnnotation.getValue("stringValue"); checkStringValue(value, expectedComplexAnnotationData.stringAttribute); value = complexAnnotation.getValue("intValue"); checkPrimitiveValue(value, "int", expectedComplexAnnotationData.intAttribute); value = complexAnnotation.getValue("annotationValue"); checkContainedAnnotationValue(value, expectedComplexAnnotationData.containedValueAnnotationString); value = complexAnnotation.getValue("clazzValue"); checkClassValue(value, expectedComplexAnnotationData.classAttribute); value = complexAnnotation.getValue("enumValue"); checkEnumValue(value, expectedComplexAnnotationData.enumAttribute); value = complexAnnotation.getValue("stringArrayValue"); checkStringArrayValue(value, expectedComplexAnnotationData.stringArrayAttribute); value = complexAnnotation.getValue("intArrayValue"); checkPrimitiveArrayValue(value, "int", expectedComplexAnnotationData.intArrayAttribute); value = complexAnnotation.getValue("annotationArrayValue"); checkContainedAnnotationArrayValue(value, expectedComplexAnnotationData.containedValueAnnotationArrayString); value = complexAnnotation.getValue("clazzArrayValue"); checkClassArrayValue(value, expectedComplexAnnotationData.classArrayAttribute); value = complexAnnotation.getValue("enumArrayValue"); checkEnumArrayValue(value, expectedComplexAnnotationData.enumArrayAttribute); AnnotationValue valueAnnotation = ((AnnotationInfo)complexAnnotation.getType()).getAnnotation(ValueAnnotation.class.getName()); checkStringValue(valueAnnotation.getValue("value"), expectedComplexAnnotationData.annotationValueAnnotationString); } private void checkStringValue(Value value, String expected) { assertNotNull(value); assertTrue(StringValue.class.isAssignableFrom(value.getClass())); StringValue theVal = (StringValue)value; assertTrue(theVal.getType().getName().equals(String.class.getName())); String val = theVal.getValue(); assertNotNull(val); assertEquals(expected, val); } private void checkStringArrayValue(Value value, String[] expected) { Value[] values = getArrayValuesWithCheck(value, expected); for (int i = 0 ; i < values.length ; i++) { checkStringValue(values[i], expected[i]); } } private void checkPrimitiveValue(Value value, String name, Object expected) { assertNotNull(value); assertTrue(PrimitiveValue.class.isAssignableFrom(value.getClass())); PrimitiveValue val = (PrimitiveValue)value; TypeInfo type = val.getType(); assertTrue(PrimitiveInfo.class.isAssignableFrom(type.getClass())); assertTrue((type).getName().equals(name)); Object obj; try { obj = type.convertValue(val.getValue()); } catch (Throwable e) { throw new RuntimeException(e); } assertNotNull(obj); assertEquals(expected, obj); } private void checkPrimitiveArrayValue(Value value, String name, Object[] expected) { Value[] values = getArrayValuesWithCheck(value, expected); for (int i = 0 ; i < values.length ; i++) { checkPrimitiveValue(values[i], name, expected[i]); } } private void checkClassValue(Value value, Class expected) { assertNotNull(value); ClassValue theVal = (ClassValue)value; String val = theVal.getValue(); assertNotNull(val); assertEquals(val, expected.getName()); } private void checkClassArrayValue(Value value, Class[] expected) { Value[] values = getArrayValuesWithCheck(value, expected); for (int i = 0 ; i < values.length ; i++) { checkClassValue(values[i], expected[i]); } } private void checkEnumValue(Value value, String expected) { assertNotNull(value); assertTrue(EnumValue.class.isAssignableFrom(value.getClass())); EnumValue theVal = (EnumValue)value; TypeInfo info = theVal.getType(); assertNotNull(info); assertEquals(TestEnum.class.getName(), info.getName()); String val = theVal.getValue(); assertNotNull(val); assertEquals(expected, val); } private void checkEnumArrayValue(Value value, String[] expected) { Value[] values = getArrayValuesWithCheck(value, expected); for (int i = 0 ; i < values.length ; i++) { checkEnumValue(values[i], expected[i]); } } private void checkContainedAnnotationValue(Value value, String expected) { assertNotNull(value); assertTrue(AnnotationValue.class.isAssignableFrom(value.getClass())); AnnotationValue val = (AnnotationValue)value; checkValueAnnotation(val, expected); } private void checkValueAnnotation(AnnotationValue val, String expected) { AnnotationInfo info = val.getAnnotationType(); assertTrue(info.getName().equals(ValueAnnotation.class.getName())); Object obj = val.getValue("value"); assertNotNull(obj); assertTrue(StringValue.class.isAssignableFrom(obj.getClass())); checkStringValue((Value)obj, expected); } private void checkContainedAnnotationArrayValue(Value value, String[] expected) { Value[] values = getArrayValuesWithCheck(value, expected); for (int i = 0 ; i < values.length ; i++) { checkContainedAnnotationValue(values[i], expected[i]); } } private Value[] getArrayValuesWithCheck(Value value, Object[] expected) { assertNotNull(value); assertTrue(ArrayValue.class.isAssignableFrom(value.getClass())); ArrayValue array = (ArrayValue)value; Value[] values = array.getValues(); assertNotNull(values); assertEquals("Wrong length", expected.length, values.length); return values; } private AnnotationValue getAnnotationCheckTypeAndName(AnnotatedInfo info, String name) { AnnotationValue annotation = info.getAnnotation(name); assertTrue(info.isAnnotationPresent(name)); assertNotNull(annotation); assertNotNull(annotation.getAnnotationType()); assertEquals(name, annotation.getAnnotationType().getName()); return annotation; } private void checkExpectedAnnotations(AnnotationValue[] values, Class[] expected) { assertEquals(expected.length, values.length); for (int i = 0 ; i < expected.length ; i++) { boolean found = false; for (int j = 0 ; j < values.length ; j++) { if (expected[i].getName().equals(values[j].getAnnotationType().getName())) { found = true; break; } } assertTrue("Found annotation " + expected[i].getName(), found); } } protected ClassInfo getClassInfo(Class clazz) { TypeInfoFactory factory = getTypeInfoFactory(); TypeInfo info = factory.getTypeInfo(clazz); assertNotNull(info); assertTrue(info instanceof ClassInfo); ClassInfo cinfo = (ClassInfo) info; getLog().debug(cinfo); return cinfo; } private void checkParameterAnnotations(ParameterInfo[] params) { assertEquals(2, params.length); ParameterInfo param = getCheckParameter(params, 0, "int"); AnnotationValue[] annotations = param.getAnnotations(); checkExpectedAnnotations(annotations, FIRST_PARAM_EXPECTED_ANNOTATIONS); checkValueAnnotation(annotations[0], "int"); checkComplexAnnotation(annotations[1], PARAM_DATA); param = getCheckParameter(params, 1, "java.lang.String"); annotations = param.getAnnotations(); checkExpectedAnnotations(annotations, SECOND_PARAM_EXPECTED_ANNOTATIONS); checkValueAnnotation(annotations[0], "string"); AnnotationInfo type = annotations[1].getAnnotationType(); assertEquals(SimpleAnnotation.class.getName(), type.getName()); } private ParameterInfo getCheckParameter(ParameterInfo[] params, int index, String typeName) { ParameterInfo param = params[index]; TypeInfo info = param.getParameterType(); assertEquals(typeName, info.getName()); return param; } protected abstract TypeInfoFactory getTypeInfoFactory(); private static class ExpectedComplexAnnotationData { String annotationValueAnnotationString = "annotation_"; String stringAttribute; Integer intAttribute; String containedValueAnnotationString; Class classAttribute; String enumAttribute; String[] stringArrayAttribute; Integer[] intArrayAttribute; String[] containedValueAnnotationArrayString; Class[] classArrayAttribute; String[] enumArrayAttribute; public ExpectedComplexAnnotationData( String stringAttribute, int intAttribute, String containedValueAnnotationString, Class classAttribute, String enumAttribute, String[] stringArrayAttribute, Integer[] intArrayAttribute, String[] containedValueAnnotationArrayString, Class[] classArrayAttribute, String[] enumArrayAttribute) { // this.annotationValueAnnotationString = annotationValueAnnotationString; this.containedValueAnnotationString = containedValueAnnotationString; this.stringAttribute = stringAttribute; this.intAttribute = new Integer(intAttribute); this.classAttribute = classAttribute; this.enumAttribute = enumAttribute; this.stringArrayAttribute = stringArrayAttribute; this.intArrayAttribute = intArrayAttribute; this.containedValueAnnotationArrayString = containedValueAnnotationArrayString; this.classArrayAttribute = classArrayAttribute; this.enumArrayAttribute = enumArrayAttribute; } } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/JavassistClassUnitTestCase.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/JavassistClassUnitTe0000644000175000017500000000351710560664062033410 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.test; import junit.framework.Test; import org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactory; import org.jboss.reflect.spi.PackageInfo; import org.jboss.reflect.spi.TypeInfoFactory; /** * JavassistClassUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class JavassistClassUnitTestCase extends ClassInfoClassTest { public JavassistClassUnitTestCase(String name) { super(name); } public static Test suite() { return suite(JavassistClassUnitTestCase.class); } protected void assertPackageAnnotations(Package pkg, PackageInfo packageInfo) throws Throwable { // TODO JBMICROCONT-130 this is broken for javassist } protected TypeInfoFactory getTypeInfoFactory() { return new JavassistTypeInfoFactory(); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/JavassistNumberUnitTestCase.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/JavassistNumberUnitT0000644000175000017500000000314311033445047033415 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.test; import junit.framework.Test; import org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactory; import org.jboss.reflect.spi.TypeInfoFactory; /** * JavassistNumberUnitTestCase. * * @author Ales Justin */ public class JavassistNumberUnitTestCase extends ClassInfoNumberTest { public JavassistNumberUnitTestCase(String name) { super(name); } public static Test suite() { return suite(JavassistNumberUnitTestCase.class); } protected TypeInfoFactory getTypeInfoFactory() { return new JavassistTypeInfoFactory(); } }././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/IntrospectionCustomValueValueOfTestCase.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/IntrospectionCustomV0000644000175000017500000000305311374537405033502 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file 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.classinfo.test; import org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactory; import org.jboss.reflect.spi.TypeInfoFactory; /** * * @author Kabir Khan * @version $Revision: 1.1 $ */ public class IntrospectionCustomValueValueOfTestCase extends CustomValueValueOfTest { public IntrospectionCustomValueValueOfTestCase(String name) { super(name); } @Override protected TypeInfoFactory getTypeInfoFactory() { return new IntrospectionTypeInfoFactory(); } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/JavassistArrayUnitTestCase.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/JavassistArrayUnitTe0000644000175000017500000000422310560664062033414 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.test; import junit.framework.Test; import org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactory; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.PackageInfo; import org.jboss.reflect.spi.TypeInfoFactory; /** * JavassistArrayUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class JavassistArrayUnitTestCase extends ClassInfoArrayTest { public JavassistArrayUnitTestCase(String name) { super(name); } public static Test suite() { return suite(JavassistArrayUnitTestCase.class); } protected void assertInterfaces(Class clazz, ClassInfo classInfo) throws Throwable { // TODO JBMICROCONT-130 this is broken for javassist } protected void assertModifiers(Class clazz, ClassInfo classInfo) throws Throwable { // TODO JBMICROCONT-130 this is broken for javassist } protected void assertNullPackageInfo(PackageInfo packageInfo) { // TODO JBMICROCONT-130 this is broken for javassist } protected TypeInfoFactory getTypeInfoFactory() { return new JavassistTypeInfoFactory(); } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/AccessRestrictionTest.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/AccessRestrictionTes0000644000175000017500000001701311010514643033407 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.test; import java.lang.reflect.AccessibleObject; import java.security.AccessControlException; import org.jboss.config.plugins.BasicConfiguration; import org.jboss.config.spi.Configuration; import org.jboss.reflect.spi.AnnotatedInfo; import org.jboss.reflect.spi.ClassInfo; import org.jboss.test.AbstractTestCaseWithSetup; import org.jboss.test.AbstractTestDelegate; import org.jboss.test.classinfo.support.ErrorHolderThread; /** * Access restriction test. * * @param exact tester type * @param exact annotated info * @param exact accessible object * @author Ales Justin */ public abstract class AccessRestrictionTest extends AbstractTestCaseWithSetup { /** The bean info factory */ protected Configuration configuration = new BasicConfiguration(); /** * Create a new AccessRestrictionTest. * * @param name the test name */ protected AccessRestrictionTest(String name) { super(name); } /** * Default setup with security manager enabled * * @param clazz the class * @return the delegate * @throws Exception for any error */ public static AbstractTestDelegate getDelegate(Class clazz) throws Exception { AbstractTestDelegate delegate = new AbstractTestDelegate(clazz); delegate.enableSecurity = true; return delegate; } protected ClassInfo getClassInfo(Class clazz) { SecurityManager sm = suspendSecurity(); try { return configuration.getClassInfo(clazz); } finally { resumeSecurity(sm); } } protected abstract T getInstance(); protected abstract Class getInstanceClass(); protected abstract U getInfo(); protected abstract U getSetAnnotatedInfo(ClassInfo info, String member); protected abstract U getGetAnnotatedInfo(ClassInfo info, String member); protected abstract V getAccessibleObject(String member) throws Exception; protected abstract void set(U annotatedInfo, T instance, String string) throws Throwable; protected abstract Object get(U annotatedInfo, T instance) throws Throwable; protected abstract void set(V accessibleObject, T instance, String string) throws Exception; protected abstract void set(U info, V accessibleObject); protected abstract String getPrivateString(T instance); protected abstract V getAccessibleObject(U info); public void testFieldAcessFromMain() throws Throwable { final T tester = getInstance(); final U impl = getInfo(); // I can't do setAccesible V accessibleObject = getAccessibleObject("privString"); // let's try accessible try { accessibleObject.setAccessible(true); fail("Should not be here."); } catch (Throwable t) { assertInstanceOf(t, AccessControlException.class); } // ok, setAccessible not set, so set should also fail try { set(accessibleObject, tester, "foobar"); fail("Should not be here."); } catch (Throwable t) { assertInstanceOf(t, IllegalAccessException.class); } try { set(impl, accessibleObject); fail("Should not be here"); } catch (Throwable t) { checkThrowable(AccessControlException.class, t); } try { set(accessibleObject, tester, "foobar"); fail("Should not be here"); } catch (Throwable t) { checkThrowable(IllegalAccessException.class, t); } assertNull(getPrivateString(tester)); Runnable runnable = new Runnable() { public void run() { try { V ao = getAccessibleObject(impl); // This should have an access check set(ao, tester, "something"); // this should check for caller } catch (Throwable t) { throw new RuntimeException(t); } } }; ErrorHolderThread other = new ErrorHolderThread(runnable); other.start(); other.join(); // we should get an error here assertNotNull("Should get access restriction exception.", other.getError()); RuntimeException re = assertInstanceOf(other.getError(), RuntimeException.class); Throwable cause = re.getCause(); assertNotNull(cause); assertInstanceOf(cause, AccessControlException.class, false); } public void testFieldAccessFromOther() throws Throwable { final T tester = getInstance(); ClassInfo classInfo = configuration.getClassInfo(getInstanceClass()); // we should not fail U pub = getGetAnnotatedInfo(classInfo, "pubString"); assertNotNull(pub); final U priSet = getSetAnnotatedInfo(classInfo, "privString"); final U priGet = getGetAnnotatedInfo(classInfo, "privString"); // Shouldn't be able to set the private field try { set(priSet, tester, "foobar"); fail("Should not be here."); } catch (Throwable t) { assertInstanceOf(t, AccessControlException.class); } // Shouldn't be able to get the private field try { get(priGet, tester); fail("Should not be here."); } catch (Throwable t) { assertInstanceOf(t, AccessControlException.class); } // Shouldn't be able to steal the private field which has setAccessible(true) try { getAccessibleObject(priGet); fail("Should not be here."); } catch (Throwable t) { assertInstanceOf(t, AccessControlException.class); } ErrorHolderThread other = new ErrorHolderThread(new Runnable() { public void run() { SecurityManager sm = suspendSecurity(); try { set(priSet, tester, "foobar"); } catch(Throwable t) { throw new RuntimeException(t); } finally { resumeSecurity(sm); } } }); assertNull(getPrivateString(tester)); other.start(); other.join(); assertNull(other.getError()); assertEquals("foobar", getPrivateString(tester)); } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/ClassInfoClassTest.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/ClassInfoClassTest.j0000644000175000017500000001045510756326650033265 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.test; import java.lang.reflect.Modifier; import org.jboss.reflect.plugins.ClassInfoImpl; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.test.classinfo.support.ClassInfoAbstractMethodsClass; import org.jboss.test.classinfo.support.ClassInfoAnnotationClass; import org.jboss.test.classinfo.support.ClassInfoConstructorAnnotationClass; import org.jboss.test.classinfo.support.ClassInfoConstructorClass; import org.jboss.test.classinfo.support.ClassInfoConstructorParameterAnnotationClass; import org.jboss.test.classinfo.support.ClassInfoEmptyClass; import org.jboss.test.classinfo.support.ClassInfoFieldAnnotationClass; import org.jboss.test.classinfo.support.ClassInfoFieldsClass; import org.jboss.test.classinfo.support.ClassInfoInterfacesClass; import org.jboss.test.classinfo.support.ClassInfoMethodAnnotationClass; import org.jboss.test.classinfo.support.ClassInfoMethodParameterAnnotationClass; import org.jboss.test.classinfo.support.ClassInfoMethodsClass; import org.jboss.test.classinfo.support.ClassInfoSuperClass; /** * ClassInfoClassTest. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public abstract class ClassInfoClassTest extends AbstractClassInfoTest { public ClassInfoClassTest(String name) { super(name); } public void testEmptyClass() throws Throwable { testClass(ClassInfoEmptyClass.class); } public void testSuperClass() throws Throwable { testClass(ClassInfoSuperClass.class); } public void testInterfacesClass() throws Throwable { testClass(ClassInfoInterfacesClass.class); } public void testMethodsClass() throws Throwable { testClass(ClassInfoMethodsClass.class); } public void testAbstractMethodsClass() throws Throwable { testClass(ClassInfoAbstractMethodsClass.class); } public void testFieldsClass() throws Throwable { testClass(ClassInfoFieldsClass.class); } public void testConstructorClass() throws Throwable { testClass(ClassInfoConstructorClass.class); } public void testAnnotationClass() throws Throwable { testClass(ClassInfoAnnotationClass.class); } public void testFieldAnnotationClass() throws Throwable { testClass(ClassInfoFieldAnnotationClass.class); } public void testMethodAnnotationClass() throws Throwable { testClass(ClassInfoMethodAnnotationClass.class); } public void testMethodParameterAnnotationClass() throws Throwable { testClass(ClassInfoMethodParameterAnnotationClass.class); } public void testConstructorAnnotationClass() throws Throwable { testClass(ClassInfoConstructorAnnotationClass.class); } public void testConstructorParameterAnnotationClass() throws Throwable { testClass(ClassInfoConstructorParameterAnnotationClass.class); } private void testClass(Class clazz) throws Throwable { ClassInfoImpl expected = new ClassInfoImpl(clazz.getName(), Modifier.PUBLIC); TypeInfo info = testBasics(clazz, expected); assertFalse(info.isArray()); assertFalse(info.isEnum()); assertFalse(info.isPrimitive()); ClassInfo classInfo = (ClassInfo) info; assertClassInfo(classInfo, clazz); } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/IntrospectionNumberUnitTestCase.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/IntrospectionNumberU0000644000175000017500000000320011033445047033441 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.test; import junit.framework.Test; import org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactory; import org.jboss.reflect.spi.TypeInfoFactory; /** * IntrospectionNumberUnitTestCase. * * @author Ales Justin */ public class IntrospectionNumberUnitTestCase extends ClassInfoNumberTest { public IntrospectionNumberUnitTestCase(String name) { super(name); } public static Test suite() { return suite(IntrospectionNumberUnitTestCase.class); } protected TypeInfoFactory getTypeInfoFactory() { return new IntrospectionTypeInfoFactory(); } }././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/IntrospectionEnumUnitTestCase.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/IntrospectionEnumUni0000644000175000017500000000322110533536206033451 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.test; import junit.framework.Test; import org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactory; import org.jboss.reflect.spi.TypeInfoFactory; /** * IntrospectionEnumUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class IntrospectionEnumUnitTestCase extends ClassInfoEnumTest { public IntrospectionEnumUnitTestCase(String name) { super(name); } public static Test suite() { return suite(IntrospectionEnumUnitTestCase.class); } protected TypeInfoFactory getTypeInfoFactory() { return new IntrospectionTypeInfoFactory(); } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/IntrospectionClassUnitTestCase.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/IntrospectionClassUn0000644000175000017500000000322610533536206033446 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.test; import junit.framework.Test; import org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactory; import org.jboss.reflect.spi.TypeInfoFactory; /** * IntrospectionClassUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class IntrospectionClassUnitTestCase extends ClassInfoClassTest { public IntrospectionClassUnitTestCase(String name) { super(name); } public static Test suite() { return suite(IntrospectionClassUnitTestCase.class); } protected TypeInfoFactory getTypeInfoFactory() { return new IntrospectionTypeInfoFactory(); } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/ByteArrayUnitTestCase.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/test/ByteArrayUnitTestCas0000644000175000017500000000752010756326650033356 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, Red Hat Middleware LLC, and individual contributors * 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.classinfo.test; import java.lang.reflect.Method; import java.lang.reflect.Type; import org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactory; import org.jboss.reflect.spi.ArrayInfo; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.PrimitiveInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.reflect.spi.TypeInfoFactory; /** * Tests of the TypeInfo for byte[] types * * @author Scott.Stark@jboss.org * @version $Revision: 69888 $ */ public class ByteArrayUnitTestCase extends AbstractClassInfoTest { public ByteArrayUnitTestCase(String name) { super(name); } public void testByteArrayInfo() { TypeInfoFactory factory = getTypeInfoFactory(); byte[] x = {}; TypeInfo xinfo = factory.getTypeInfo(x.getClass()); getLog().debug(xinfo); assertTrue(xinfo instanceof ArrayInfo); ArrayInfo ainfo = (ArrayInfo) xinfo; TypeInfo compType = ainfo.getComponentType(); assertEquals(PrimitiveInfo.BYTE, compType); } public void testClassLoaderDefineClass() throws Exception { byte[] x = {}; Class[] parameterTypes = {x.getClass(), int.class, int.class}; Method defineClass = ClassLoader.class.getDeclaredMethod("defineClass", parameterTypes); assertNotNull(defineClass); Class[] types = defineClass.getParameterTypes(); TypeInfoFactory factory = getTypeInfoFactory(); TypeInfo arg0Info = factory.getTypeInfo(types[0]); assertTrue(arg0Info instanceof ArrayInfo); getLog().debug(arg0Info); ArrayInfo ainfo = (ArrayInfo) arg0Info; TypeInfo compType = ainfo.getComponentType(); assertEquals(PrimitiveInfo.BYTE, compType); } public void testClassLoaderDefineClassGenericParams() throws Exception { byte[] x = {}; Class[] parameterTypes = {x.getClass(), int.class, int.class}; Method defineClass = ClassLoader.class.getDeclaredMethod("defineClass", parameterTypes); assertNotNull(defineClass); Type[] types = defineClass.getGenericParameterTypes(); TypeInfoFactory factory = getTypeInfoFactory(); TypeInfo arg0Info = factory.getTypeInfo(types[0]); assertTrue(arg0Info instanceof ArrayInfo); getLog().debug(arg0Info); ArrayInfo ainfo = (ArrayInfo) arg0Info; TypeInfo compType = ainfo.getComponentType(); assertEquals(PrimitiveInfo.BYTE, compType); } protected ClassInfo getClassInfo(Class clazz) { TypeInfoFactory factory = getTypeInfoFactory(); TypeInfo info = factory.getTypeInfo(clazz); assertNotNull(info); assertTrue(info instanceof ClassInfo); ClassInfo cinfo = (ClassInfo) info; getLog().debug(cinfo); return cinfo; } protected TypeInfoFactory getTypeInfoFactory() { return new IntrospectionTypeInfoFactory(); } } libjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/0000755000175000017500000000000011620314120030107 5ustar twernertwerner././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoMethodAnnotationInterface.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoMethodAn0000644000175000017500000000241710533536206033354 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoMethodAnnotationInterface * * @author Adrian Brock * @version $Revision: 1.1 $ */ public interface ClassInfoMethodAnnotationInterface { @ClassInfoAnnotation1 @ClassInfoAnnotation2 void method(); } ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericSuperInterfaceString.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericS0000644000175000017500000000237110535031562033350 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoGenericSuperInterfaceString. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ClassInfoGenericSuperInterfaceString implements ClassInfoGenericInterface { } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericExtendsMap.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericE0000644000175000017500000000256010653451352033336 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; import java.util.AbstractMap; import java.util.Set; /** * ClassInfoGenericExtendsCollection * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ClassInfoGenericExtendsMap extends AbstractMap { public Set> entrySet() { return null; } } libjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/FieldsClass.java0000644000175000017500000000264210770453145033172 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * @author Ales Justin */ public class FieldsClass { @SuppressWarnings("unused") private String privString; protected String protString; public String pubString; public String getPrivString() { return privString; } public String getProtString() { return protString; } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ComplexAnnotation.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ComplexAnnotation0000644000175000017500000000415510756326650033525 0ustar twernertwerner/* * 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.classinfo.support; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * * @author Kabir Khan * @version $Revision: 69888 $ */ @Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.PARAMETER}) @Retention(RetentionPolicy.RUNTIME) @SimpleAnnotation @ValueAnnotation("annotation_") public @interface ComplexAnnotation { String stringValue() default "The answer is"; int intValue() default 42; ValueAnnotation annotationValue() default @ValueAnnotation("method_"); Class clazzValue() default Integer.class; TestEnum enumValue() default TestEnum.METHOD; String[] stringArrayValue() default {"The", "answer", "is"}; int[] intArrayValue() default {4, 2}; ValueAnnotation[] annotationArrayValue() default {@ValueAnnotation("Ann1"), @ValueAnnotation("Ann2")}; Class[] clazzArrayValue() default {Integer.class, Long.class}; TestEnum[] enumArrayValue() default {TestEnum.ARRAY_STUFF, TestEnum.METHOD}; } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/AnnotatedSubClass.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/AnnotatedSubClass0000644000175000017500000000244110644714646033436 0ustar twernertwerner/* * 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.classinfo.support; /** * * @author Kabir Khan * @version $Revision: 63941 $ */ @AnotherAnnotation public class AnnotatedSubClass extends AnnotatedClass { @AnotherAnnotation public AnnotatedSubClass(int i, String x) { super(i, x); } } ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoMethodParameterAnnotationInterface.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoMethodPa0000644000175000017500000000263010533536206033353 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoMethodAnnotationInterface * * @author Adrian Brock * @version $Revision: 1.1 $ */ public interface ClassInfoMethodParameterAnnotationInterface { void method( int p1, @ClassInfoAnnotation1 int p2, @ClassInfoAnnotation2 int p3, @ClassInfoAnnotation1 @ClassInfoAnnotation2 int p4 ); } ././@LongLink0000000000000000000000000000023200000000000011562 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericExtendsCollectionInComplicatedWayWIthSpecificType.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericE0000644000175000017500000000253110653451352033334 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoGenericExtendsCollectionInComplicatedWayWIthSpecificType. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ClassInfoGenericExtendsCollectionInComplicatedWayWIthSpecificType extends ClassInfoGenericExtendsCollectionInComplicatedWay { } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ExpectedAnnotations.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ExpectedAnnotatio0000644000175000017500000000274610756326650033505 0ustar twernertwerner/* * 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.classinfo.support; /** * * @author Kabir Khan * @version $Revision: 69888 $ */ public abstract class ExpectedAnnotations { public abstract Class[] getAnnotationExpectedAnnotations(); public abstract Class[] getComplexExpectedAnnotations(); public abstract Class[] getExpectedAnnotations(); public abstract Class[] getFirstParamExpectedAnnotations(); public abstract Class[] getSecondParamExpectedAnnotations(); } ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericExtendsMapNotGeneric.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericE0000644000175000017500000000254610756326650033350 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; import java.util.AbstractMap; import java.util.Set; /** * ClassInfoGenericExtendsCollection * * @author Adrian Brock * @version $Revision: 1.1 $ */ @SuppressWarnings("unchecked") public class ClassInfoGenericExtendsMapNotGeneric extends AbstractMap { public Set entrySet() { return null; } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoConstructorClass.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoConstruc0000644000175000017500000000272610756326650033467 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoConstructorClass * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ClassInfoConstructorClass { @SuppressWarnings("unused") private ClassInfoConstructorClass() {} ClassInfoConstructorClass(int p1) {} protected ClassInfoConstructorClass(int p1, String p2) {} public ClassInfoConstructorClass(long p1, String p2) throws IllegalArgumentException, IllegalStateException { } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoFieldsInterface.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoFieldsIn0000644000175000017500000000235210533536206033350 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoFieldsInterface * * @author Adrian Brock * @version $Revision: 1.1 $ */ public interface ClassInfoFieldsInterface { int field1 = 1; String field2 = "hello"; } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericMethodsClass.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericM0000644000175000017500000000352510535031562033344 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoGenericMethods * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ClassInfoGenericMethodsClass { void doSomething(ClassInfoGenericClass p1) {}; void doSomething(ClassInfoGenericClass p1, ClassInfoGenericClass p2) {}; ClassInfoGenericClass doSomething2(ClassInfoGenericClass p1) {return null;}; ClassInfoGenericClass doSomething2(ClassInfoGenericClass p1, ClassInfoGenericClass p2) {return null;}; ClassInfoGenericClass doSomething3(ClassInfoGenericClass p1) {return null;}; ClassInfoGenericClass doSomething3(ClassInfoGenericClass p1, ClassInfoGenericClass p2) {return null;}; } libjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/AnotherBean.java0000644000175000017500000000236310434557023033161 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * AnotherClass. * * @author Adrian Brock * @version $Revision: 45151 $ */ public class AnotherBean implements AnotherInterface { public void someMethod() { } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/package-info.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/package-info.java0000644000175000017500000000203610560664062033316 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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. */ @SimpleAnnotation package org.jboss.test.classinfo.support; ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ErrorHolderThread.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ErrorHolderThread0000644000175000017500000000276110770453145033437 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * @author Ales Justin */ public class ErrorHolderThread extends Thread { private Throwable error; public ErrorHolderThread(Runnable target) { super(target); } public void run() { try { super.run(); } catch(Throwable t) { error = t; } } public Throwable getError() { return error; } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoEnumAnnotation.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoEnumAnno0000644000175000017500000000236010533536206033372 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoEnumAnnotation. * * @author Adrian Brock * @version $Revision: 1.1 $ */ @ClassInfoAnnotation1 @ClassInfoAnnotation2 public enum ClassInfoEnumAnnotation { ONE, TWO, THREE } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericMethodsInterface.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericM0000644000175000017500000000343310535031562033342 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoGenericMethods * * @author Adrian Brock * @version $Revision: 1.1 $ */ public interface ClassInfoGenericMethodsInterface { void doSomething(ClassInfoGenericClass p1); void doSomething(ClassInfoGenericClass p1, ClassInfoGenericClass p2); ClassInfoGenericClass doSomething2(ClassInfoGenericClass p1); ClassInfoGenericClass doSomething2(ClassInfoGenericClass p1, ClassInfoGenericClass p2); ClassInfoGenericClass doSomething3(ClassInfoGenericClass p1); ClassInfoGenericClass doSomething3(ClassInfoGenericClass p1, ClassInfoGenericClass p2); } ././@LongLink0000000000000000000000000000022300000000000011562 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericExtendsMapInComplicatedWayWIthSpecificType.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericE0000644000175000017500000000252210653451352033334 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoGenericExtendsCollectionInComplicatedWayWIthSpecificType. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ClassInfoGenericExtendsMapInComplicatedWayWIthSpecificType extends ClassInfoGenericExtendsMapInComplicatedWay { } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoInterfacesInterface2.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoInterfac0000644000175000017500000000230110533536206033400 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoInterfacesInterface2 * * @author Adrian Brock * @version $Revision: 1.1 $ */ public interface ClassInfoInterfacesInterface2 { } ././@LongLink0000000000000000000000000000021500000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericExtendsCollectionAndChangesParameter.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericE0000644000175000017500000000274510653451352033343 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; import java.util.AbstractCollection; import java.util.Iterator; /** * ClassInfoGenericExtendsCollectionAndChangesParameter. * * @param the changed parameter name * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ClassInfoGenericExtendsCollectionAndChangesParameter extends AbstractCollection { public Iterator iterator() { return null; } public int size() { return 0; } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericFieldsClass.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericF0000644000175000017500000000243310535031562033332 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoGenericField * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ClassInfoGenericFieldsClass { ClassInfoGenericClass fieldString; ClassInfoGenericClass fieldClass; } ././@LongLink0000000000000000000000000000021200000000000011560 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericExtendsCollectionInComplicatedWay.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericE0000644000175000017500000000255410653451352033341 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoGenericExtendsCollectionInComplicatedWay. * * @param * @param * @param the collection type * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ClassInfoGenericExtendsCollectionInComplicatedWay extends ClassInfoGenericExtendsCollectionAndChangesParameter { } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoAnnotationClass.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoAnnotati0000644000175000017500000000233710533536206033433 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoAnnotationClass * * @author Adrian Brock * @version $Revision: 1.1 $ */ @ClassInfoAnnotation1 @ClassInfoAnnotation2 public class ClassInfoAnnotationClass { } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericSuperClassString.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericS0000644000175000017500000000233410535031562033347 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoSuperClass * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ClassInfoGenericSuperClassString extends ClassInfoGenericClass { } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/JDK14ExpectedAnnotations.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/JDK14ExpectedAnno0000644000175000017500000000442610756326650033137 0ustar twernertwerner/* * 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.classinfo.support; import java.lang.annotation.Inherited; /** * * @author Kabir Khan * @version $Revision: 69888 $ */ public class JDK14ExpectedAnnotations extends ExpectedAnnotations { final static Class[] EXPECTED_ANNOTATIONS = {SimpleAnnotation.class, ComplexAnnotation.class}; final static Class[] ANNOTATION_EXPECTED_ANNOTATIONS = {Inherited.class}; final static Class[] COMPLEXANNOTATION_EXPECTED_ANNOTATIONS = {SimpleAnnotation.class, ValueAnnotation.class}; final static Class[] FIRST_PARAM_EXPECTED_ANNOTATIONS = {ValueAnnotation.class, ComplexAnnotation.class}; final static Class[] SECOND_PARAM_EXPECTED_ANNOTATIONS = {ValueAnnotation.class, SimpleAnnotation.class}; public Class[] getAnnotationExpectedAnnotations() { return ANNOTATION_EXPECTED_ANNOTATIONS; } public Class[] getComplexExpectedAnnotations() { return COMPLEXANNOTATION_EXPECTED_ANNOTATIONS; } public Class[] getExpectedAnnotations() { return EXPECTED_ANNOTATIONS; } public Class[] getFirstParamExpectedAnnotations() { return FIRST_PARAM_EXPECTED_ANNOTATIONS; } public Class[] getSecondParamExpectedAnnotations() { return SECOND_PARAM_EXPECTED_ANNOTATIONS; } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoAbstractMethodsClass.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoAbstract0000644000175000017500000000512110533536206033413 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoAbstractMethodsClass * * @author Adrian Brock * @version $Revision: 1.1 $ */ public abstract class ClassInfoAbstractMethodsClass { abstract void voidMethodVoidPackage(); abstract long longMethodVoidPackage(); abstract void voidMethodintPackage(int p1); abstract long longMethodintPackage(int p1); abstract void voidMethodintStringPackage(int p1, String p2); abstract long longMethodintStringPackage(int p1, String p2); abstract long longMethodintStringThrowsPackage(int p1, String p2) throws IllegalArgumentException, IllegalStateException; protected abstract void voidMethodVoidProtected(); protected abstract long longMethodVoidProtected(); protected abstract void voidMethodintProtected(int p1); protected abstract long longMethodintProtected(int p1); protected abstract void voidMethodintStringProtected(int p1, String p2); protected abstract long longMethodintStringProtected(int p1, String p2); protected abstract long longMethodintStringThrowsProtected(int p1, String p2) throws IllegalArgumentException, IllegalStateException; public abstract void voidMethodVoidPublic(); public abstract long longMethodVoidPublic(); public abstract void voidMethodintPublic(int p1); public abstract long longMethodintPublic(int p1); public abstract void voidMethodintStringPublic(int p1, String p2); public abstract long longMethodintStringPublic(int p1, String p2); public abstract long longMethodintStringThrowsPublic(int p1, String p2) throws IllegalArgumentException, IllegalStateException; } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/SimpleInterface.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/SimpleInterface.j0000644000175000017500000000472710376104627033366 0ustar twernertwerner/* * 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.classinfo.support; import java.net.URL; /** * A simple interface * * @author Adrian Brock * @version $Revision: 41300 $ */ public interface SimpleInterface { // Constants ----------------------------------------------------- static final Object A_CONSTANT = new Object(); // Public -------------------------------------------------------- String getA(); void setA(String s); String getWithSetter(); void setWithSetter(String s); String getWithoutSetter(); void setWithoutGetter(String s); String getDoesNotMatchSetter(); void setDoesNotMatchGetter(Object o); String getWithNoSetterOnInterface(); void setWithNoGetterOnInterface(Object o); boolean isB(); void setB(boolean b); boolean isPrimitiveIS(); Boolean isBooleanIS(); void methodWithNoReturnTypeNoParameters(); void methodWithNoReturnTypeOneParameter(String s); void methodWithNoReturnTypeTwoParameters(String s, URL u); Object methodWithReturnTypeNoParameters(); String methodWithReturnTypeOneParameter(String s); URL methodWithReturnTypeTwoParameters(String s, URL u); void methodWithPrimitiveParameter(int i); int methodWithPrimitiveReturnType(); void overloadedMethod(Object o); void overloadedMethod(String s); boolean is(); Object get(); void set(Object o); // Inner classes ------------------------------------------------- }././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoFieldsClass.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoFieldsCl0000644000175000017500000000332310533536206033337 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoFieldsClass * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ClassInfoFieldsClass { private int fieldPrivate; private static int fieldPrivateStatic; private static final int fieldPrivateStaticFinal = 1; int fieldPackage = fieldPrivate; static int fieldPackageStatic = fieldPrivateStatic; static final int fieldPackageStaticFinal = fieldPrivateStaticFinal; protected int fieldProtected; protected static int fieldProtectedStatic; protected static final int fieldProtectedStaticFinal = 1; public int fieldPublic; public static int fieldPublicStatic; public static final int fieldPublicStaticFinal = 1; } ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericImplementsCollection.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericI0000644000175000017500000000415010653451352033337 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; import java.util.Collection; import java.util.Iterator; /** * ClassInfoGenericImplementsCollection. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ClassInfoGenericImplementsCollection implements Collection { public boolean add(Long o) { return false; } public boolean addAll(Collection c) { return false; } public void clear() { } public boolean contains(Object o) { return false; } public boolean containsAll(Collection c) { return false; } public boolean isEmpty() { return false; } public Iterator iterator() { return null; } public boolean remove(Object o) { return false; } public boolean removeAll(Collection c) { return false; } public boolean retainAll(Collection c) { return false; } public int size() { return 0; } public Object[] toArray() { return null; } public T[] toArray(T[] a) { return null; } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoSuperClass.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoSuperCla0000644000175000017500000000230510533536206033367 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoSuperClass * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ClassInfoSuperClass extends ClassInfoEmptyClass { } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/SimpleAnnotation.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/SimpleAnnotation.0000644000175000017500000000303310560664062033412 0ustar twernertwerner/* * 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.classinfo.support; import java.lang.annotation.ElementType; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * * @author Kabir Khan * @version $Revision: 60200 $ */ @Inherited @Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.PARAMETER, ElementType.PACKAGE}) @Retention(RetentionPolicy.RUNTIME) public @interface SimpleAnnotation { } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericInterface.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericI0000644000175000017500000000233310535031562033334 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoGenericInterface * * @param the generic type * @author Adrian Brock * @version $Revision: 1.1 $ */ public interface ClassInfoGenericInterface { } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericClass.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericC0000644000175000017500000000231710535031562033330 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoGenericClass * * @param the generic type * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ClassInfoGenericClass { } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/JDK50ExpectedAnnotations.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/JDK50ExpectedAnno0000644000175000017500000000463710756326650033143 0ustar twernertwerner/* * 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.classinfo.support; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.Target; /** * * @author Kabir Khan * @version $Revision: 69888 $ */ public class JDK50ExpectedAnnotations extends ExpectedAnnotations { final static Class[] EXPECTED_ANNOTATIONS = {SimpleAnnotation.class, ComplexAnnotation.class}; final static Class[] ANNOTATION_EXPECTED_ANNOTATIONS = {Target.class, Retention.class, Inherited.class}; final static Class[] COMPLEXANNOTATION_EXPECTED_ANNOTATIONS = {Target.class, Retention.class, SimpleAnnotation.class, ValueAnnotation.class}; final static Class[] FIRST_PARAM_EXPECTED_ANNOTATIONS = {ValueAnnotation.class, ComplexAnnotation.class}; final static Class[] SECOND_PARAM_EXPECTED_ANNOTATIONS = {ValueAnnotation.class, SimpleAnnotation.class}; public Class[] getAnnotationExpectedAnnotations() { return ANNOTATION_EXPECTED_ANNOTATIONS; } public Class[] getComplexExpectedAnnotations() { return COMPLEXANNOTATION_EXPECTED_ANNOTATIONS; } public Class[] getExpectedAnnotations() { return EXPECTED_ANNOTATIONS; } public Class[] getFirstParamExpectedAnnotations() { return FIRST_PARAM_EXPECTED_ANNOTATIONS; } public Class[] getSecondParamExpectedAnnotations() { return SECOND_PARAM_EXPECTED_ANNOTATIONS; } } ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericSuperClassEmptyClass.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericS0000644000175000017500000000235510535031562033352 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoSuperClass * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ClassInfoGenericSuperClassEmptyClass extends ClassInfoGenericClass { } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoAnnotation1.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoAnnotati0000644000175000017500000000226110533536206033427 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @Retention(RetentionPolicy.RUNTIME) public @interface ClassInfoAnnotation1 { } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoMethodsClass.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoMethodsC0000644000175000017500000000633210533536206033363 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoMethodsClass * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ClassInfoMethodsClass { private void voidMethodVoidPrivate() {} private long longMethodVoidPrivate() { return 0; } private void voidMethodintPrivate(int p1) {} private long longMethodintPrivate(int p1) { return 0; } private void voidMethodintStringPrivate(int p1, String p2) {} private long longMethodintStringPrivate(int p1, String p2) { return 0; } private long longMethodintStringThrowsPrivate(int p1, String p2) throws IllegalArgumentException, IllegalStateException { return 0; } void voidMethodVoidPackage() { voidMethodVoidPrivate(); } long longMethodVoidPackage() { return longMethodVoidPrivate(); } void voidMethodintPackage(int p1) { voidMethodintPrivate(p1); } long longMethodintPackage(int p1) { return longMethodintPrivate(p1); } void voidMethodintStringPackage(int p1, String p2) { voidMethodintStringPrivate(p1, p2); } long longMethodintStringPackage(int p1, String p2) { return longMethodintStringPrivate(p1, p2); } long longMethodintStringThrowsPackage(int p1, String p2) throws IllegalArgumentException, IllegalStateException { return longMethodintStringThrowsPrivate(p1, p2); } protected void voidMethodVoidProtected() {} protected long longMethodVoidProtected() { return 0; } protected void voidMethodintProtected(int p1) {} protected long longMethodintProtected(int p1) { return 0; } protected void voidMethodintStringProtected(int p1, String p2) {} protected long longMethodintStringProtected(int p1, String p2) { return 0; } protected long longMethodintStringThrowsProtected(int p1, String p2) throws IllegalArgumentException, IllegalStateException { return 0; } public void voidMethodVoidPublic() {} public long longMethodVoidPublic() { return 0; } public void voidMethodintPublic(int p1) {} public long longMethodintPublic(int p1) { return 0; } public void voidMethodintStringPublic(int p1, String p2) {} public long longMethodintStringPublic(int p1, String p2) { return 0; } public long longMethodintStringThrowsPublic(int p1, String p2) throws IllegalArgumentException, IllegalStateException { return 0; } } ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericExtendsCollectionNotGeneric.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericE0000644000175000017500000000266510756326650033352 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; import java.util.AbstractCollection; import java.util.Iterator; /** * ClassInfoGenericExtendsCollection * * @author Adrian Brock * @version $Revision: 1.1 $ */ @SuppressWarnings("unchecked") public class ClassInfoGenericExtendsCollectionNotGeneric extends AbstractCollection { public Iterator iterator() { return null; } public int size() { return 0; } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoInterfacesInterface1.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoInterfac0000644000175000017500000000230110533536206033400 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoInterfacesInterface1 * * @author Adrian Brock * @version $Revision: 1.1 $ */ public interface ClassInfoInterfacesInterface1 { } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoMethodsInterface.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoMethodsI0000644000175000017500000000300610533536206033364 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoInterface * * @author Adrian Brock * @version $Revision: 1.1 $ */ public interface ClassInfoMethodsInterface { void voidMethodVoid(); long longMethodVoid(); void voidMethodint(int p1); long longMethodint(int p1); void voidMethodintString(int p1, String p2); long longMethodintString(int p1, String p2); long longMethodintStringThrows(int p1, String p2) throws IllegalArgumentException, IllegalStateException; } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoConstructorAnnotationClass.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoConstruc0000644000175000017500000000244410533536206033455 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoConstructorClass * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ClassInfoConstructorAnnotationClass { @ClassInfoAnnotation1 @ClassInfoAnnotation2 public ClassInfoConstructorAnnotationClass(){ } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoFieldAnnotationInterface.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoFieldAnn0000644000175000017500000000241510533536206033333 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoFieldAnnotationInterface * * @author Adrian Brock * @version $Revision: 1.1 $ */ public interface ClassInfoFieldAnnotationInterface { @ClassInfoAnnotation1 @ClassInfoAnnotation2 int field = 1; } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoEmptyClass.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoEmptyCla0000644000175000017500000000225110533536206033367 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoEmptyClass * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ClassInfoEmptyClass { } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoAnnotationInterface.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoAnnotati0000644000175000017500000000235310533536206033431 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoAnnotationInterface * * @author Adrian Brock * @version $Revision: 1.1 $ */ @ClassInfoAnnotation1 @ClassInfoAnnotation2 public interface ClassInfoAnnotationInterface { } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericExtendsCollection.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericE0000644000175000017500000000263210653451352033336 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; import java.util.AbstractCollection; import java.util.Iterator; /** * ClassInfoGenericExtendsCollection * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ClassInfoGenericExtendsCollection extends AbstractCollection { public Iterator iterator() { return null; } public int size() { return 0; } } ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericExtendsMapInComplicatedWay.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericE0000644000175000017500000000257310653451352033342 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoGenericExtendsCollectionInComplicatedWay. * * @param * @param * @param the key type * @param the value type * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ClassInfoGenericExtendsMapInComplicatedWay extends ClassInfoGenericExtendsMapAndChangesParameters { } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoAnnotation2.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoAnnotati0000644000175000017500000000226110533536206033427 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @Retention(RetentionPolicy.RUNTIME) public @interface ClassInfoAnnotation2 { } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ValueAnnotation.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ValueAnnotation.j0000644000175000017500000000274510444315516033416 0ustar twernertwerner/* * 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.classinfo.support; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * * @author Kabir Khan * @version $Revision: 45654 $ */ @Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.PARAMETER}) @Retention(RetentionPolicy.RUNTIME) public @interface ValueAnnotation { String value(); } libjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/TestEnum.java0000644000175000017500000000227510444315516032541 0ustar twernertwerner/* * 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.classinfo.support; /** * * @author Kabir Khan * @version $Revision: 45654 $ */ public enum TestEnum { CLASS, CONSTRUCTOR, FIELD, METHOD, ARRAY_STUFF } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericSuperInterfaceEmptyClass.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericS0000644000175000017500000000241610535031562033350 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoGenericSuperInterfaceEmptyClass. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ClassInfoGenericSuperInterfaceEmptyClass implements ClassInfoGenericInterface { } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoMethodParameterAnnotationClass.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoMethodPa0000644000175000017500000000262710533536206033361 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoMethodAnnotationClass * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ClassInfoMethodParameterAnnotationClass { public void method( int p1, @ClassInfoAnnotation1 int p2, @ClassInfoAnnotation2 int p3, @ClassInfoAnnotation1 @ClassInfoAnnotation2 int p4 ) {} ; } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/MethodsClass.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/MethodsClass.java0000644000175000017500000000361411010514643033354 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * @author Ales Justin */ public class MethodsClass { private String privString; protected String protString; public String pubString; public String getPrivStringNotGetter() { return privString; } @SuppressWarnings("unused") private String getPrivString() { return privString; } @SuppressWarnings("unused") private void setPrivString(String privString) { this.privString = privString; } protected String getProtString() { return protString; } protected void setProtString(String protString) { this.protString = protString; } public String getPubString() { return pubString; } public void setPubString(String pubString) { this.pubString = pubString; } }././@LongLink0000000000000000000000000000020700000000000011564 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericExtendsMapAndChangesParameters.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericE0000644000175000017500000000273610653451352033343 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; import java.util.AbstractMap; import java.util.Set; /** * ClassInfoGenericExtendsCollectionAndChangesParameter. * * @param the changed parameter name * @param the changed parameter name * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ClassInfoGenericExtendsMapAndChangesParameters extends AbstractMap { public Set> entrySet() { return null; } } libjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/SimpleBean.java0000644000175000017500000001155610376104627033021 0ustar twernertwerner/* * 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.classinfo.support; import java.io.Serializable; import java.net.URL; /** * A simple bean * * @author Adrian Brock * @version $Revision: 41300 $ */ public class SimpleBean implements Serializable, SimpleInterface { // Constants ----------------------------------------------------- private static final long serialVersionUID = 3256728398394177849L; public static final Object PUBLIC_CONSTANT = new Object(); static final Object PACKAGE_PRIVATE_CONSTANT = new Object(); protected static final Object PROTECTED_CONSTANT = new Object(); private static final Object PRIVATE_CONSTANT = new Object(); // Attributes ---------------------------------------------------- public Object publicAttribute; Object packagePrivateAttribute; protected Object protectedAttribute; private Object privateAttribute; // Static -------------------------------------------------------- public static void publicStaticMethod() { SimpleBean bean = new SimpleBean(true); if (bean.privateAttribute == null) bean.privateAttribute = PRIVATE_CONSTANT; bean.privateMethod(); privateStaticMethod(); } static void packagePrivateStaticMethod() { } protected static void protectedStaticMethod() { } private static void privateStaticMethod() { } // Constructors -------------------------------------------------- public SimpleBean() { } public SimpleBean(String s) { } SimpleBean(Object o) { } protected SimpleBean(int i) { } private SimpleBean(boolean b) { } // Public -------------------------------------------------------- // SimpleInterface Implementation -------------------------------- public String getA() { return null; } public void setA(String s) { } public String getWithSetter() { return null; } // Setter public void setWithSetter(String s) { } public String getWithoutSetter() { return null; } public void setWithoutGetter(String s) { } public String getDoesNotMatchSetter() { return null; } public void setDoesNotMatchGetter(Object o) { } public String getWithNoSetterOnInterface() { return null; } public void setWithNoGetterOnInterface(Object o) { } public boolean isB() { return false; } public void setB(boolean b) { } public boolean isPrimitiveIS() { return false; } public Boolean isBooleanIS() { return Boolean.FALSE; } public void methodWithNoReturnTypeNoParameters() { } public void methodWithNoReturnTypeOneParameter(String s) { } public void methodWithNoReturnTypeTwoParameters(String s, URL u) { } public void methodWithPrimitiveParameter(int i) { } public int methodWithPrimitiveReturnType() { return 0; } public Object methodWithReturnTypeNoParameters() { return null; } public String methodWithReturnTypeOneParameter(String s) { return null; } public URL methodWithReturnTypeTwoParameters(String s, URL u) { return null; } public void overloadedMethod(Object o) { } public void overloadedMethod(String s) { } public Object get() { return null; } public boolean is() { return false; } public void set(Object o) { } // Package protected --------------------------------------------- void packagePrivateMethod() { } // Protected ----------------------------------------------------- protected void protectedMethod() { } // Private ------------------------------------------------------- private void privateMethod() { } // Inner classes ------------------------------------------------- }././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/AnotherAnnotation.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/AnotherAnnotation0000644000175000017500000000267510444315516033514 0ustar twernertwerner/* * 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.classinfo.support; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * * @author Kabir Khan * @version $Revision: 45654 $ */ @Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR}) @Retention(RetentionPolicy.RUNTIME) public @interface AnotherAnnotation { } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoInterfacesInterface.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoInterfac0000644000175000017500000000240410533536206033404 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoInterfacesInterface * * @author Adrian Brock * @version $Revision: 1.1 $ */ public interface ClassInfoInterfacesInterface extends ClassInfoInterfacesInterface1, ClassInfoInterfacesInterface2 { } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/AnotherInterface.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/AnotherInterface.0000644000175000017500000000230010434557023033341 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * AnotherInterface. * * @author Adrian Brock * @version $Revision: 45151 $ */ public interface AnotherInterface { void someMethod(); } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericFieldsInterface.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericF0000644000175000017500000000247310535031562033336 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoGenericFieldsInterface * * @author Adrian Brock * @version $Revision: 1.1 $ */ public interface ClassInfoGenericFieldsInterface { ClassInfoGenericClass fieldString = null; ClassInfoGenericClass fieldClass = null; } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/AnnotatedClass.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/AnnotatedClass.ja0000644000175000017500000000612610444315516033350 0ustar twernertwerner/* * 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.classinfo.support; /** * * @author Kabir Khan * @version $Revision: 45654 $ */ @ComplexAnnotation( stringValue="_class", intValue=1, annotationValue=@ValueAnnotation("class_"), clazzValue=AnnotatedClass.class, enumValue=TestEnum.CLASS, stringArrayValue= {"A", "class"}, intArrayValue= {10, 1}, annotationArrayValue= {@ValueAnnotation("stuffer"), @ValueAnnotation("class")}, clazzArrayValue= {AnnotatedClass.class}, enumArrayValue= {TestEnum.CLASS, TestEnum.ARRAY_STUFF} ) @SimpleAnnotation public class AnnotatedClass { @ComplexAnnotation( stringValue="_field", intValue=2, annotationValue=@ValueAnnotation("field_"), clazzValue=AnnotatedClass.class, enumValue=TestEnum.FIELD, stringArrayValue= {"A", "field"}, intArrayValue= {10, 2}, annotationArrayValue= {@ValueAnnotation("stuffer"), @ValueAnnotation("field")}, clazzArrayValue = {AnnotatedClass.class}, enumArrayValue= {TestEnum.FIELD, TestEnum.ARRAY_STUFF} ) @SimpleAnnotation public int field; @ComplexAnnotation( stringValue="_ctor", intValue=3, annotationValue=@ValueAnnotation("ctor_"), clazzValue=AnnotatedClass.class, enumValue=TestEnum.CONSTRUCTOR, stringArrayValue= {"A", "ctor"}, intArrayValue= {10, 3}, annotationArrayValue= {@ValueAnnotation("stuffer"), @ValueAnnotation("ctor")}, clazzArrayValue= {AnnotatedClass.class}, enumArrayValue= {TestEnum.CONSTRUCTOR, TestEnum.ARRAY_STUFF}) @SimpleAnnotation public AnnotatedClass( @ValueAnnotation("int") @ComplexAnnotation(stringValue="1", intArrayValue={1}) int i, @ValueAnnotation("string") @SimpleAnnotation String x) { } @ComplexAnnotation @SimpleAnnotation public void method( @ValueAnnotation("int") @ComplexAnnotation(stringValue="1", intArrayValue={1}) int i, @ValueAnnotation("string") @SimpleAnnotation String x) { } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoEnumFieldAnnotation.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoEnumFiel0000644000175000017500000000240310533536206033354 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoEnumFieldAnnotation. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public enum ClassInfoEnumFieldAnnotation { @ClassInfoAnnotation1 @ClassInfoAnnotation2 ONE, TWO, THREE } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/CustomValueOf.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/CustomValueOf.jav0000644000175000017500000000267311374537405033400 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file 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.classinfo.support; /** * * @author Kabir Khan * @version $Revision: 1.1 $ */ public class CustomValueOf { String string; private CustomValueOf(String string) { super(); this.string = string; } public static CustomValueOf valueOf(String string) { return new CustomValueOf(string); } public String getString() { return string; } } ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoConstructorParameterAnnotationClass.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoConstruc0000644000175000017500000000270210533536206033452 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoConstructorAnnotationClass * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ClassInfoConstructorParameterAnnotationClass { public ClassInfoConstructorParameterAnnotationClass( int p1, @ClassInfoAnnotation1 int p2, @ClassInfoAnnotation2 int p3, @ClassInfoAnnotation1 @ClassInfoAnnotation2 int p4 ) {} ; } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoEnum.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoEnum.jav0000644000175000017500000000226010533536206033334 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoEnum. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public enum ClassInfoEnum { ONE, TWO, THREE } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericImplementsMap.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericI0000644000175000017500000000410510653451352033337 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; import java.util.Collection; import java.util.Map; import java.util.Set; /** * ClassInfoGenericImplementsCollection. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ClassInfoGenericImplementsMap implements Map { public void clear() { } public boolean containsKey(Object key) { return false; } public boolean containsValue(Object value) { return false; } public Set> entrySet() { return null; } public Integer get(Object key) { return null; } public boolean isEmpty() { return false; } public Set keySet() { return null; } public Integer put(Long key, Integer value) { return null; } public void putAll(Map t) { } public Integer remove(Object key) { return null; } public int size() { return 0; } public Collection values() { return null; } } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericImplementsMapNotGeneric.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericI0000644000175000017500000000401010756326650033340 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; import java.util.Collection; import java.util.Map; import java.util.Set; /** * ClassInfoGenericImplementsCollection. * * @author Adrian Brock * @version $Revision: 1.1 $ */ @SuppressWarnings("unchecked") public class ClassInfoGenericImplementsMapNotGeneric implements Map { public void clear() { } public boolean containsKey(Object key) { return false; } public boolean containsValue(Object value) { return false; } public Set entrySet() { return null; } public Object get(Object key) { return null; } public boolean isEmpty() { return false; } public Set keySet() { return null; } public Integer put(Object key, Object value) { return null; } public void putAll(Map t) { } public Object remove(Object key) { return null; } public int size() { return 0; } public Collection values() { return null; } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoFieldAnnotationClass.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoFieldAnn0000644000175000017500000000240410533536206033331 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoFieldAnnotationClass * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ClassInfoFieldAnnotationClass { @ClassInfoAnnotation1 @ClassInfoAnnotation2 public int field; } ././@LongLink0000000000000000000000000000020700000000000011564 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericImplementsCollectionNotGeneric.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericI0000644000175000017500000000445010756326650033350 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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 aObject 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.classinfo.support; import java.util.Collection; import java.util.Iterator; /** * ClassInfoGenericImplementsCollection. * * @author Adrian Brock * @version $Revision: 1.1 $ */ @SuppressWarnings("unchecked") public class ClassInfoGenericImplementsCollectionNotGeneric implements Collection { public boolean add(Object o) { return false; } @SuppressWarnings("unchecked") public boolean addAll(Collection c) { return false; } public void clear() { } public boolean contains(Object o) { return false; } @SuppressWarnings("unchecked") public boolean containsAll(Collection c) { return false; } public boolean isEmpty() { return false; } public Iterator iterator() { return null; } public boolean remove(Object o) { return false; } @SuppressWarnings("unchecked") public boolean removeAll(Collection c) { return false; } @SuppressWarnings("unchecked") public boolean retainAll(Collection c) { return false; } public int size() { return 0; } public Object[] toArray() { return null; } @SuppressWarnings("unchecked") public Object[] toArray(Object[] a) { return null; } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoInterfacesClass.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoInterfac0000644000175000017500000000237310533536206033411 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoInterfacesClass * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ClassInfoInterfacesClass implements ClassInfoInterfacesInterface1, ClassInfoInterfacesInterface2 { } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoMethodAnnotationClass.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoMethodAn0000644000175000017500000000241410533536206033351 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoMethodAnnotationClass * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ClassInfoMethodAnnotationClass { @ClassInfoAnnotation1 @ClassInfoAnnotation2 public void method() {} } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoEmptyInterface.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoEmptyInt0000644000175000017500000000226510533536206033427 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoEmptyInterface * * @author Adrian Brock * @version $Revision: 1.1 $ */ public interface ClassInfoEmptyInterface { } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericConstructorsClass.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericC0000644000175000017500000000260510535031562033330 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.classinfo.support; /** * ClassInfoGenericConstructors * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ClassInfoGenericConstructorsClass { ClassInfoGenericConstructorsClass(ClassInfoGenericClass p1) {}; ClassInfoGenericConstructorsClass(ClassInfoGenericClass p1, ClassInfoGenericClass p2) {}; } libjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/joinpoint/0000755000175000017500000000000011620314121026424 5ustar twernertwernerlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/joinpoint/test/0000755000175000017500000000000011620314121027403 5ustar twernertwerner././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/joinpoint/test/JoinpointTestSuite.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/joinpoint/test/JoinpointTestSuite.j0000644000175000017500000000314310405527603033415 0ustar twernertwerner/* * 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.joinpoint.test; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; /** * Joinpoint Test Suite. * * @author Adrian Brock * @version $Revision: 42218 $ */ public class JoinpointTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("Joinpoint Tests"); suite.addTest(IntrospectionJoinpointTestCase.suite()); suite.addTest(JavassistJoinpointTestCase.suite()); return suite; } } libjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/joinpoint/test/JoinpointTest.java0000644000175000017500000001147010756326650033105 0ustar twernertwerner/* * 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.joinpoint.test; import org.jboss.joinpoint.plugins.Config; import org.jboss.joinpoint.plugins.BasicJoinpointFactory; import org.jboss.joinpoint.spi.Joinpoint; import org.jboss.joinpoint.spi.JoinpointFactory; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.TypeInfoFactory; import org.jboss.test.ContainerTest; import org.jboss.test.joinpoint.support.SimpleBean; /** * Joinpoint Test Case. * * @author Adrian Brock * @version $Revision: 69888 $ */ public abstract class JoinpointTest extends ContainerTest { public JoinpointTest(String name) { super(name); } public void testSimpleConstructor() throws Throwable { JoinpointFactory jpf = getJointpointFactory(SimpleBean.class); Object object = Config.instantiate(jpf, new String[0], new Object[0]); assertNotNull(object); assertTrue(object instanceof SimpleBean); SimpleBean bean = (SimpleBean) object; assertEquals("()", bean.getConstructorUsed()); } public void testConstructorOneParam() throws Throwable { JoinpointFactory jpf = getJointpointFactory(SimpleBean.class); Object object = Config.instantiate(jpf, new String[] { String.class.getName() }, new Object[] { "String" }); assertNotNull(object); assertTrue(object instanceof SimpleBean); SimpleBean bean = (SimpleBean) object; assertEquals("String", bean.getConstructorUsed()); } public void testConstructorTwoParam() throws Throwable { JoinpointFactory jpf = getJointpointFactory(SimpleBean.class); Object object = Config.instantiate(jpf, new String[] { String.class.getName(), Object.class.getName() }, new Object[] { "StringObject", new Object() }); assertNotNull(object); assertTrue(object instanceof SimpleBean); SimpleBean bean = (SimpleBean) object; assertEquals("StringObject", bean.getConstructorUsed()); } public void testSetField() throws Throwable { JoinpointFactory jpf = getJointpointFactory(SimpleBean.class); SimpleBean bean = new SimpleBean(); Config.configure(bean, jpf, "publicField", "Hello"); assertEquals("Hello", bean.publicField); } public void testUnSetField() throws Throwable { JoinpointFactory jpf = getJointpointFactory(SimpleBean.class); SimpleBean bean = new SimpleBean(); Config.unconfigure(bean, jpf, "publicField"); assertEquals(null, bean.publicField); } public void testGetField() throws Throwable { JoinpointFactory jpf = getJointpointFactory(SimpleBean.class); SimpleBean bean = new SimpleBean(); Joinpoint joinpoint = Config.getFieldGetJoinpoint(bean, jpf, "publicField"); assertEquals("DefaultValue", joinpoint.dispatch()); } public void testMethodInvoke() throws Throwable { JoinpointFactory jpf = getJointpointFactory(SimpleBean.class); SimpleBean bean = new SimpleBean(); Joinpoint joinpoint = Config.getMethodJoinpoint(bean, jpf, "echo", new String[] { String.class.getName() }, new Object[] { "ping" }); assertEquals("ping", joinpoint.dispatch()); } public void testObjectMethodInvoke() throws Throwable { JoinpointFactory jpf = getJointpointFactory(SimpleBean.class); SimpleBean bean = new SimpleBean(); Joinpoint joinpoint = Config.getMethodJoinpoint(bean, jpf, "toString", new String[0], new Object[0]); assertEquals(bean.toString(), joinpoint.dispatch()); } protected JoinpointFactory getJointpointFactory(Class clazz) { TypeInfoFactory typeFactory = getTypeInfoFactory(); ClassInfo info = (ClassInfo) typeFactory.getTypeInfo(clazz); return new BasicJoinpointFactory(info); } protected abstract TypeInfoFactory getTypeInfoFactory(); protected void configureLogging() { enableTrace("org.jboss.joinpoint"); } }././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/joinpoint/test/IntrospectionJoinpointTestCase.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/joinpoint/test/IntrospectionJoinpoi0000644000175000017500000000323010405527603033527 0ustar twernertwerner/* * 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.joinpoint.test; import junit.framework.Test; import org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactory; import org.jboss.reflect.spi.TypeInfoFactory; /** * Introspection Joinpoint Test Case. * * @author Adrian Brock * @version $Revision: 42218 $ */ public class IntrospectionJoinpointTestCase extends JoinpointTest { public static Test suite() { return suite(IntrospectionJoinpointTestCase.class); } public IntrospectionJoinpointTestCase(String name) { super(name); } protected TypeInfoFactory getTypeInfoFactory() { return new IntrospectionTypeInfoFactory(); } }././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/joinpoint/test/JavassistJoinpointTestCase.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/joinpoint/test/JavassistJoinpointTe0000644000175000017500000000317410405527603033500 0ustar twernertwerner/* * 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.joinpoint.test; import junit.framework.Test; import org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactory; import org.jboss.reflect.spi.TypeInfoFactory; /** * Javassist Joinpoint Test Case. * * @author Adrian Brock * @version $Revision: 42218 $ */ public class JavassistJoinpointTestCase extends JoinpointTest { public static Test suite() { return suite(JavassistJoinpointTestCase.class); } public JavassistJoinpointTestCase(String name) { super(name); } protected TypeInfoFactory getTypeInfoFactory() { return new JavassistTypeInfoFactory(); } }libjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/joinpoint/support/0000755000175000017500000000000011620314121030140 5ustar twernertwerner././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/joinpoint/support/SimpleInterface.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/joinpoint/support/SimpleInterface.j0000644000175000017500000000260010405527603033376 0ustar twernertwerner/* * 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.joinpoint.support; /** * A simple interface * * @author Adrian Brock * @version $Revision: 42218 $ */ public interface SimpleInterface { // Constants ----------------------------------------------------- // Public -------------------------------------------------------- // Inner classes ------------------------------------------------- }libjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/joinpoint/support/SimpleBean.java0000644000175000017500000000456210405527603033044 0ustar twernertwerner/* * 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.joinpoint.support; /** * A simple bean * * @author Adrian Brock * @version $Revision: 42218 $ */ public class SimpleBean implements SimpleInterface { // Constants ----------------------------------------------------- // Attributes ---------------------------------------------------- public Object publicField = "DefaultValue"; private String constructorUsed; // Static -------------------------------------------------------- // Constructors -------------------------------------------------- public SimpleBean() { constructorUsed = "()"; } public SimpleBean(String string) { constructorUsed = string; } public SimpleBean(String string, Object object) { constructorUsed = string; } // Public -------------------------------------------------------- public String getConstructorUsed() { return constructorUsed; } public String echo(String value) { return value; } // SimpleInterface Implementation -------------------------------- // Package protected --------------------------------------------- // Protected ----------------------------------------------------- // Private ------------------------------------------------------- // Inner classes ------------------------------------------------- }libjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/memorytests/0000755000175000017500000000000011620314121027006 5ustar twernertwerner././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/memorytests/ClassInfoMemoryTestCase.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/memorytests/ClassInfoMemoryTestCase0000644000175000017500000001153410756326650033466 0ustar twernertwerner/* * 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.memorytests; import java.io.Serializable; import java.lang.ref.WeakReference; import java.util.HashSet; import org.jboss.profiler.jvmti.JVMTIInterface; import org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactory; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.reflect.spi.TypeInfoFactory; import org.jboss.test.JBossMemoryTestCase; /** * ClassInfo Test Case. * * @author Adrian Brock * @author Clebert Suconic * @author Source Forge User Chung Chung * @version $Revision: 69888 $ */ public class ClassInfoMemoryTestCase extends JBossMemoryTestCase { public ClassInfoMemoryTestCase(String name) { super(name); } public ClassInfoMemoryTestCase() { super(); } public void testSimpleBeanClassInfo() throws Throwable { ClassLoader oldloader = Thread.currentThread().getContextClassLoader(); System.out.println("+++oldloader =" + oldloader.toString()); ClassLoader loader = newClassLoader(ClassInfoMemoryTestCase.class); WeakReference weakReferenceOnLoader = new WeakReference(loader); System.out.println("+++newloader =" + loader.toString()); //step1 Class simpleBeanClass = loader.loadClass("org.jboss.test.classinfo.support.SimpleBean"); Class simpleBeanInterface = loader.loadClass("org.jboss.test.classinfo.support.SimpleInterface"); ClassInfo cinfo = getClassInfo(loader,simpleBeanClass); cinfo=null; // Test if the reference on ClassInfo is not too weak JVMTIInterface jvmti = new JVMTIInterface(); if (jvmti.isActive()) { jvmti.forceGC(); assertEquals(1,jvmti.getAllObjects(ClassInfo.class).length); } cinfo = getClassInfo(loader,simpleBeanClass); assertEquals(simpleBeanClass.getName(), cinfo.getName()); ClassInfo supercinfo = cinfo.getSuperclass(); assertNotNull(supercinfo); assertEquals(Object.class.getName(), supercinfo.getName()); HashSet expected = new HashSet(); expected.add(Serializable.class.getName()); expected.add(simpleBeanInterface.getName()); checkTypeSet(expected, cinfo.getInterfaces()); //step2 oldloader =null; loader=null; cinfo=null; supercinfo=null; expected=null; simpleBeanClass = null; simpleBeanInterface = null; checkUnload( weakReferenceOnLoader,"org.jboss.test.classinfo.support.SimpleBean","./leak-report.html"); } protected ClassInfo getClassInfo(ClassLoader loader,Class clazz) { TypeInfoFactory factory = getTypeInfoFactory(); TypeInfo info=null; try{ info = factory.getTypeInfo(clazz.getName(),loader); }catch(Exception e){ System.out.println(e); } assertNotNull(info); assertTrue(info instanceof ClassInfo); //getLog().debug(cinfo); return (ClassInfo) info; } protected void checkTypeSet(HashSet expected, TypeInfo[] typeInfos) throws Throwable { HashSet actual = new HashSet(); for (int i = 0; i < typeInfos.length; ++i) actual.add(typeInfos[i].getName()); HashSet expectClone = new HashSet(expected); HashSet actualClone = new HashSet(actual); //getLog().debug("checkTypeSet expect=" + expected); //getLog().debug("checkTypeSet actual=" + actual); expectClone.removeAll(actual); assertTrue("Expected " + expectClone, expectClone.isEmpty()); actualClone.removeAll(expected); assertTrue("Did not expect " + actualClone, actualClone.isEmpty()); } protected TypeInfoFactory getTypeInfoFactory() { return new IntrospectionTypeInfoFactory(); } } libjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/0000755000175000017500000000000011620314116026200 5ustar twernertwernerlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/test/0000755000175000017500000000000011620314116027157 5ustar twernertwerner././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/test/BeanInfoCacheTestCase.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/test/BeanInfoCacheTestCase0000644000175000017500000001353511112776757033175 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.test; import java.lang.reflect.Method; import java.lang.reflect.Type; import java.net.URL; import java.net.URLClassLoader; import java.util.List; import java.util.Set; import junit.framework.Test; import org.jboss.beans.info.spi.BeanInfo; import org.jboss.config.spi.Configuration; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.test.beaninfo.support.BeanInfoAnnotation; import org.jboss.test.beaninfo.support.BeanInfoEmpty; import org.jboss.test.beaninfo.support.BeanInfoGenericInterface; /** * BeanInfoCache Test Case. * * @author Ales Justin */ public class BeanInfoCacheTestCase extends AbstractBeanInfoTest { public static Test suite() { return suite(BeanInfoCacheTestCase.class); } public BeanInfoCacheTestCase(String name) { super(name); } public void testBeanInfoCaching() throws Exception { assertBeanInfoCaching("Integer", List.class); assertBeanInfoCaching("String", List.class); assertBeanInfoCaching("Integer", Set.class); assertBeanInfoCaching("String", Set.class); assertBeanInfoCaching("Integer", BeanInfoGenericInterface.class); assertBeanInfoCaching("String", BeanInfoGenericInterface.class); assertBeanInfoCaching("", String.class); assertBeanInfoCaching("", BeanInfoAnnotation.class); assertBeanInfoCaching("", BeanInfoEmpty.class); } public void testClassLoaderCaching() throws Throwable { String className = BeanInfoEmpty.class.getName(); Class clazz = Class.forName(className); URL url1 = clazz.getProtectionDomain().getCodeSource().getLocation(); URL[] urls = {url1}; ClassLoader cl1 = new URLClassLoader(urls, null); clazz = Class.forName(ClassInfo.class.getName()); URL url2 = clazz.getProtectionDomain().getCodeSource().getLocation(); urls = new URL[]{url1, url2}; ClassLoader cl2 = new URLClassLoader(urls, null); Configuration configuration = getConfiguration(); ClassInfo ci1 = configuration.getClassInfo(className, cl1); ClassInfo ci2 = configuration.getClassInfo(className, cl2); assertEquals(ci1, ci2); className = "org.jboss.test.beaninfo.support.BeanInfoCache"; BeanInfo bi1 = configuration.getBeanInfo(className, cl1); BeanInfo bi2 = configuration.getBeanInfo(className, cl2); assertFalse(bi1.equals(bi2)); } private void assertBeanInfoCaching(String string, Class clazz) throws Exception { Type type = getType(string, clazz); assertBeanInfoCaching(type); } private void assertBeanInfoCaching(Type type) throws Exception { assertClassInfo(type); TypeInfo typeInfo = getConfiguration().getTypeInfo(type); ClassInfo classInfo = assertInstanceOf(typeInfo, ClassInfo.class); assertClassInfo(classInfo); if (type instanceof Class) { Class clazz = Class.class.cast(type); assertClassInfo(classInfo, clazz.getName(), clazz.getClassLoader()); } } private void assertClassInfo(Type type) { TypeInfo typeInfo = getConfiguration().getTypeInfo(type); ClassInfo classInfo = assertInstanceOf(typeInfo, ClassInfo.class); assertClassInfo(classInfo); } private void assertClassInfo(ClassInfo typeInfo) { BeanInfo beanInfo = getConfiguration().getBeanInfo(typeInfo); ClassInfo typeInfo2 = beanInfo.getClassInfo(); assertSame(typeInfo, typeInfo2); } private void assertClassInfo(ClassInfo typeInfo, String className, ClassLoader cl) throws Exception { BeanInfo beanInfo = getConfiguration().getBeanInfo(className, cl); ClassInfo typeInfo2 = beanInfo.getClassInfo(); assertSame(typeInfo, typeInfo2); } @SuppressWarnings("unchecked") protected Type getType(String type, Class clazz) throws Exception { Method method = getClass().getDeclaredMethod("get" + type + clazz.getSimpleName()); return method.getGenericReturnType(); } public List getIntegerList() { return null; } public Set getIntegerSet() { return null; } public List getStringList() { return null; } public Set getStringSet() { return null; } public BeanInfoGenericInterface getIntegerBeanInfoGenericInterface() { return null; } public BeanInfoGenericInterface getStringBeanInfoGenericInterface() { return null; } public String getString() { return null; } public BeanInfoAnnotation getBeanInfoAnnotation() { return null; } public BeanInfoEmpty getBeanInfoEmpty() { return null; } }././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/test/BeanInfoTestSuite.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/test/BeanInfoTestSuite.jav0000644000175000017500000000337011111504100033204 0ustar twernertwerner/* * 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.beaninfo.test; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; /** * BeanInfo Test Suite. * * @author Adrian Brock * @version $Revision: 58838 $ */ public class BeanInfoTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("BeanInfo Tests"); suite.addTest(BeanInfoUnitTestCase.suite()); suite.addTest(BeanInfoUtilTestCase.suite()); suite.addTest(BeanInfoCacheTestCase.suite()); suite.addTest(FieldAccessRestrictionTestCase.suite()); suite.addTest(MethodAccessRestrictionTestCase.suite()); return suite; } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/test/MethodAccessRestrictionTestCase.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/test/MethodAccessRestricti0000644000175000017500000000365511010514643033346 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.test; import junit.framework.Test; import org.jboss.test.beaninfo.support.MethodsClass; /** * Field access restriction test. * * @author Ales Justin */ public class MethodAccessRestrictionTestCase extends AccessRestrictionTest { public MethodAccessRestrictionTestCase(String name) { super(name); } public static Test suite() { return suite(MethodAccessRestrictionTestCase.class); } protected MethodsClass getInstance() { return new MethodsClass(); } protected Class getInstanceClass() { return MethodsClass.class; } protected String getPublicString(MethodsClass instance) { return instance.getPubString(); } protected String getPrivateString(MethodsClass instance) { return instance.getPrivStringNotGetter(); } }././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/test/BeanInfoUtilTestCase.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/test/BeanInfoUtilTestCase.0000644000175000017500000004110310770475034033146 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.test; import junit.framework.Test; import org.jboss.beans.info.plugins.BeanInfoUtil; import org.jboss.beans.info.spi.BeanAccessMode; import org.jboss.beans.info.spi.BeanInfo; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.test.beaninfo.support.NestedBean; import org.jboss.test.beaninfo.support.PrivateGetterNestedBean; import org.jboss.test.beaninfo.support.PrivateMixNestedBean; import org.jboss.test.beaninfo.support.PrivateNestedBean; import org.jboss.test.beaninfo.support.PrivateSetterNestedBean; import org.jboss.test.beaninfo.support.PubGetterNestedBean; import org.jboss.test.beaninfo.support.PubMixNestedBean; import org.jboss.test.beaninfo.support.PubNestedBean; import org.jboss.test.beaninfo.support.PubSetterNestedBean; import org.jboss.test.beaninfo.support.SetGetHook; import org.jboss.test.beaninfo.support.SubPubSetterNestedBean; import org.jboss.test.beaninfo.support.SubPubNestedBean; import org.jboss.test.beaninfo.support.SubPrivateMixNestedBean; import org.jboss.test.beaninfo.support.SubPrivateNestedBean; import org.jboss.test.beaninfo.support.SubPrivateSetterNestedBean; import org.jboss.test.beaninfo.support.SubPubMixNestedBean; import org.jboss.test.beaninfo.support.SubPubGetterNestedBean; import org.jboss.test.beaninfo.support.SubPrivateGetterNestedBean; /** * BeanInfoUtil Test Case. * * @author Ales Justin */ public class BeanInfoUtilTestCase extends AbstractBeanInfoTest { public static Test suite() { return suite(BeanInfoUtilTestCase.class); } public BeanInfoUtilTestCase(String name) { super(name); } protected > void checkSimpleGet(Class clazz, BeanAccessMode mode) throws Throwable { T parent = clazz.newInstance(); T child = clazz.newInstance(); parent.doSetHook(child); assertSame(child, BeanInfoUtil.get(getBeanInfo(clazz, mode), parent, "bean")); assertTrue(parent.valid()); } protected > void failSimpleGet(Class clazz, BeanAccessMode mode) throws Throwable { try { checkSimpleGet(clazz, mode); fail("Should not be here."); } catch(Throwable t) { assertInstanceOf(t, IllegalArgumentException.class); } } @SuppressWarnings("unchecked") public void testSimpleGet() throws Throwable { checkSimpleGet(NestedBean.class, BeanAccessMode.STANDARD); checkSimpleGet(NestedBean.class, BeanAccessMode.FIELDS); checkSimpleGet(NestedBean.class, BeanAccessMode.ALL); checkSimpleGet(PubNestedBean.class, BeanAccessMode.FIELDS); checkSimpleGet(PubMixNestedBean.class, BeanAccessMode.FIELDS); checkSimpleGet(PubGetterNestedBean.class, BeanAccessMode.FIELDS); failSimpleGet(PubSetterNestedBean.class, BeanAccessMode.FIELDS); checkSimpleGet(SubPubNestedBean.class, BeanAccessMode.FIELDS); checkSimpleGet(SubPubMixNestedBean.class, BeanAccessMode.FIELDS); checkSimpleGet(SubPubGetterNestedBean.class, BeanAccessMode.FIELDS); failSimpleGet(SubPubSetterNestedBean.class, BeanAccessMode.FIELDS); checkSimpleGet(PrivateNestedBean.class, BeanAccessMode.ALL); checkSimpleGet(PrivateMixNestedBean.class, BeanAccessMode.ALL); checkSimpleGet(PrivateSetterNestedBean.class, BeanAccessMode.ALL); checkSimpleGet(PrivateGetterNestedBean.class, BeanAccessMode.ALL); checkSimpleGet(SubPrivateNestedBean.class, BeanAccessMode.ALL); checkSimpleGet(SubPrivateMixNestedBean.class, BeanAccessMode.ALL); checkSimpleGet(SubPrivateSetterNestedBean.class, BeanAccessMode.ALL); checkSimpleGet(SubPrivateGetterNestedBean.class, BeanAccessMode.ALL); } protected > void checkSimpleSet(Class clazz, BeanAccessMode mode) throws Throwable { T parent = clazz.newInstance(); T child = clazz.newInstance(); BeanInfoUtil.set(getBeanInfo(clazz, mode), parent, "bean", child); assertTrue(parent.valid()); assertSame(child, parent.doGetHook()); } protected > void failSimpleSet(Class clazz, BeanAccessMode mode) throws Throwable { try { checkSimpleSet(clazz, mode); fail("Should not be here."); } catch(Throwable t) { assertInstanceOf(t, IllegalArgumentException.class); } } @SuppressWarnings("unchecked") public void testSimpleSet() throws Throwable { checkSimpleSet(NestedBean.class, BeanAccessMode.STANDARD); checkSimpleSet(NestedBean.class, BeanAccessMode.FIELDS); checkSimpleSet(NestedBean.class, BeanAccessMode.ALL); checkSimpleSet(PubNestedBean.class, BeanAccessMode.FIELDS); checkSimpleSet(PubMixNestedBean.class, BeanAccessMode.FIELDS); failSimpleSet(PubGetterNestedBean.class, BeanAccessMode.FIELDS); checkSimpleSet(PubSetterNestedBean.class, BeanAccessMode.FIELDS); checkSimpleSet(SubPubNestedBean.class, BeanAccessMode.FIELDS); checkSimpleSet(SubPubMixNestedBean.class, BeanAccessMode.FIELDS); failSimpleSet(SubPubGetterNestedBean.class, BeanAccessMode.FIELDS); checkSimpleSet(SubPubSetterNestedBean.class, BeanAccessMode.FIELDS); checkSimpleSet(PrivateNestedBean.class, BeanAccessMode.ALL); checkSimpleSet(PrivateMixNestedBean.class, BeanAccessMode.ALL); checkSimpleSet(PrivateSetterNestedBean.class, BeanAccessMode.ALL); checkSimpleSet(PrivateGetterNestedBean.class, BeanAccessMode.ALL); checkSimpleSet(SubPrivateNestedBean.class, BeanAccessMode.ALL); checkSimpleSet(SubPrivateMixNestedBean.class, BeanAccessMode.ALL); checkSimpleSet(SubPrivateSetterNestedBean.class, BeanAccessMode.ALL); checkSimpleSet(SubPrivateGetterNestedBean.class, BeanAccessMode.ALL); } protected > void checkNestedGet(Class clazz, BeanAccessMode mode) throws Throwable { T parent = clazz.newInstance(); T child = clazz.newInstance(); T grandchild = clazz.newInstance(); parent.doSetHook(child); child.doSetHook(grandchild); assertSame(grandchild, BeanInfoUtil.get(getBeanInfo(clazz, mode), parent, "bean.bean")); } protected > void failNestedGet(Class clazz, BeanAccessMode mode) throws Throwable { try { checkNestedGet(clazz, mode); fail("Should not be here."); } catch (Throwable t) { assertInstanceOf(t, IllegalArgumentException.class); } } @SuppressWarnings("unchecked") public void testNestedGet() throws Throwable { checkNestedGet(NestedBean.class, BeanAccessMode.STANDARD); checkNestedGet(NestedBean.class, BeanAccessMode.FIELDS); checkNestedGet(NestedBean.class, BeanAccessMode.ALL); failNestedGet(PubNestedBean.class, BeanAccessMode.FIELDS); checkNestedGet(PubMixNestedBean.class, BeanAccessMode.FIELDS); checkNestedGet(PubGetterNestedBean.class, BeanAccessMode.FIELDS); failNestedGet(PubSetterNestedBean.class, BeanAccessMode.FIELDS); failNestedGet(SubPubNestedBean.class, BeanAccessMode.FIELDS); checkNestedGet(SubPubMixNestedBean.class, BeanAccessMode.FIELDS); checkNestedGet(SubPubGetterNestedBean.class, BeanAccessMode.FIELDS); failNestedGet(SubPubSetterNestedBean.class, BeanAccessMode.FIELDS); failNestedGet(PrivateNestedBean.class, BeanAccessMode.ALL); checkNestedGet(PrivateMixNestedBean.class, BeanAccessMode.ALL); failNestedGet(PrivateSetterNestedBean.class, BeanAccessMode.ALL); checkNestedGet(PrivateGetterNestedBean.class, BeanAccessMode.ALL); failNestedGet(SubPrivateNestedBean.class, BeanAccessMode.ALL); checkNestedGet(SubPrivateMixNestedBean.class, BeanAccessMode.ALL); failNestedGet(SubPrivateSetterNestedBean.class, BeanAccessMode.ALL); checkNestedGet(SubPrivateGetterNestedBean.class, BeanAccessMode.ALL); } protected > void checkNestedSet(Class clazz, BeanAccessMode mode) throws Throwable { T parent = clazz.newInstance(); T child = clazz.newInstance(); T grandchild = clazz.newInstance(); parent.doSetHook(child); BeanInfoUtil.set(getBeanInfo(clazz, mode), parent, "bean.bean", grandchild); assertTrue(parent.valid()); assertTrue(child.valid()); assertSame(grandchild, parent.doGetHook().doGetHook()); } protected > void failNestedSet(Class clazz, BeanAccessMode mode) throws Throwable { try { checkNestedSet(clazz, mode); fail("Should not be here."); } catch (Throwable t) { assertInstanceOf(t, IllegalArgumentException.class); } } @SuppressWarnings("unchecked") public void testNestedSet() throws Throwable { checkNestedSet(NestedBean.class, BeanAccessMode.STANDARD); checkNestedSet(NestedBean.class, BeanAccessMode.FIELDS); checkNestedSet(NestedBean.class, BeanAccessMode.ALL); failNestedSet(PubNestedBean.class, BeanAccessMode.FIELDS); checkNestedSet(PubMixNestedBean.class, BeanAccessMode.FIELDS); failNestedSet(PubGetterNestedBean.class, BeanAccessMode.FIELDS); failNestedSet(PubSetterNestedBean.class, BeanAccessMode.FIELDS); failNestedSet(SubPubNestedBean.class, BeanAccessMode.FIELDS); checkNestedSet(SubPubMixNestedBean.class, BeanAccessMode.FIELDS); failNestedSet(SubPubGetterNestedBean.class, BeanAccessMode.FIELDS); failNestedSet(SubPubSetterNestedBean.class, BeanAccessMode.FIELDS); failNestedSet(PrivateNestedBean.class, BeanAccessMode.ALL); checkNestedSet(PrivateMixNestedBean.class, BeanAccessMode.ALL); checkNestedSet(PrivateSetterNestedBean.class, BeanAccessMode.ALL); failNestedSet(PrivateGetterNestedBean.class, BeanAccessMode.ALL); failNestedSet(SubPrivateNestedBean.class, BeanAccessMode.ALL); checkNestedSet(SubPrivateMixNestedBean.class, BeanAccessMode.ALL); checkNestedSet(SubPrivateSetterNestedBean.class, BeanAccessMode.ALL); failNestedSet(SubPrivateGetterNestedBean.class, BeanAccessMode.ALL); } protected > void checkNestedGetFail(Class clazz, BeanAccessMode mode) throws Throwable { T parent = clazz.newInstance(); T child = clazz.newInstance(); T grandchild = clazz.newInstance(); T grandgrandchild = clazz.newInstance(); parent.doSetHook(child); // missing link grandchild.doSetHook(grandgrandchild); try { BeanInfoUtil.get(getBeanInfo(clazz, mode), parent, "bean.bean.bean"); fail("Should not be here."); } catch (Throwable t) { assertInstanceOf(t, IllegalArgumentException.class); } } @SuppressWarnings("unchecked") public void testNestedGetFail() throws Throwable { checkNestedGetFail(NestedBean.class, BeanAccessMode.STANDARD); checkNestedGetFail(NestedBean.class, BeanAccessMode.FIELDS); checkNestedGetFail(NestedBean.class, BeanAccessMode.ALL); checkNestedGetFail(PubNestedBean.class, BeanAccessMode.FIELDS); checkNestedGetFail(PubMixNestedBean.class, BeanAccessMode.FIELDS); checkNestedGetFail(PubGetterNestedBean.class, BeanAccessMode.FIELDS); checkNestedGetFail(PubSetterNestedBean.class, BeanAccessMode.FIELDS); checkNestedGetFail(SubPubNestedBean.class, BeanAccessMode.FIELDS); checkNestedGetFail(SubPubMixNestedBean.class, BeanAccessMode.FIELDS); checkNestedGetFail(SubPubGetterNestedBean.class, BeanAccessMode.FIELDS); checkNestedGetFail(SubPubSetterNestedBean.class, BeanAccessMode.FIELDS); checkNestedGetFail(PrivateNestedBean.class, BeanAccessMode.ALL); checkNestedGetFail(PrivateMixNestedBean.class, BeanAccessMode.ALL); checkNestedGetFail(PrivateSetterNestedBean.class, BeanAccessMode.ALL); checkNestedGetFail(PrivateGetterNestedBean.class, BeanAccessMode.ALL); checkNestedGetFail(SubPrivateNestedBean.class, BeanAccessMode.ALL); checkNestedGetFail(SubPrivateMixNestedBean.class, BeanAccessMode.ALL); checkNestedGetFail(SubPrivateSetterNestedBean.class, BeanAccessMode.ALL); checkNestedGetFail(SubPrivateGetterNestedBean.class, BeanAccessMode.ALL); } protected > void checkNestedSetFail(Class clazz, BeanAccessMode mode) throws Throwable { T parent = clazz.newInstance(); T child = clazz.newInstance(); // missing link T grandgrandchild = clazz.newInstance(); parent.doSetHook(child); try { BeanInfoUtil.set(getBeanInfo(clazz, mode), parent, "bean.bean.bean", grandgrandchild); fail("Should not be here."); } catch (Throwable t) { assertInstanceOf(t, IllegalArgumentException.class); } } @SuppressWarnings("unchecked") public void testNestedSetFail() throws Throwable { checkNestedSetFail(NestedBean.class, BeanAccessMode.STANDARD); checkNestedSetFail(NestedBean.class, BeanAccessMode.FIELDS); checkNestedSetFail(NestedBean.class, BeanAccessMode.ALL); checkNestedSetFail(PubNestedBean.class, BeanAccessMode.FIELDS); checkNestedSetFail(PubMixNestedBean.class, BeanAccessMode.FIELDS); checkNestedSetFail(PubSetterNestedBean.class, BeanAccessMode.FIELDS); checkNestedSetFail(PubSetterNestedBean.class, BeanAccessMode.FIELDS); checkNestedSetFail(SubPubNestedBean.class, BeanAccessMode.FIELDS); checkNestedSetFail(SubPubMixNestedBean.class, BeanAccessMode.FIELDS); checkNestedSetFail(SubPubSetterNestedBean.class, BeanAccessMode.FIELDS); checkNestedSetFail(SubPubSetterNestedBean.class, BeanAccessMode.FIELDS); checkNestedSetFail(PrivateNestedBean.class, BeanAccessMode.ALL); checkNestedSetFail(PrivateMixNestedBean.class, BeanAccessMode.ALL); checkNestedSetFail(PrivateSetterNestedBean.class, BeanAccessMode.ALL); checkNestedSetFail(PrivateSetterNestedBean.class, BeanAccessMode.ALL); checkNestedSetFail(SubPrivateNestedBean.class, BeanAccessMode.ALL); checkNestedSetFail(SubPrivateMixNestedBean.class, BeanAccessMode.ALL); checkNestedSetFail(SubPrivateSetterNestedBean.class, BeanAccessMode.ALL); checkNestedSetFail(SubPrivateSetterNestedBean.class, BeanAccessMode.ALL); } public void testNestedPropertyInfo() throws Throwable { NestedBean grandchild = new NestedBean(); NestedBean child = new NestedBean(); child.doSetHook(grandchild); NestedBean parent = new NestedBean(); parent.doSetHook(child); BeanInfo beanInfo = getBeanInfo(NestedBean.class); PropertyInfo propertyInfo = beanInfo.getProperty("string"); PropertyInfo nestedPropertyInfo = BeanInfoUtil.getPropertyInfo(beanInfo, parent, "bean.otherBean.string"); assertEquals(propertyInfo, nestedPropertyInfo); } public void testNestedPropertyInfoFail() throws Throwable { try { NestedBean child = new NestedBean(); NestedBean parent = new NestedBean(); parent.doSetHook(child); BeanInfo beanInfo = getBeanInfo(NestedBean.class); BeanInfoUtil.getPropertyInfo(beanInfo, parent, "bean.differentGetter.string"); fail("Should not be here."); } catch (Throwable t) { assertInstanceOf(t, IllegalArgumentException.class); } } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/test/AbstractBeanInfoTest.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/test/AbstractBeanInfoTest.0000644000175000017500000004514510767032015033204 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.test; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; 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.spi.BeanAccessMode; import org.jboss.beans.info.spi.BeanInfo; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.config.plugins.BasicConfiguration; import org.jboss.config.spi.Configuration; import org.jboss.reflect.plugins.ConstructorInfoImpl; import org.jboss.reflect.plugins.MethodInfoImpl; 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.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; /** * AbstractBeanInfoTest. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public abstract class AbstractBeanInfoTest extends AbstractClassInfoTest { private Configuration configuration = new BasicConfiguration(); public AbstractBeanInfoTest(String name) { super(name); } protected void assertBeanInfo(BeanInfo beanInfo, Class clazz) throws Throwable { assertBeanInfo(beanInfo, clazz, BeanAccessMode.STANDARD); } protected void assertBeanInfo(BeanInfo beanInfo, Class clazz, BeanAccessMode mode) throws Throwable { assertEquals(clazz.getName(), beanInfo.getName()); ClassInfo classInfo = beanInfo.getClassInfo(); assertClassInfo(classInfo, clazz); assertBeanConstructors(beanInfo, clazz); assertBeanMethods(beanInfo, clazz); assertBeanProperties(beanInfo, clazz, mode); } protected void assertBeanConstructors(BeanInfo beanInfo, Class clazz) { ClassInfo classInfo = beanInfo.getClassInfo(); TypeInfoFactory factory = getTypeInfoFactory(); Set expected = new HashSet(); for (Constructor constructor : clazz.getConstructors()) { Class[] paramClasses = constructor.getParameterTypes(); TypeInfo[] paramTypes = new TypeInfo[paramClasses.length]; AnnotationValue[][] paramAnnotations = new AnnotationValue[paramClasses.length][0]; int i = 0; for (Class c : paramClasses) paramTypes[i++] = factory.getTypeInfo(c); ConstructorInfo c = new ConstructorInfoImpl(null, paramTypes, paramAnnotations, null, constructor.getModifiers(), classInfo); expected.add(c); } Set actual = beanInfo.getConstructors(); if (expected.isEmpty()) { if (actual != null) assertEmpty(actual); return; } assertNotNull(actual); assertEquals(expected.size(), actual.size()); getLog().debug(clazz + " expected constructors=" + expected + " actual=" + actual); assertEquals(expected, actual); } protected void assertBeanMethods(BeanInfo beanInfo, Class clazz) throws Throwable { TypeInfoFactory factory = getTypeInfoFactory(); Set expected = new HashSet(); Method[] methods; if (clazz.isAnnotation()) methods = clazz.getDeclaredMethods(); else methods = clazz.getMethods(); for (Method method : methods) { TypeInfo returnType = factory.getTypeInfo(method.getReturnType()); Class[] paramClasses = method.getParameterTypes(); TypeInfo[] paramTypes = new TypeInfo[paramClasses.length]; AnnotationValue[][] paramAnnotations = new AnnotationValue[paramClasses.length][0]; int i = 0; 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, method.getModifiers(), classInfo); expected.add(m); } Set actual = beanInfo.getMethods(); if (expected.isEmpty()) { assertEmpty(actual); return; } getLog().debug(clazz + " expected methods=" + expected + " actual=" + actual); assertEquals(expected, actual); } protected void assertBeanProperties(BeanInfo beanInfo, Class clazz, BeanAccessMode mode) throws Throwable { Set expected; if (clazz.isAnnotation()) expected = getExpectedAnnotationProperties(clazz); else expected = getExpectedProperties(clazz, mode); Set actual = beanInfo.getProperties(); if (expected.isEmpty()) { assertEmpty(actual); return; } getLog().debug(clazz + " expected properties=" + expected + " actual=" + actual); boolean equals = expected.equals(actual); if (equals == false) { System.out.println("expected = " + expected); System.out.println("actual = " + actual); } assertTrue(equals); // assertEquals(expected, actual); HashMap actualProps = new HashMap(); for (PropertyInfo prop : actual) actualProps.put(prop.getName(), prop); for (PropertyInfo propExpected : expected) { PropertyInfo propActual = actualProps.get(propExpected.getName()); AnnotationValue[] annotationsExpected = propExpected.getAnnotations(); AnnotationValue[] annotationsActual = propActual.getAnnotations(); Set expectedSet = new HashSet(); if (annotationsExpected != null) { for (AnnotationValue a : annotationsExpected) expectedSet.add(a); } Set actualSet = new HashSet(); if (annotationsActual != null) { for (AnnotationValue a : annotationsActual) actualSet.add(a); } getLog().debug("Checking annotations for " + propExpected.getName() + " expected: " + expectedSet + " actual=" + actualSet); assertEquals(expectedSet, actualSet); } } protected Set getExpectedProperties(Class clazz, BeanAccessMode mode) { TypeInfoFactory factory = getTypeInfoFactory(); Method[] methods = clazz.getMethods(); HashMap getters = new HashMap(); HashMap> setters = new HashMap>(); if (methods.length > 0) { for (Method method : methods) { String name = method.getName(); if (isGetter(method)) { String upperName = getUpperPropertyName(name); getters.put(upperName, method); } else if (isSetter(method)) { String upperName = getUpperPropertyName(name); List list = setters.get(upperName); if (list == null) { list = new ArrayList(); setters.put(upperName, list); } list.add(method); } } } Map properties = new HashMap(); if (getters.isEmpty() == false) { for (Iterator> i = getters.entrySet().iterator(); i.hasNext();) { Map.Entry entry = i.next(); String name = entry.getKey(); Method getter = entry.getValue(); Method setter = null; List setterList = setters.remove(name); if (setterList != null && setterList.size() != 0) { for (int j = 0; j < setterList.size(); ++j) { Method thisSetter = setterList.get(j); Type pinfo = thisSetter.getGenericParameterTypes()[0]; if (getter.getGenericReturnType().equals(pinfo) == true) { setter = thisSetter; break; } } } String lowerName = getLowerPropertyName(name); // Merge the annotations between the getters and setters Set getterAnnotations = getExpectedAnnotations(getter.getAnnotations()); Set setterAnnotations = null; if (setter != null) setterAnnotations = getExpectedAnnotations(setter.getAnnotations()); AnnotationValue[] annotations = getterAnnotations.toArray(new AnnotationValue[getterAnnotations.size()]); if (annotations == null || annotations.length == 0) { if (setterAnnotations != null) annotations = setterAnnotations.toArray(new AnnotationValue[setterAnnotations.size()]); } else if (setterAnnotations != null && setterAnnotations.size() > 0) { HashSet merged = new HashSet(); merged.addAll(getterAnnotations); merged.addAll(setterAnnotations); annotations = merged.toArray(new AnnotationValue[merged.size()]); } 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, getter.getModifiers(), declaringType); MethodInfo setterInfo = null; if (setter != null) { declaringType = (ClassInfo) factory.getTypeInfo(setter.getDeclaringClass()); 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, setter.getModifiers(), declaringType); } properties.put(lowerName, new DefaultPropertyInfo(lowerName, name, type, getterInfo, setterInfo, annotations)); } } if (setters.isEmpty() == false) { for (Iterator>> i = setters.entrySet().iterator(); i.hasNext();) { Map.Entry> entry = i.next(); String name = entry.getKey(); List setterList = entry.getValue(); // TODO JBMICROCONT-125 Maybe should just create duplicate propertyInfo and let the configurator guess? if (setterList.size() == 1) { Method setter = setterList.get(0); Type pinfo = setter.getGenericParameterTypes()[0]; TypeInfo type = factory.getTypeInfo(pinfo); String lowerName = getLowerPropertyName(name); Set setterAnnotations = getExpectedAnnotations(setter.getAnnotations()); AnnotationValue[] annotations = setterAnnotations.toArray(new AnnotationValue[setterAnnotations.size()]); ClassInfo declaringType = (ClassInfo) factory.getTypeInfo(setter.getDeclaringClass()); 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, setter.getModifiers(), declaringType); properties.put(lowerName, new DefaultPropertyInfo(lowerName, name, type, null, setterInfo, annotations)); } } } if (mode != BeanAccessMode.STANDARD) { ClassInfo classInfo = (ClassInfo)factory.getTypeInfo(clazz); Set fields = getFields(classInfo, mode); for(FieldInfo field : fields) { String name = field.getName(); PropertyInfo pi = properties.get(name); if (pi == null) { properties.put(name, new FieldPropertyInfo(field)); } else if (pi.isReadable() == false) { properties.put(name, new SetterAndFieldPropertyInfo(pi, field)); } else if (pi.isWritable() == false) { properties.put(name, new GetterAndFieldPropertyInfo(pi, field)); } } } return new HashSet(properties.values()); } protected Set getExpectedAnnotationProperties(Class clazz) { TypeInfoFactory factory = getTypeInfoFactory(); HashSet properties = new HashSet(); Method[] methods = clazz.getDeclaredMethods(); for (Method method : methods) { TypeInfo returnType = factory.getTypeInfo(method.getGenericReturnType()); Class[] parameters = method.getParameterTypes(); if (parameters.length == 0 && PrimitiveInfo.VOID.equals(returnType) == false) { String name = method.getName(); ClassInfo declaringType = (ClassInfo) factory.getTypeInfo(method.getDeclaringClass()); Set 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, method.getModifiers(), declaringType); properties.add(new DefaultPropertyInfo(name, name, returnType, getter, null, annotations)); } } return properties; } /** * Get the fields * * @param classInfo the class info * @param mode the mode * @return the fields */ protected static Set getFields(ClassInfo classInfo, BeanAccessMode mode) { HashSet fields = new HashSet(); while (classInfo != null) { FieldInfo[] finfos = classInfo.getDeclaredFields(); if (finfos != null && finfos.length > 0) { for (int i = 0; i < finfos.length; ++i) { FieldInfo field = finfos[i]; if ((mode == BeanAccessMode.FIELDS && field.isPublic()) || (mode == BeanAccessMode.ALL)) fields.add(field); } } classInfo = classInfo.getSuperclass(); } return fields; } protected static String getUpperPropertyName(String name) { int start = 3; if (name.startsWith("is")) start = 2; return name.substring(start); } protected static String getLowerPropertyName(String name) { // If the second character is upper case then we don't make // the first character lower case if (name.length() > 1) { if (Character.isUpperCase(name.charAt(1))) return name; } StringBuilder buffer = new StringBuilder(name.length()); buffer.append(Character.toLowerCase(name.charAt(0))); if (name.length() > 1) buffer.append(name.substring(1)); return buffer.toString(); } protected static boolean isGetter(Method method) { String name = method.getName(); Class returnType = method.getReturnType(); Class[] parameters = method.getParameterTypes(); if ((name.length() > 3 && name.startsWith("get")) || (name.length() > 2 && name.startsWith("is"))) { // isBoolean() is not a getter for java.lang.Boolean if (name.startsWith("is") && returnType.equals(Boolean.TYPE) == false) return false; if (parameters.length == 0 && Void.TYPE.equals(returnType) == false) return true; } return false; } protected static boolean isSetter(Method method) { String name = method.getName(); Class returnType = method.getReturnType(); Class[] parameters = method.getParameterTypes(); if ((name.length() > 3 && name.startsWith("set"))) { if (parameters.length == 1 && Void.TYPE.equals(returnType)) return true; } return false; } protected TypeInfoFactory getTypeInfoFactory() { return configuration.getTypeInfoFactory(); } protected BeanInfo getBeanInfo(Class clazz) throws Throwable { return configuration.getBeanInfo(clazz); } protected BeanInfo getBeanInfo(Class clazz, BeanAccessMode accessMode) throws Throwable { return configuration.getBeanInfo(clazz, accessMode); } protected Configuration getConfiguration() { return configuration; } protected void configureLogging() { enableTrace("org.jboss.beans"); } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/test/FieldAccessRestrictionTestCase.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/test/FieldAccessRestrictio0000644000175000017500000000363511010514643033326 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.test; import junit.framework.Test; import org.jboss.test.beaninfo.support.FieldsClass; /** * Field access restriction test. * * @author Ales Justin */ public class FieldAccessRestrictionTestCase extends AccessRestrictionTest { public FieldAccessRestrictionTestCase(String name) { super(name); } public static Test suite() { return suite(FieldAccessRestrictionTestCase.class); } protected FieldsClass getInstance() { return new FieldsClass(); } protected Class getInstanceClass() { return FieldsClass.class; } protected String getPublicString(FieldsClass instance) { return instance.pubString; } protected String getPrivateString(FieldsClass instance) { return instance.getPrivStringNotGetter(); } }././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/test/AccessRestrictionTest.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/test/AccessRestrictionTest0000644000175000017500000001144511010514643033376 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.test; import java.security.AccessControlException; import org.jboss.beans.info.spi.BeanAccessMode; import org.jboss.beans.info.spi.BeanInfo; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.config.plugins.BasicConfiguration; import org.jboss.config.spi.Configuration; import org.jboss.test.AbstractTestCaseWithSetup; import org.jboss.test.AbstractTestDelegate; /** * Access restriction test. * * @param exact tester class * @author Ales Justin */ public abstract class AccessRestrictionTest extends AbstractTestCaseWithSetup { /** The bean info factory */ private Configuration configuration = new BasicConfiguration(); /** * Create a new AccessRestrictionTest. * * @param name the test name */ protected AccessRestrictionTest(String name) { super(name); } /** * Default setup with security manager enabled * * @param clazz the class * @return the delegate * @throws Exception for any error */ public static AbstractTestDelegate getDelegate(Class clazz) throws Exception { AbstractTestDelegate delegate = new AbstractTestDelegate(clazz); delegate.enableSecurity = true; return delegate; } protected abstract T getInstance(); protected abstract Class getInstanceClass(); protected abstract String getPublicString(T instance); protected abstract String getPrivateString(T instance); public void testBeanFieldAccess() throws Throwable { // First try to get the Bean info without the priviledge on the private field T test = getInstance(); // This should work BeanInfo beanInfo = configuration.getBeanInfo(getInstanceClass(), BeanAccessMode.ALL); // We should be able to set the public field beanInfo.setProperty(test, "pubString", "public"); assertEquals("public", getPublicString(test)); // But we shouldn't be able to set the private field try { beanInfo.setProperty(test, "privString", "private"); fail("should not be here"); } catch (Throwable t) { checkThrowable(AccessControlException.class, t); } try { beanInfo.getProperty(test, "privString"); fail("should not be here"); } catch (Throwable t) { checkThrowable(AccessControlException.class, t); } assertNull(getPrivateString(test)); // Repeat for the properties PropertyInfo pubProp = beanInfo.getProperty("pubString"); test = getInstance(); pubProp.set(test, "public"); assertEquals("public", getPublicString(test)); PropertyInfo privProp = beanInfo.getProperty("privString"); try { privProp.set(test, "private"); fail("should not be here"); } catch (Throwable t) { checkThrowable(AccessControlException.class, t); } try { privProp.get(test); fail("should not be here"); } catch (Throwable t) { checkThrowable(AccessControlException.class, t); } assertNull(getPrivateString(test)); // Now lets disable security and check we can do what we couldn't do before SecurityManager sm = suspendSecurity(); try { test = getInstance(); beanInfo.setProperty(test, "privString", "private"); assertEquals("private", beanInfo.getProperty(test, "privString")); test = getInstance(); privProp.set(test, "private"); assertEquals("private", privProp.get(test)); } finally { resumeSecurity(sm); } } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/test/BeanInfoUnitTestCase.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/test/BeanInfoUnitTestCase.0000644000175000017500000003416210767032015033151 0ustar twernertwerner/* * 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.beaninfo.test; import java.util.HashSet; import java.util.Set; import junit.framework.Test; import org.jboss.beans.info.spi.BeanInfo; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.beans.info.spi.BeanAccessMode; import org.jboss.test.beaninfo.support.BeanInfoAnnotatedGetterAndSetter; import org.jboss.test.beaninfo.support.BeanInfoAnnotatedGetterAndSetterSimpleMerge; import org.jboss.test.beaninfo.support.BeanInfoAnnotatedGetterAndSetterWithInterface; import org.jboss.test.beaninfo.support.BeanInfoAnnotatedGetterOnly; import org.jboss.test.beaninfo.support.BeanInfoAnnotatedSetterOnly; import org.jboss.test.beaninfo.support.BeanInfoAnnotation; import org.jboss.test.beaninfo.support.BeanInfoBooleanProperties; import org.jboss.test.beaninfo.support.BeanInfoConstructors; import org.jboss.test.beaninfo.support.BeanInfoDefaultConstructor; import org.jboss.test.beaninfo.support.BeanInfoDoubleCovariantImpl; import org.jboss.test.beaninfo.support.BeanInfoEmpty; import org.jboss.test.beaninfo.support.BeanInfoGenericGetterAndSetter; import org.jboss.test.beaninfo.support.BeanInfoGenericGetterOnly; import org.jboss.test.beaninfo.support.BeanInfoGenericInconsistentTypes; import org.jboss.test.beaninfo.support.BeanInfoGenericInterfaceImpl; import org.jboss.test.beaninfo.support.BeanInfoGenericSetterOnly; import org.jboss.test.beaninfo.support.BeanInfoGetterAndSetter; import org.jboss.test.beaninfo.support.BeanInfoGetterOnly; import org.jboss.test.beaninfo.support.BeanInfoInconsistentTypes; import org.jboss.test.beaninfo.support.BeanInfoInterface; import org.jboss.test.beaninfo.support.BeanInfoParameterConstructor; import org.jboss.test.beaninfo.support.BeanInfoProperties; import org.jboss.test.beaninfo.support.BeanInfoSetterOnly; import org.jboss.test.beaninfo.support.BeanInfoUpperPropertyName; import org.jboss.test.beaninfo.support.BeanInfoMethods; import org.jboss.test.beaninfo.support.BeanInfoGetterAndField; import org.jboss.test.beaninfo.support.BeanInfoFields; import org.jboss.test.beaninfo.support.SubBeanInfoGetterAndSetter; import org.jboss.test.beaninfo.support.BeanInfoGetterAndSetter2; import org.jboss.test.beaninfo.support.BeanInfoGetterAndField2; import org.jboss.test.beaninfo.support.SubBeanInfoGetterAndField; import org.jboss.test.beaninfo.support.BeanInfoSetterAndField; import org.jboss.test.beaninfo.support.BeanInfoSetterAndField2; import org.jboss.test.beaninfo.support.SubBeanInfoSetterAndField; import org.jboss.test.beaninfo.support.BeanInfoExtendsFoo; import org.jboss.test.beaninfo.support.BeanInfoExtendsFoo2; import org.jboss.test.beaninfo.support.BeanInfoExtendsFoo3; import org.jboss.test.beaninfo.support.BeanInfoExtendsFoo4; import org.jboss.test.beaninfo.support.BeanInfoExtendsFoo5; import org.jboss.test.beaninfo.support.BeanInfoExtendsFoo6; import org.jboss.test.beaninfo.support.BeanInfoExtendsFoo7; import org.jboss.test.beaninfo.support.BeanInfoExtendsFoo8; /** * BeanInfo Test Case. * * @author Adrian Brock * @version $Revision: 45663 $ */ public class BeanInfoUnitTestCase extends AbstractBeanInfoTest { public static Test suite() { return suite(BeanInfoUnitTestCase.class); } public BeanInfoUnitTestCase(String name) { super(name); } public void testEmptyBean() throws Throwable { testBean(BeanInfoEmpty.class, null); } public void testBeanConstructors() throws Throwable { testBean(BeanInfoConstructors.class, null); } public void testBeanMethods() throws Throwable { testBean(BeanInfoMethods.class, null); } public void testBeanFields() throws Throwable { testBean(BeanInfoFields.class, null); } public void testBeanGetterOnly() throws Throwable { testBean(BeanInfoGetterOnly.class, new String[] { "something" }); } public void testBeanSetterOnly() throws Throwable { testBean(BeanInfoSetterOnly.class, new String[] { "something" }); } public void testBeanGetterAndField() throws Throwable { testBean(BeanInfoGetterAndField.class, new String[] { "something" }); testBean(BeanInfoGetterAndField2.class, new String[] { "something" }); testBean(SubBeanInfoGetterAndField.class, new String[] { "something" }); } public void testBeanSetterAndField() throws Throwable { testBean(BeanInfoSetterAndField.class, new String[] { "something" }); testBean(BeanInfoSetterAndField2.class, new String[] { "something" }); testBean(SubBeanInfoSetterAndField.class, new String[] { "something" }); } public void testBeanGetterAndSetter() throws Throwable { testBean(BeanInfoGetterAndSetter.class, new String[] { "something" }); testBean(BeanInfoGetterAndSetter2.class, new String[] { "something" }); testBean(SubBeanInfoGetterAndSetter.class, new String[] { "something" }); } public void testHierarchyBean() throws Throwable { testBean(BeanInfoExtendsFoo.class, BeanAccessMode.STANDARD, new String[]{}); testBean(BeanInfoExtendsFoo.class, BeanAccessMode.FIELDS, new String[]{"foo", "bar"}); testBean(BeanInfoExtendsFoo.class, BeanAccessMode.ALL, new String[]{"foo", "bar"}); testBean(BeanInfoExtendsFoo2.class, BeanAccessMode.STANDARD, new String[]{"bar"}); testBean(BeanInfoExtendsFoo2.class, BeanAccessMode.FIELDS, new String[]{"foo", "bar"}); testBean(BeanInfoExtendsFoo2.class, BeanAccessMode.ALL, new String[]{"foo", "bar"}); testBean(BeanInfoExtendsFoo3.class, BeanAccessMode.STANDARD, new String[]{}); testBean(BeanInfoExtendsFoo3.class, BeanAccessMode.FIELDS, new String[]{"bar"}); testBean(BeanInfoExtendsFoo3.class, BeanAccessMode.ALL, new String[]{"foo", "bar"}); testBean(BeanInfoExtendsFoo4.class, BeanAccessMode.STANDARD, new String[]{"bar"}); testBean(BeanInfoExtendsFoo4.class, BeanAccessMode.FIELDS, new String[]{"bar"}); testBean(BeanInfoExtendsFoo4.class, BeanAccessMode.ALL, new String[]{"foo", "bar"}); testBean(BeanInfoExtendsFoo5.class, BeanAccessMode.STANDARD, new String[]{}); testBean(BeanInfoExtendsFoo5.class, BeanAccessMode.FIELDS, new String[]{}); testBean(BeanInfoExtendsFoo5.class, BeanAccessMode.ALL, new String[]{"foo", "bar"}); testBean(BeanInfoExtendsFoo6.class, BeanAccessMode.STANDARD, new String[]{"foo"}); testBean(BeanInfoExtendsFoo6.class, BeanAccessMode.FIELDS, new String[]{"foo"}); testBean(BeanInfoExtendsFoo6.class, BeanAccessMode.ALL, new String[]{"foo", "bar"}); testBean(BeanInfoExtendsFoo7.class, BeanAccessMode.STANDARD, new String[]{}); testBean(BeanInfoExtendsFoo7.class, BeanAccessMode.FIELDS, new String[]{}); testBean(BeanInfoExtendsFoo7.class, BeanAccessMode.ALL, new String[]{"bar"}); testBean(BeanInfoExtendsFoo8.class, BeanAccessMode.STANDARD, new String[]{}); testBean(BeanInfoExtendsFoo8.class, BeanAccessMode.FIELDS, new String[]{}); testBean(BeanInfoExtendsFoo8.class, BeanAccessMode.ALL, new String[]{"bar", "foo"}); } public void testBeanBooleanProperties() throws Throwable { testBean(BeanInfoBooleanProperties.class, new String[] { "something", "somethingElse" }); } public void testBeanUpperPropertyName() throws Throwable { testBean(BeanInfoUpperPropertyName.class, new String[] { "MBean" }); } public void testBeanInconsistentTypes() throws Throwable { testBean(BeanInfoInconsistentTypes.class, new String[] { "something" }); } public void testBeanGenericGetterOnly() throws Throwable { testBean(BeanInfoGenericGetterOnly.class, new String[] { "something" }); } public void testBeanGenericSetterOnly() throws Throwable { testBean(BeanInfoGenericSetterOnly.class, new String[] { "something" }); } public void testBeanGenericGetterAndSetter() throws Throwable { testBean(BeanInfoGenericGetterAndSetter.class, new String[] { "something" }); } public void testBeanGenericInconsistentTypes() throws Throwable { testBean(BeanInfoGenericInconsistentTypes.class, new String[] { "something" }); } public void testBeanAnnotatedGetterOnly() throws Throwable { testBean(BeanInfoAnnotatedGetterOnly.class, new String[] { "something" }); } public void testBeanAnnotatedSetterOnly() throws Throwable { testBean(BeanInfoAnnotatedSetterOnly.class, new String[] { "something" }); } public void testBeanAnnotatedGetterAndSetter() throws Throwable { testBean(BeanInfoAnnotatedGetterAndSetter.class, new String[] { "something" }); } public void testBeanAnnotatedGetterAndSetterWithInterface() throws Throwable { testBean(BeanInfoAnnotatedGetterAndSetterWithInterface.class, new String[] { "something" }); } public void testBeanAnnotatedGetterAndSetterSimpleMerge() throws Throwable { testBean(BeanInfoAnnotatedGetterAndSetterSimpleMerge.class, new String[] { "something" }); } public void testBeanInterface() throws Throwable { testBean(BeanInfoInterface.class, new String[] { "something" }); } public void testBeanAnnotation() throws Throwable { testBean(BeanInfoAnnotation.class, new String[] { "something" }); } public void testDefaultConstructor() throws Throwable { BeanInfo beanInfo = getBeanInfo(BeanInfoDefaultConstructor.class); assertNotNull(beanInfo); Object object = beanInfo.newInstance(); BeanInfoDefaultConstructor bean = assertInstanceOf(object, BeanInfoDefaultConstructor.class); assertTrue(bean.invoked); } public void testParameterConstructor() throws Throwable { BeanInfo beanInfo = getBeanInfo(BeanInfoParameterConstructor.class); assertNotNull(beanInfo); String invoked = "invoked"; Object object = beanInfo.newInstance(new String[] { String.class.getName() }, new Object[] { invoked }); BeanInfoParameterConstructor bean = assertInstanceOf(object, BeanInfoParameterConstructor.class); assertTrue(invoked == bean.invoked); } public void testGet() throws Throwable { BeanInfo beanInfo = getBeanInfo(BeanInfoProperties.class); assertNotNull(beanInfo); String invoked = "invoked"; BeanInfoProperties bean = assertInstanceOf(beanInfo.newInstance(), BeanInfoProperties.class); bean.notInvoked = invoked; assertTrue(invoked == beanInfo.getProperty(bean, "invoked")); } public void testSet() throws Throwable { BeanInfo beanInfo = getBeanInfo(BeanInfoProperties.class); assertNotNull(beanInfo); String invoked = "invoked"; BeanInfoProperties bean = assertInstanceOf(beanInfo.newInstance(), BeanInfoProperties.class); assertNull(bean.notInvoked); beanInfo.setProperty(bean, "invoked", invoked); assertTrue(invoked == bean.notInvoked); } public void testInvokeNoParametersAndResult() throws Throwable { BeanInfo beanInfo = getBeanInfo(BeanInfoProperties.class); assertNotNull(beanInfo); String invoked = "invoked"; BeanInfoProperties bean = assertInstanceOf(beanInfo.newInstance(), BeanInfoProperties.class); bean.notInvoked = invoked; assertTrue(invoked == beanInfo.invoke(bean, "getInvoked")); } public void testInvokeWithParameters() throws Throwable { BeanInfo beanInfo = getBeanInfo(BeanInfoProperties.class); assertNotNull(beanInfo); String invoked = "invoked"; BeanInfoProperties bean = assertInstanceOf(beanInfo.newInstance(), BeanInfoProperties.class); assertNull(bean.notInvoked); beanInfo.invoke(bean, "setInvoked", new String[] { String.class.getName() }, new Object[] { invoked }); assertTrue(invoked == bean.notInvoked); } public void testGenericInterfaceImpl() throws Throwable { BeanInfo beanInfo = getBeanInfo(BeanInfoGenericInterfaceImpl.class); assertNotNull(beanInfo); PropertyInfo property = beanInfo.getProperty("property"); assertNotNull(property); assertEquals("java.lang.String", property.getType().getName()); } public void testCovariantImpl() throws Throwable { BeanInfo beanInfo = getBeanInfo(BeanInfoDoubleCovariantImpl.class); assertNotNull(beanInfo); PropertyInfo property = beanInfo.getProperty("property"); assertNotNull(property); assertEquals("java.lang.Double", property.getType().getName()); } protected void testBean(Class clazz, String[] beanNames) throws Throwable { for (BeanAccessMode mode : BeanAccessMode.values()) { testBean(clazz, mode, beanNames); } } protected void testBean(Class clazz, BeanAccessMode mode, String[] beanNames) throws Throwable { BeanInfo beanInfo = getBeanInfo(clazz, mode); assertBeanInfo(beanInfo, clazz, mode); if (beanNames != null) { Set properties = beanInfo.getProperties(); Set props = new HashSet(); for (PropertyInfo p : properties) props.add(p.getName()); Set expected = new HashSet(); for (String beanName : beanNames) expected.add(beanName); if (clazz.isInterface() == false) expected.add("class"); assertEquals(expected, props); } } }libjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/0000755000175000017500000000000011620314117027715 5ustar twernertwerner././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoCache.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoCache.java0000644000175000017500000000220211112776757033203 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfoCache. * * @author Ales Justin */ public class BeanInfoCache { }././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoExtendsFoo2.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoExtendsFoo0000644000175000017500000000235310767032015033330 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfo foo | bar. * * @author Ales Justin */ public class BeanInfoExtendsFoo2 extends BeanInfoFoo { public String getBar() {return null;} } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoGetterAndField.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoGetterAndF0000644000175000017500000000241310767032015033232 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfoGetterAndField. * * @author Ales Justin */ public class BeanInfoGetterAndField { public int something; public int getSomething() { return 0; } } libjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/FieldsClass.java0000644000175000017500000000266310770635630032776 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * @author Ales Justin */ public class FieldsClass { @SuppressWarnings("unused") private String privString; protected String protString; public String pubString; public String getPrivStringNotGetter() { return privString; } public String getProtStringNotGetter() { return protString; } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/PrivateSetterNestedBean.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/PrivateSetterNeste0000644000175000017500000000326510770475034033461 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * @param blah * @author Ales Justin */ @SuppressWarnings("unchecked") public class PrivateSetterNestedBean implements SetGetHook { private T bean; private boolean usedSetter; public void doSetHook(T child) { setBean(child); } public T doGetHook() { return bean; } public boolean valid() { return isUsedSetter(); } public void setBean(T bean) { usedSetter = true; this.bean = bean; } public boolean isUsedSetter() { return usedSetter; } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/SubPubMixNestedBean.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/SubPubMixNestedBea0000644000175000017500000000230610767032015033277 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * @author Ales Justin */ public class SubPubMixNestedBean extends PubMixNestedBean { } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoAnnotatedSetterOnly.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoAnnotatedS0000644000175000017500000000241610535542663033322 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfoSetterOnly. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class BeanInfoAnnotatedSetterOnly { @BeanInfoAnnotation1 public void setSomething(BeanInfoGenericClass x) { } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoDefaultConstructor.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoDefaultCon0000644000175000017500000000244510557646633033316 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfoDefaultConstructor. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class BeanInfoDefaultConstructor { public boolean invoked = false; public BeanInfoDefaultConstructor() { invoked = true; } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoGetterAndSetter2.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoGetterAndS0000644000175000017500000000251210767032015033247 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfoGetterAndSetter2. * * @author Ales Justin */ public class BeanInfoGetterAndSetter2 extends SuperBeanInfoGetterAndSetter { public int getSomething() { return 0; } public void setSomething(int x) { } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/SubBeanInfoSetterAndField.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/SubBeanInfoSetterA0000644000175000017500000000236010767032015033271 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * SubBeanInfoGetterAndSetter. * * @author Ales Justin */ public class SubBeanInfoSetterAndField extends BeanInfoSetterOnly { public int something; } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoSetterOnly.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoSetterOnly0000644000175000017500000000232410535542663033370 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfoSetterOnly. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class BeanInfoSetterOnly { public void setSomething(int x) { } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/SubPrivateMixNestedBean.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/SubPrivateMixNeste0000644000175000017500000000232210767032015033405 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * @author Ales Justin */ public class SubPrivateMixNestedBean extends PrivateMixNestedBean { } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/PubMixNestedBean.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/PubMixNestedBean.j0000644000175000017500000000346610770475034033251 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * @param blah * @author Ales Justin */ @SuppressWarnings("unchecked") public class PubMixNestedBean implements SetGetHook { public T bean; private boolean usedSetterOrGetter; public void doSetHook(T child) { bean = child; } public T doGetHook() { return bean; } public boolean valid() { return isUsedSetterOrGetter(); } public PubMixNestedBean getBean() { usedSetterOrGetter = true; return bean; } public void setBean(T bean) { usedSetterOrGetter = true; this.bean = bean; } public boolean isUsedSetterOrGetter() { return usedSetterOrGetter; } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoSetterAndField.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoSetterAndF0000644000175000017500000000240010767032015033242 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfoSetterAndField. * * @author Ales Justin */ public class BeanInfoSetterAndField { public int something; public void setSomething(int x) { } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/SubPubNestedBean.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/SubPubNestedBean.j0000644000175000017500000000227510767032015033234 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * @author Ales Justin */ public class SubPubNestedBean extends PubNestedBean { } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/SubPrivateNestedBean.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/SubPrivateNestedBe0000644000175000017500000000231110767032015033340 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * @author Ales Justin */ public class SubPrivateNestedBean extends PrivateNestedBean { } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoAnnotation1.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoAnnotation0000644000175000017500000000244710535542663033400 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * BeanInfoAnnotation1. * * @author Adrian Brock * @version $Revision: 1.1 $ */ @Retention(RetentionPolicy.RUNTIME) public @interface BeanInfoAnnotation1 { } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/SubPubGetterNestedBean.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/SubPubGetterNested0000644000175000017500000000231710767032015033366 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * @author Ales Justin */ public class SubPubGetterNestedBean extends PubGetterNestedBean { } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoGetterAndField2.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoGetterAndF0000644000175000017500000000242610767032015033236 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfoGetterAndField. * * @author Ales Justin */ public class BeanInfoGetterAndField2 extends SuperBeanInfoGetterAndSetter { public int getSomething() { return 0; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/PrivateNestedBean.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/PrivateNestedBean.0000644000175000017500000000312110770475034033271 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * @param blah * @author Ales Justin */ @SuppressWarnings("unchecked") public class PrivateNestedBean implements SetGetHook { private T bean; public void doSetHook(T child) { xyz(child); } public T doGetHook() { return xyz(); } public boolean valid() { return bean != null; } public void xyz(T bean) { this.bean = bean; } public T xyz() { return bean; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoFields.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoFields.jav0000644000175000017500000000305610770475034033246 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; import java.util.Date; /** * BeanInfoFields * * @author Ales Justin */ public class BeanInfoFields { @SuppressWarnings("unused") private String stringPrivate; @SuppressWarnings("unused") private Date datePrivate; @SuppressWarnings("unused") private long longPrivate; protected String stringProt; protected Date dateProt; protected long longProt; public String stringPublic; public Date datePublic; public long longPublic; } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoExtendsFoo7.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoExtendsFoo0000644000175000017500000000233410767032015033327 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfo foo | bar. * * @author Ales Justin */ public class BeanInfoExtendsFoo7 extends BeanInfoFoo4 { protected String bar; } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoNumberCovariantImpl.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoNumberCova0000644000175000017500000000246710711416064033320 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * A BeanInfoNumberCovariantImpl * * @author Ales Justin */ public class BeanInfoNumberCovariantImpl { public Number getProperty() { return null; } public void setProperty(Number value) { } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/PrivateGetterNestedBean.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/PrivateGetterNeste0000644000175000017500000000326510770475034033445 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * @param blah * @author Ales Justin */ @SuppressWarnings("unchecked") public class PrivateGetterNestedBean implements SetGetHook { private T bean; private boolean usedGetter; public void doSetHook(T child) { bean = child; } public T doGetHook() { return bean; } public boolean valid() { return isUsedGetter() || bean != null; } public T getBean() { usedGetter = true; return bean; } public boolean isUsedGetter() { return usedGetter; } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoAnnotatedGetterAndSetter.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoAnnotatedG0000644000175000017500000000251710535542663033310 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfoGetterAndSetter. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class BeanInfoAnnotatedGetterAndSetter { @BeanInfoAnnotation1 public int getSomething() { return 0; } @BeanInfoAnnotation1 public void setSomething(int x) { } } libjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/NestedBean.java0000644000175000017500000000376010767032015032603 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * @author Ales Justin */ public class NestedBean implements SetGetHook { private NestedBean bean; private String string; public NestedBean() { } public NestedBean getBean() { return bean; } public void doSetHook(NestedBean child) { bean = child; } public NestedBean doGetHook() { return bean; } public boolean valid() { return bean != null; } public void setBean(NestedBean bean) { this.bean = bean; } public NestedBean getDifferentGetter() { return null; } public NestedBean getOtherBean() { NestedBean other = new NestedBean(); other.setString(string); return other; } public String getString() { return string; } public void setString(String string) { this.string = string; } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoGetterAndSetter.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoGetterAndS0000644000175000017500000000242610535542663033263 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfoGetterAndSetter. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class BeanInfoGetterAndSetter { public int getSomething() { return 0; } public void setSomething(int x) { } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/PubSetterNestedBean.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/PubSetterNestedBea0000644000175000017500000000325310770475034033346 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * @param blah * @author Ales Justin */ @SuppressWarnings("unchecked") public class PubSetterNestedBean implements SetGetHook { private T bean; private boolean usedSetter; public void doSetHook(T child) { bean = child; } public T doGetHook() { return bean; } public boolean valid() { return isUsedSetter(); } public void setBean(T bean) { usedSetter = true; this.bean = bean; } public boolean isUsedSetter() { return usedSetter; } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoGenericInterface.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoGenericInt0000644000175000017500000000253510711377006033304 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file 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.beaninfo.support; /** * A BeanInfoGenericInterface. * * @param exact property type * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public interface BeanInfoGenericInterface { T getProperty(); void setProperty(T value); } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoSetterAndField2.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoSetterAndF0000644000175000017500000000241210767032015033245 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfoGetterAndField. * * @author Ales Justin */ public class BeanInfoSetterAndField2 extends SuperBeanInfoGetterAndSetter { public void setSomething(int x) { } } libjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoFoo4.java0000644000175000017500000000231310767032015032775 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfo foo | bar. * * @author Ales Justin */ public class BeanInfoFoo4 { protected void setFoo(int foo){} } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoExtendsFoo.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoExtendsFoo0000644000175000017500000000232710767032015033331 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfo foo | bar. * * @author Ales Justin */ public class BeanInfoExtendsFoo extends BeanInfoFoo { public String bar; } libjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoFoo2.java0000644000175000017500000000227510767032015033002 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfo foo | bar. * * @author Ales Justin */ public class BeanInfoFoo2 { protected int foo; } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoParameterConstructor.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoParameterC0000644000175000017500000000246410557646633033316 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfoDefaultConstructor. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class BeanInfoParameterConstructor { public String invoked = null; public BeanInfoParameterConstructor(String param) { invoked = param; } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoInconsistentTypes.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoInconsiste0000644000175000017500000000224310535542663033376 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; public class BeanInfoInconsistentTypes { public String getSomething() { return null; } public void setSomething(long x) { } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoConstructors.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoConstructo0000644000175000017500000000267010756326650033430 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfoConstructors. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class BeanInfoConstructors { @SuppressWarnings("unused") private BeanInfoConstructors() {} BeanInfoConstructors(int p1) {} protected BeanInfoConstructors(int p1, String p2) {} public BeanInfoConstructors(long p1, String p2) throws IllegalArgumentException, IllegalStateException { } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/SubBeanInfoGetterAndSetter.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/SubBeanInfoGetterA0000644000175000017500000000236610767032015033263 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * SubBeanInfoGetterAndSetter. * * @author Ales Justin */ public class SubBeanInfoGetterAndSetter extends BeanInfoGetterAndSetter { public int something; } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoGenericInterfaceImpl.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoGenericInt0000644000175000017500000000265410710423452033302 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file 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.beaninfo.support; /** * A BeanInfoGenericInterfaceImpl. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class BeanInfoGenericInterfaceImpl implements BeanInfoGenericInterface { public String getProperty() { return null; } public void setProperty(String value) { } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoInterface.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoInterface.0000644000175000017500000000230310560404111033212 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2007, 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.beaninfo.support; /** * BeanInfoInterface. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public interface BeanInfoInterface { String getSomething(); } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoDoubleCovariantImpl.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoDoubleCova0000644000175000017500000000253310711416064033274 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * A BeanInfoDoubleCovariantImpl * * @author Ales Justin */ public class BeanInfoDoubleCovariantImpl extends BeanInfoNumberCovariantImpl { public Double getProperty() { return null; } public void setProperty(Double value) { } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/SubPrivateGetterNestedBean.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/SubPrivateGetterNe0000644000175000017500000000233310767032015033370 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * @author Ales Justin */ public class SubPrivateGetterNestedBean extends PrivateGetterNestedBean { } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoEmpty.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoEmpty.java0000644000175000017500000000223510535542663033277 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfoEmpty. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class BeanInfoEmpty { } ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoAnnotatedGetterAndSetterWithInterface.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoAnnotatedG0000644000175000017500000000263610710123620033271 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfoGetterAndSetterWithInterface. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class BeanInfoAnnotatedGetterAndSetterWithInterface implements BeanInfoAnnotatedGetterAndSetterInterface { @BeanInfoAnnotation1 public int getSomething() { return 0; } @BeanInfoAnnotation1 public void setSomething(int x) { } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/SubPubSetterNestedBean.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/SubPubSetterNested0000644000175000017500000000231710767032015033402 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * @author Ales Justin */ public class SubPubSetterNestedBean extends PubSetterNestedBean { } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoExtendsFoo3.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoExtendsFoo0000644000175000017500000000233110767032015033324 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfo foo | bar. * * @author Ales Justin */ public class BeanInfoExtendsFoo3 extends BeanInfoFoo2 { public String bar; } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/PubGetterNestedBean.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/PubGetterNestedBea0000644000175000017500000000325710770475034033336 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * @param blah * @author Ales Justin */ @SuppressWarnings("unchecked") public class PubGetterNestedBean implements SetGetHook { private T bean; private boolean usedGetter; public PubGetterNestedBean getBean() { usedGetter = true; return bean; } public void doSetHook(T child) { bean = child; } public T doGetHook() { return bean; } public boolean valid() { return isUsedGetter(); } public boolean isUsedGetter() { return usedGetter; } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoGetterOnly.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoGetterOnly0000644000175000017500000000233610535542663033357 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfoGetterOnly. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class BeanInfoGetterOnly { public int getSomething() { return 0; } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoGenericSetterOnly.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoGenericSet0000644000175000017500000000236410535542663033314 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfoSetterOnly. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class BeanInfoGenericSetterOnly { public void setSomething(BeanInfoGenericClass x) { } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoGenericGetterAndSetter.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoGenericGet0000644000175000017500000000252210535542663033274 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfoGetterAndSetter. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class BeanInfoGenericGetterAndSetter { public BeanInfoGenericClass getSomething() { return null; } public void setSomething(BeanInfoGenericClass x) { } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/PrivateMixNestedBean.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/PrivateMixNestedBe0000644000175000017500000000346310770475034033363 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * @param blah * @author Ales Justin */ @SuppressWarnings("unchecked") public class PrivateMixNestedBean implements SetGetHook { private T bean; private boolean usedSetterOrGetter; public void doSetHook(T child) { setBean(child); } public T doGetHook() { return getBean(); } public boolean valid() { return bean != null; } public T getBean() { usedSetterOrGetter = true; return bean; } public void setBean(T bean) { usedSetterOrGetter = true; this.bean = bean; } public boolean isUsedSetterOrGetter() { return usedSetterOrGetter; } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoAnnotation2.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoAnnotation0000644000175000017500000000244710535542663033400 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * BeanInfoAnnotation1. * * @author Adrian Brock * @version $Revision: 1.1 $ */ @Retention(RetentionPolicy.RUNTIME) public @interface BeanInfoAnnotation2 { } libjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoFoo.java0000644000175000017500000000227210767032015032715 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfo foo | bar. * * @author Ales Justin */ public class BeanInfoFoo { public int foo; } libjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/MethodsClass.java0000644000175000017500000000367111041653046033164 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * @author Ales Justin */ public class MethodsClass { @SuppressWarnings("unused") private String privString; protected String protString; public String pubString; public String getPrivStringNotGetter() { return privString; } @SuppressWarnings("unused") private String getPrivString() { return privString; } @SuppressWarnings("unused") private void setPrivString(String privString) { this.privString = privString; } protected String getProtStringNotGetter() { return protString; } protected void setProtString(String protString) { this.protString = protString; } public String getPubString() { return pubString; } public void setPubString(String pubString) { this.pubString = pubString; } }libjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/SetGetHook.java0000644000175000017500000000236510767032015032607 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * @param exact type * @author Ales Justin */ public interface SetGetHook { void doSetHook(T child); T doGetHook(); boolean valid(); } libjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoFoo3.java0000644000175000017500000000231010767032015032771 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfo foo | bar. * * @author Ales Justin */ public class BeanInfoFoo3 { public void setFoo(int foo){} } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoExtendsFoo6.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoExtendsFoo0000644000175000017500000000233410767032015033327 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfo foo | bar. * * @author Ales Justin */ public class BeanInfoExtendsFoo6 extends BeanInfoFoo3 { protected String bar; } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoGenericGetterOnly.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoGenericGet0000644000175000017500000000240110535542663033270 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfoGetterOnly. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class BeanInfoGenericGetterOnly { public BeanInfoGenericClass getSomething() { return null; } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoExtendsFoo5.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoExtendsFoo0000644000175000017500000000233410767032015033327 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfo foo | bar. * * @author Ales Justin */ public class BeanInfoExtendsFoo5 extends BeanInfoFoo2 { protected String bar; } ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoAnnotatedGetterAndSetterSimpleMerge.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoAnnotatedG0000644000175000017500000000253210535542663033305 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfoGetterAndSetter. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class BeanInfoAnnotatedGetterAndSetterSimpleMerge { @BeanInfoAnnotation1 public int getSomething() { return 0; } @BeanInfoAnnotation2 public void setSomething(int x) { } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/SuperBeanInfoGetterAndSetter.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/SuperBeanInfoGette0000644000175000017500000000233210767032015033336 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * SuperBeanInfoGetterAndSetter. * * @author Ales Justin */ public class SuperBeanInfoGetterAndSetter { public int something; } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/SubPrivateSetterNestedBean.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/SubPrivateSetterNe0000644000175000017500000000233310767032015033404 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * @author Ales Justin */ public class SubPrivateSetterNestedBean extends PrivateSetterNestedBean { } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoExtendsFoo4.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoExtendsFoo0000644000175000017500000000235410767032015033331 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfo foo | bar. * * @author Ales Justin */ public class BeanInfoExtendsFoo4 extends BeanInfoFoo2 { public String getBar() {return null;} } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoUpperPropertyName.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoUpperPrope0000644000175000017500000000243310535542663033362 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfoUpperPropertyName. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class BeanInfoUpperPropertyName { public Object getMBean() { return null; } public void setMBean(Object x) { } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/SubBeanInfoGetterAndField.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/SubBeanInfoGetterA0000644000175000017500000000236010767032015033255 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * SubBeanInfoGetterAndSetter. * * @author Ales Justin */ public class SubBeanInfoGetterAndField extends BeanInfoGetterOnly { public int something; } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoAnnotatedGetterOnly.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoAnnotatedG0000644000175000017500000000237710535542663033314 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfoGetterOnly. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class BeanInfoAnnotatedGetterOnly { @BeanInfoAnnotation1 public int getSomething() { return 0; } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoAnnotation.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoAnnotation0000644000175000017500000000230210560404111033345 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2007, 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.beaninfo.support; /** * BeanInfoInterface. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public @interface BeanInfoAnnotation { String something(); } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoGenericInconsistentTypes.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoGenericInc0000644000175000017500000000253610535542663033273 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfoGenericInconsistentTypes. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class BeanInfoGenericInconsistentTypes { public BeanInfoGenericClass getSomething() { return null; } public void setSomething(BeanInfoGenericClass x) { } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoProperties.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoProperties0000644000175000017500000000263610560664062033416 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfoDefaultConstructor. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class BeanInfoProperties { public String notInvoked = null; public BeanInfoProperties() { } public String getInvoked() { return notInvoked; } public void setInvoked(String invoked) { this.notInvoked = invoked; } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/PubNestedBean.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/PubNestedBean.java0000644000175000017500000000272110770475034033254 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * @param blah * @author Ales Justin */ @SuppressWarnings("unchecked") public class PubNestedBean implements SetGetHook { public T bean; public void doSetHook(T child) { bean = child; } public T doGetHook() { return bean; } public boolean valid() { return bean != null; } } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoAnnotatedGetterAndSetterInterface.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoAnnotatedG0000644000175000017500000000240510710123357033272 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfoGetterAndSetterInterface. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public interface BeanInfoAnnotatedGetterAndSetterInterface { int getSomething(); void setSomething(int x); } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoGenericClass.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoGenericCla0000644000175000017500000000231410535542663033253 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfoGenericClass. * * @param the generic type * @author Adrian Brock * @version $Revision: 1.1 $ */ public class BeanInfoGenericClass { } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoExtendsFoo8.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoExtendsFoo0000644000175000017500000000236310767032015033331 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfo foo | bar. * * @author Ales Justin */ public class BeanInfoExtendsFoo8 extends BeanInfoFoo4 { protected String bar; protected int foo; } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoMethods.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoMethods.ja0000644000175000017500000000667210767032015033256 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfoMethodsClass * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class BeanInfoMethods { private void voidMethodVoidPrivate() {} private long longMethodVoidPrivate() { return 0; } private void voidMethodintPrivate(int p1) {} private long longMethodintPrivate(int p1) { return 0; } private void voidMethodintStringPrivate(int p1, String p2) {} private long longMethodintStringPrivate(int p1, String p2) { return 0; } private long longMethodintStringThrowsPrivate(int p1, String p2) throws IllegalArgumentException, IllegalStateException { return 0; } void voidMethodVoidPackage() { voidMethodVoidPrivate(); } long longMethodVoidPackage() { return longMethodVoidPrivate(); } void voidMethodintPackage(int p1) { voidMethodintPrivate(p1); } long longMethodintPackage(int p1) { return longMethodintPrivate(p1); } void voidMethodintStringPackage(int p1, String p2) { voidMethodintStringPrivate(p1, p2); } long longMethodintStringPackage(int p1, String p2) { return longMethodintStringPrivate(p1, p2); } long longMethodintStringThrowsPackage(int p1, String p2) throws IllegalArgumentException, IllegalStateException { return longMethodintStringThrowsPrivate(p1, p2); } protected void voidMethodVoidProtected() {} protected long longMethodVoidProtected() { return 0; } protected void voidMethodintProtected(int p1) {} protected long longMethodintProtected(int p1) { return 0; } protected void voidMethodintStringProtected(int p1, String p2) {} protected long longMethodintStringProtected(int p1, String p2) { return 0; } protected long longMethodintStringThrowsProtected(int p1, String p2) throws IllegalArgumentException, IllegalStateException { return 0; } public void voidMethodVoidPublic() {} public long longMethodVoidPublic() { return 0; } public void voidMethodintPublic(int p1) {} public long longMethodintPublic(int p1) { return 0; } public void voidMethodintStringPublic(int p1, String p2) {} public long longMethodintStringPublic(int p1, String p2) { return 0; } public long longMethodintStringThrowsPublic(int p1, String p2) throws IllegalArgumentException, IllegalStateException { return 0; } public long a() { return 0; } public long ab() { return 0; } public boolean is() { return false; } public long get() { return 0; } public void x(long x) {} public void xy(long xy) {} public void set(long xy) {} } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoBooleanProperties.javalibjboss-reflect-java-2.0.3.GA.orig/src/test/java/org/jboss/test/beaninfo/support/BeanInfoBooleanPro0000644000175000017500000000273210535542663033323 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beaninfo.support; /** * BeanInfoBooleanProperties * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class BeanInfoBooleanProperties { public boolean isSomething() { return true; } public void setSomething(boolean x) { } public Boolean getSomethingElse() { return true; } public void setSomethingElse(Boolean x) { } public Boolean isNotGetter() { return true; } } libjboss-reflect-java-2.0.3.GA.orig/src/main/0000755000175000017500000000000011620314121020551 5ustar twernertwernerlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/0000755000175000017500000000000011620314121021472 5ustar twernertwernerlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/0000755000175000017500000000000011620314121022261 5ustar twernertwernerlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/0000755000175000017500000000000011620314127023407 5ustar twernertwernerlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/config/0000755000175000017500000000000011620314126024653 5ustar twernertwernerlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/config/plugins/0000755000175000017500000000000011620314126026334 5ustar twernertwernerlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/config/plugins/BasicConfiguration.java0000644000175000017500000000460410763231257032766 0ustar twernertwerner/* * 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.config.plugins; import org.jboss.beans.info.plugins.AbstractBeanInfoFactory; import org.jboss.beans.info.spi.BeanInfoFactory; import org.jboss.classadapter.plugins.BasicClassAdapterFactory; import org.jboss.classadapter.spi.ClassAdapterFactory; import org.jboss.joinpoint.plugins.BasicJoinpointFactoryBuilder; import org.jboss.joinpoint.spi.JoinpointFactoryBuilder; import org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactory; import org.jboss.reflect.spi.TypeInfoFactory; /** * Basic configuration. * * @author Adrian Brock * @version $Revision: 70359 $ */ public class BasicConfiguration extends AbstractConfiguration { /** * Create an abstract configuration */ public BasicConfiguration() { } protected BeanInfoFactory createDefaultBeanInfoFactory() throws Throwable { return new AbstractBeanInfoFactory(); } protected ClassAdapterFactory createDefaultClassAdapterFactory() throws Throwable { BasicClassAdapterFactory result = new BasicClassAdapterFactory(); result.setConfiguration(this); return result; } protected TypeInfoFactory createDefaultTypeInfoFactory() throws Throwable { return new IntrospectionTypeInfoFactory(); } protected JoinpointFactoryBuilder createDefaultJoinpointFactoryBuilder() throws Throwable { return new BasicJoinpointFactoryBuilder(); } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/config/plugins/AbstractConfiguration.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/config/plugins/AbstractConfiguration.jav0000644000175000017500000002113510767032015033340 0ustar twernertwerner/* * 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.config.plugins; import java.lang.reflect.Type; import org.jboss.beans.info.spi.BeanInfo; import org.jboss.beans.info.spi.BeanInfoFactory; import org.jboss.beans.info.spi.BeanAccessMode; import org.jboss.classadapter.spi.ClassAdapter; import org.jboss.classadapter.spi.ClassAdapterFactory; import org.jboss.config.spi.Configuration; import org.jboss.config.spi.ConfigurationPermission; import org.jboss.joinpoint.spi.JoinpointFactoryBuilder; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.reflect.spi.TypeInfoFactory; import org.jboss.util.NestedRuntimeException; /** * Abstract configuration. * * @author Adrian Brock * @version $Revision: 70886 $ */ public abstract class AbstractConfiguration implements Configuration { /** The default bean info factory */ private BeanInfoFactory beanInfoFactory; /** The default class adaptor factory */ private ClassAdapterFactory classAdapterFactory; /** The default type info factory */ private TypeInfoFactory typeInfoFactory; /** The default type joinpoint factory builder */ private JoinpointFactoryBuilder joinpointFactoryBuilder; /** * Create an abstract configuration */ public AbstractConfiguration() { } public BeanInfo getBeanInfo(String className, ClassLoader cl) throws ClassNotFoundException { ClassAdapter classAdapter = getClassAdapterFactory().getClassAdapter(className, cl); return getBeanInfoFactory().getBeanInfo(classAdapter); } public BeanInfo getBeanInfo(Class clazz) { ClassAdapter classAdapter = getClassAdapterFactory().getClassAdapter(clazz); return getBeanInfoFactory().getBeanInfo(classAdapter); } public BeanInfo getBeanInfo(TypeInfo typeInfo) { ClassAdapter classAdapter = getClassAdapterFactory().getClassAdapter(typeInfo); return getBeanInfoFactory().getBeanInfo(classAdapter); } public BeanInfo getBeanInfo(String className, ClassLoader cl, BeanAccessMode accessMode) throws ClassNotFoundException { ClassAdapter classAdapter = getClassAdapterFactory().getClassAdapter(className, cl); return getBeanInfoFactory().getBeanInfo(classAdapter, accessMode); } public BeanInfo getBeanInfo(Class clazz, BeanAccessMode accessMode) { ClassAdapter classAdapter = getClassAdapterFactory().getClassAdapter(clazz); return getBeanInfoFactory().getBeanInfo(classAdapter, accessMode); } public BeanInfo getBeanInfo(TypeInfo typeInfo, BeanAccessMode accessMode) { ClassAdapter classAdapter = getClassAdapterFactory().getClassAdapter(typeInfo); return getBeanInfoFactory().getBeanInfo(classAdapter, accessMode); } public ClassInfo getClassInfo(String className, ClassLoader cl) throws ClassNotFoundException { ClassAdapter classAdapter = getClassAdapterFactory().getClassAdapter(className, cl); return classAdapter.getClassInfo(); } public ClassInfo getClassInfo(Class clazz) { ClassAdapter classAdapter = getClassAdapterFactory().getClassAdapter(clazz); return classAdapter.getClassInfo(); } public TypeInfo getTypeInfo(Type type) { return getTypeInfoFactory().getTypeInfo(type); } public TypeInfo getTypeInfo(String type, ClassLoader cl) throws ClassNotFoundException { return getTypeInfoFactory().getTypeInfo(type, cl); } public TypeInfoFactory getTypeInfoFactory() { if (typeInfoFactory == null) { try { typeInfoFactory = createDefaultTypeInfoFactory(); } catch (RuntimeException e) { throw e; } catch (Error e) { throw e; } catch (Throwable t) { throw new NestedRuntimeException("Cannot create TypeInfoFactory", t); } } return typeInfoFactory; } public JoinpointFactoryBuilder getJoinpointFactoryBuilder() { if (joinpointFactoryBuilder == null) { try { joinpointFactoryBuilder = createDefaultJoinpointFactoryBuilder(); } catch (RuntimeException e) { throw e; } catch (Error e) { throw e; } catch (Throwable t) { throw new NestedRuntimeException("Cannot create JoinpointFactoryBuilder", t); } } return joinpointFactoryBuilder; } public void setBeanInfoFactory(BeanInfoFactory beanInfoFactory) { checkPermissionName("beanInfoFactory"); this.beanInfoFactory = beanInfoFactory; } public void setClassAdapterFactory(ClassAdapterFactory classAdapterFactory) { checkPermissionName("classAdapterFactory"); this.classAdapterFactory = classAdapterFactory; } public void setTypeInfoFactory(TypeInfoFactory typeInfoFactory) { checkPermissionName("typeInfoFactory"); this.typeInfoFactory = typeInfoFactory; } public void setJoinpointFactoryBuilder(JoinpointFactoryBuilder joinpointFactoryBuilder) { checkPermissionName("joinpointFactoryBuilder"); this.joinpointFactoryBuilder = joinpointFactoryBuilder; } /** * Get the BeanInfoFactory * * @return the BeanInfoFactory */ protected BeanInfoFactory getBeanInfoFactory() { if (beanInfoFactory == null) { try { beanInfoFactory = createDefaultBeanInfoFactory(); } catch (RuntimeException e) { throw e; } catch (Error e) { throw e; } catch (Throwable t) { throw new RuntimeException("Error creating bean info factory"); } } return beanInfoFactory; } /** * Get the class adapter factory * * @return the ClassAdapterFactory */ protected ClassAdapterFactory getClassAdapterFactory() { if (classAdapterFactory == null) { try { classAdapterFactory = createDefaultClassAdapterFactory(); } catch (RuntimeException e) { throw e; } catch (Error e) { throw e; } catch (Throwable t) { throw new RuntimeException("Error creating class adapter"); } } return classAdapterFactory; } /** * Create the default bean info factory * * @return the bean info factory * @throws Throwable for any error */ protected abstract BeanInfoFactory createDefaultBeanInfoFactory() throws Throwable; /** * Create the default class adapter factory * * @return the class adapter factory * @throws Throwable for any error */ protected abstract ClassAdapterFactory createDefaultClassAdapterFactory() throws Throwable; /** * Create the default type info factory * * @return the type info factory * @throws Throwable for any error */ protected abstract TypeInfoFactory createDefaultTypeInfoFactory() throws Throwable; /** * Create the default joinpoint factory builder * * @return the joinpoint factory builder * @throws Throwable for any error */ protected abstract JoinpointFactoryBuilder createDefaultJoinpointFactoryBuilder() throws Throwable; /** * Check a permission * * @param name the name of the permission */ private void checkPermissionName(String name) { SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkPermission(new ConfigurationPermission(name)); } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/config/plugins/property/0000755000175000017500000000000011620314126030220 5ustar twernertwerner././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/config/plugins/property/PropertyConfigurationConstants.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/config/plugins/property/PropertyConfigur0000644000175000017500000000516610763231257033506 0ustar twernertwerner/* * 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.config.plugins.property; import org.jboss.beans.info.spi.BeanInfoFactory; import org.jboss.classadapter.spi.ClassAdapterFactory; import org.jboss.joinpoint.spi.JoinpointFactoryBuilder; import org.jboss.reflect.spi.TypeInfoFactory; /** * Constants. * * @author Adrian Brock * @version $Revision: 70359 $ */ public interface PropertyConfigurationConstants { /** The BeanInfoFactory property name */ static final String BEAN_INFO_FACTORY_NAME = BeanInfoFactory.class.getName(); /** The BeanInfoFactory default value */ static final String BEAN_INFO_FACTORY_DEFAULT="org.jboss.beans.info.plugins.AbstractBeanInfoFactory"; /** The ClassAdapterFactory property name */ static final String CLASS_ADAPTER_FACTORY_NAME = ClassAdapterFactory.class.getName(); /** The ClassAdapterFactory default value */ static final String CLASS_ADAPTER_FACTORY_DEFAULT="org.jboss.classadapter.plugins.BasicClassAdapterFactory"; /** The JoinpointFactoryBuilder property name */ static final String JOIN_POINT_FACTORY_BUILDER_NAME = JoinpointFactoryBuilder.class.getName(); /** The JoinpointFactoryBuiylder default value */ static final String JOIN_POINT_FACTORY_BUILDER_DEFAULT="org.jboss.aop.microcontainer.integration.AOPJoinpointFactoryBuilder:org.jboss.joinpoint.plugins.BasicJoinpointFactoryBuilder"; /** The TypeInfoFactory property name */ static final String TYPE_INFO_FACTORY_NAME = TypeInfoFactory.class.getName(); /** The TypeInfoFactory default value */ static final String TYPE_INFO_FACTORY_DEFAULT="org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactory"; } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/config/plugins/property/PropertyConfiguration.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/config/plugins/property/PropertyConfigur0000644000175000017500000001171110763231257033477 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.config.plugins.property; import java.util.Properties; import java.util.StringTokenizer; import org.jboss.beans.info.spi.BeanInfoFactory; import org.jboss.classadapter.spi.ClassAdapterFactory; import org.jboss.config.plugins.AbstractConfiguration; import org.jboss.joinpoint.spi.JoinpointFactoryBuilder; import org.jboss.logging.Logger; import org.jboss.reflect.spi.TypeInfoFactory; /** * PropertyConfiguration. * * @author Adrian Brock * @version $Revision: 70359 $ */ public class PropertyConfiguration extends AbstractConfiguration { /** The log */ private static final Logger log = Logger.getLogger(PropertyConfiguration.class); /** The properties */ protected Properties properties; /** * Create a configuration */ public PropertyConfiguration() { this(null); } /** * Create a configuration * * @param properties the properties */ public PropertyConfiguration(Properties properties) { if (properties == null) properties = System.getProperties(); this.properties = properties; } /** * Get the properties * * @return the properties */ public Properties getProperties() { return properties; } protected BeanInfoFactory createDefaultBeanInfoFactory() throws Throwable { return (BeanInfoFactory) loadFromProperties(PropertyConfigurationConstants.BEAN_INFO_FACTORY_NAME, PropertyConfigurationConstants.BEAN_INFO_FACTORY_DEFAULT, BeanInfoFactory.class); } protected ClassAdapterFactory createDefaultClassAdapterFactory() throws Throwable { ClassAdapterFactory result = (ClassAdapterFactory) loadFromProperties(PropertyConfigurationConstants.CLASS_ADAPTER_FACTORY_NAME, PropertyConfigurationConstants.CLASS_ADAPTER_FACTORY_DEFAULT, ClassAdapterFactory.class); result.setConfiguration(this); return result; } protected TypeInfoFactory createDefaultTypeInfoFactory() throws Throwable { return (TypeInfoFactory) loadFromProperties(PropertyConfigurationConstants.TYPE_INFO_FACTORY_NAME, PropertyConfigurationConstants.TYPE_INFO_FACTORY_DEFAULT, TypeInfoFactory.class); } protected JoinpointFactoryBuilder createDefaultJoinpointFactoryBuilder() throws Throwable { return (JoinpointFactoryBuilder) loadFromProperties(PropertyConfigurationConstants.JOIN_POINT_FACTORY_BUILDER_NAME, PropertyConfigurationConstants.JOIN_POINT_FACTORY_BUILDER_DEFAULT, JoinpointFactoryBuilder.class); } /** * Load an object from the specified properties * * @param propertyName the property name * @param defaultValue the default value * @param targetClass the target class * @return the object * @throws Throwable for any error */ protected Object loadFromProperties(String propertyName, String defaultValue, Class targetClass) throws Throwable { String value = properties.getProperty(propertyName, defaultValue); StringTokenizer tokenizer = new StringTokenizer(value, ":"); Class clazz = null; ClassNotFoundException error = null; while (tokenizer.hasMoreTokens()) { String className = tokenizer.nextToken(); try { clazz = getClass().getClassLoader().loadClass(className); break; } catch (ClassNotFoundException ignored) { log.trace(className + " not found: " + ignored.getMessage()); error = ignored; } } if (clazz == null && error != null) throw error; if (clazz == null) throw new RuntimeException("Invalid configuration for property " + propertyName + " expected a class name that implements " + targetClass.getName()); if (targetClass.isAssignableFrom(clazz) == false) throw new RuntimeException("Class " + clazz.getName() + " specified in property " + propertyName + " does not implement " + targetClass.getName()); return clazz.newInstance(); } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/config/spi/0000755000175000017500000000000011620314126025446 5ustar twernertwernerlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/config/spi/Configuration.java0000644000175000017500000001243610767032015031133 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.config.spi; import java.lang.reflect.Type; import org.jboss.beans.info.spi.BeanInfo; import org.jboss.beans.info.spi.BeanInfoFactory; import org.jboss.beans.info.spi.BeanAccessMode; import org.jboss.classadapter.spi.ClassAdapterFactory; import org.jboss.joinpoint.spi.JoinpointFactoryBuilder; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.reflect.spi.TypeInfoFactory; /** * Configuration.

* * Provides configuration options. * * @author Adrian Brock * @version $Revision: 70886 $ */ public interface Configuration { /** * Get the bean info * * @param className the class name * @param cl the classloader * @return the bean info * @throws ClassNotFoundException when the class could not be loaded */ BeanInfo getBeanInfo(String className, ClassLoader cl) throws ClassNotFoundException; /** * Get the bean info * * @param clazz the class * @return the bean info */ BeanInfo getBeanInfo(Class clazz); /** * Get the bean info * * @param type the type info * @return the bean info */ BeanInfo getBeanInfo(TypeInfo type); /** * Get the bean info * * @param className the class name * @param cl the classloader * @param accessMode the bean access mode * @return the bean info * @throws ClassNotFoundException when the class could not be loaded */ BeanInfo getBeanInfo(String className, ClassLoader cl, BeanAccessMode accessMode) throws ClassNotFoundException; /** * Get the bean info * * @param clazz the class * @param accessMode the bean access mode * @return the bean info */ BeanInfo getBeanInfo(Class clazz, BeanAccessMode accessMode); /** * Get the bean info * * @param type the type info * @param accessMode the bean access mode * @return the bean info */ BeanInfo getBeanInfo(TypeInfo type, BeanAccessMode accessMode); /** * Get the class info for a class * * @param className the class name * @param cl the classloader * @return the class info * @throws ClassNotFoundException when the class could not be loaded */ ClassInfo getClassInfo(String className, ClassLoader cl) throws ClassNotFoundException; /** * Get the class info for a class * * @param clazz the class * @return the class info */ ClassInfo getClassInfo(Class clazz); /** * Get the type info for a type * * @param type the type * @return the type info * @throws IllegalArgumentException for a null type */ TypeInfo getTypeInfo(Type type); /** * Get the type info for a type * * @param type the type * @return the type info * @param cl the classloader * @throws IllegalArgumentException for a null type * @throws ClassNotFoundException when the class could not be loaded */ TypeInfo getTypeInfo(String type, ClassLoader cl) throws ClassNotFoundException; /** * Get the type info factory * * @return the TypeInfoFactory */ TypeInfoFactory getTypeInfoFactory(); /** * Get the joinpoint factory builder * * @return the JoinpointFactoryBuilder */ JoinpointFactoryBuilder getJoinpointFactoryBuilder(); /** * Set the beanInfoFactory. * * @param beanInfoFactory the beanInfoFactory. * @throws SecurityException if you don't have the ConfigurationPermission */ void setBeanInfoFactory(BeanInfoFactory beanInfoFactory); /** * Set the classAdapterFactory. * * @param classAdapterFactory the classAdapterFactory. * @throws SecurityException if you don't have the ConfigurationPermission */ void setClassAdapterFactory(ClassAdapterFactory classAdapterFactory); /** * Set the typeInfoFactory. * * @param typeInfoFactory the typeInfoFactory. * @throws SecurityException if you don't have the ConfigurationPermission */ void setTypeInfoFactory(TypeInfoFactory typeInfoFactory); /** * Set the joinpointFactoryBuilder. * * @param joinpointFactoryBuilder the joinpointFactoryBuilder. * @throws SecurityException if you don't have the ConfigurationPermission */ void setJoinpointFactoryBuilder(JoinpointFactoryBuilder joinpointFactoryBuilder); } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/config/spi/ConfigurationPermission.java0000644000175000017500000001362010761555477033220 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2008, 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.config.spi; import java.io.IOException; import java.io.ObjectInputStream; import java.security.BasicPermission; import java.security.Permission; import java.security.PermissionCollection; import java.util.Enumeration; import java.util.HashSet; import java.util.Iterator; /** * This permission represents "trust" in a signer or codebase. * * It contains a target name but no actions list. The targets are * what property you can set on the Configuration or * meaning all. * * @author adrian@jboss.com * @version $Revision: 57306 $ */ public class ConfigurationPermission extends BasicPermission { /** The serialVersionUID */ private static final long serialVersionUID = 7599741180179381660L; /** Whether we have all names */ private transient boolean allNames; /** * Create a new Permission * * @param name the target * @throws IllegalArgumentException for invalid name * @throws NullPointerException for null name */ public ConfigurationPermission(String name) { this(name, null); } /** * Create a new Permission * * @param name the target * @param actions the actions * @throws IllegalArgumentException for an invalid name or target * @throws NullPointerException for null name */ public ConfigurationPermission(String name, String actions) { super(name, actions); init(name, actions); } /** * @return human readable string. */ public String toString() { StringBuffer buffer = new StringBuffer(100); buffer.append(getClass().getName()).append(":"); buffer.append(" name=").append(getName()); buffer.append(" actions=").append(getActions()); return buffer.toString(); } /** * Checks if this ConfigurationPermission object "implies" the specified * permission. More specifically, this method returns true if: * p is an instance of ConfigurationPermission, * p's target names are a subset of this object's target names * * @param p the permission * @return true when the permission is implied */ public boolean implies(Permission p) { if( (p instanceof ConfigurationPermission) == false) return false; return allNames == true; } /** * Must override to handle the configure implies access relationship. * * @return the permission collection */ public PermissionCollection newPermissionCollection() { return new ConfigurationPermissionCollection(); } private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { ois.defaultReadObject(); init(getName(), getActions()); } /** * Construct a new ConfigurationPermission for a given name * * @param name the name of the permission to grant * @param actions unused * @exception NullPointerException if the name is null * @exception IllegalArgumentException if the name is not * or one of the * allowed names or a comma-separated list of the allowed names, or if * actions is a non-null non-empty string. */ private void init(String name, String actions) { if( name == null ) throw new NullPointerException("name cannot be null"); if( actions != null && actions.length() > 0 ) throw new IllegalArgumentException("actions must be null or empty"); allNames = name.equals("*"); } /** * ConfigurationPermissionCollection. */ class ConfigurationPermissionCollection extends PermissionCollection { /** The serialVersionUID */ private static final long serialVersionUID = 3256442516797665329L; /** The permissions */ private HashSet permissions = new HashSet(); /** Whether we have all permissions */ private boolean hasAll; public void add(Permission p) { if (isReadOnly()) throw new SecurityException("Collection is read-only"); if (p instanceof ConfigurationPermission) permissions.add(p); if (p.getName().equals("configure")) permissions.add(new ConfigurationPermission("access")); else if (p.getName().equals("*")) hasAll = true; } public boolean implies(Permission p) { boolean implies = false; if (p instanceof ConfigurationPermission) { implies = hasAll; if (implies == false) implies = permissions.contains(p); } return implies; } public Enumeration elements() { final Iterator iter = permissions.iterator(); return new Enumeration() { public boolean hasMoreElements() { return iter.hasNext(); } public Permission nextElement() { return iter.next(); } }; } } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/0000755000175000017500000000000011620314125025031 5ustar twernertwernerlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/0000755000175000017500000000000011620314125026512 5ustar twernertwernerlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/AnnotationInfoImpl.java0000644000175000017500000000625710741763423033153 0ustar twernertwerner/* * 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.reflect.plugins; import java.util.HashMap; import org.jboss.reflect.spi.AnnotationAttribute; import org.jboss.reflect.spi.AnnotationInfo; /** * Annotation Info * * @author Bill Burke * @author Adrian Brock */ public class AnnotationInfoImpl extends InterfaceInfoImpl implements AnnotationInfo { /** serialVersionUID */ private static final long serialVersionUID = 3546645408219542832L; /** The attributes */ protected AnnotationAttribute[] attributes; /** Attribute Map */ protected HashMap attributeMap; /** * Create a new AnnotationInfo. */ public AnnotationInfoImpl() { } /** * Create a new AnnotationInfo. * * @param name the name * @param modifiers the modifiers */ public AnnotationInfoImpl(String name, int modifiers) { super(name, modifiers); } /** * Set the attributes * * @param attributes the attributes */ public void setAttributes(AnnotationAttributeImpl[] attributes) { this.attributes = attributes; if (attributes != null && attributes.length > 0) { this.attributes = attributes; attributeMap = new HashMap(); for (int i = 0; i < attributes.length; i++) { attributeMap.put(attributes[i].getName(), attributes[i]); } } } public boolean isAnnotation() { return true; } public int getModifiers() { return modifiers; } public AnnotationAttribute[] getAttributes() { return attributes; } public AnnotationAttribute getAttribute(String name) { if (attributeMap == null) return null; return attributeMap.get(name); } public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof AnnotationInfoImpl)) return false; final AnnotationInfoImpl annotationInfo = (AnnotationInfoImpl) o; if (!name.equals(annotationInfo.name)) return false; return true; } public int hashCode() { return name.hashCode(); } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/introspection/0000755000175000017500000000000011620314123031410 5ustar twernertwerner././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/introspection/ReflectionUtils.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/introspection/Reflection0000644000175000017500000003107711050576003033441 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.reflect.plugins.introspection; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.jboss.util.Strings; /** * ReflectionUtils. * * @author Adrian Brock * @author Ales Justin * @version $Revision: 77014 $ */ public class ReflectionUtils { /** * Invoke on a method * * @param method the method * @param target the target * @param arguments the arguments * @return the result of the invocation * @throws Throwable for any error */ public static Object invoke(Method method, Object target, Object[] arguments) throws Throwable { if (method == null) throw new IllegalArgumentException("Null method"); try { return method.invoke(target, arguments); } catch (Throwable t) { if (target != null && t instanceof IllegalArgumentException) { Class clazz = method.getDeclaringClass(); if (clazz.isInstance(target) == false) throw new IllegalArgumentException("Wrong target. " + target.getClass().getName() + " is not a " + clazz.getName()); } throw handleErrors(method.getName(), Strings.defaultToString(target), method.getParameterTypes(), arguments, t); } } /** * Create a new instance * * @param clazz the class * @return the constructed object * @throws Throwable for any error */ public static Object newInstance(Class clazz) throws Throwable { if (clazz == null) throw new IllegalArgumentException("Null clazz"); try { return clazz.newInstance(); } catch (Throwable t) { throw handleErrors("new", clazz.getName(), null, null, t); } } /** * Create a new instance * * @param className the class name * @param cl the classloader * @return the constructed object * @throws Throwable for any error */ public static Object newInstance(String className, ClassLoader cl) throws Throwable { if (className == null) throw new IllegalArgumentException("Null class name"); if (cl == null) throw new IllegalArgumentException("Null classloader"); Class clazz = Class.forName(className, false, cl); try { return clazz.newInstance(); } catch (Throwable t) { throw handleErrors("new", clazz.getName(), null, null, t); } } /** * Create a new instance * * @param className the class name * @return the constructed object * @throws Throwable for any error */ public static Object newInstance(String className) throws Throwable { ClassLoader cl = Thread.currentThread().getContextClassLoader(); return newInstance(className, cl); } /** * Create a new instance * * @param constructor the constructor * @param arguments the arguments * @return the constructed object * @throws Throwable for any error */ public static Object newInstance(Constructor constructor, Object[] arguments) throws Throwable { if (constructor == null) throw new IllegalArgumentException("Null constructor"); try { return constructor.newInstance(arguments); } catch (Throwable t) { throw handleErrors("new", constructor.getClass().getName(), constructor.getParameterTypes(), arguments, t); } } /** * Get a field * * @param field the field * @param target the target * @return null * @throws Throwable for any error */ public static Object getField(Field field, Object target) throws Throwable { if (field == null) throw new IllegalArgumentException("Null field"); try { return field.get(target); } catch (Throwable t) { throw handleErrors("get", field, target, null, t); } } /** * Set a field * * @param field the field * @param target the target * @param value the value * @return null * @throws Throwable for any error */ public static Object setField(Field field, Object target, Object value) throws Throwable { if (field == null) throw new IllegalArgumentException("Null field"); try { field.set(target, value); return null; } catch (Throwable t) { throw handleErrors("set", field, target, value, t); } } /** * Get array info. * Handle null parameter. * * @param objects the array of objects * @return info */ protected static Object arrayInfo(Object... objects) { return objects == null ? "" : Arrays.asList(objects); } /** * Find the method by name and parameters. * * @param clazz the class to look for method * @param name the name * @param parameterTypes the types * @return method or null if not found */ public static Method findMethod(Class clazz, String name, Class... parameterTypes) { if (clazz == null) return null; Method[] methods = clazz.getDeclaredMethods(); if (methods.length != 0) { for (Method method : methods) { if (method.getName().equals(name)) { Class[] methodParams = method.getParameterTypes(); if (methodParams.length != 0) { if (Arrays.equals(methodParams, parameterTypes)) return method; } else if (parameterTypes == null || parameterTypes.length == 0) return method; } } } return findMethod(clazz.getSuperclass(), name, parameterTypes); } /** * Find the method by name and parameters. * * @param clazz the class to look for method * @param name the name * @param parameterTypes the types * @return method or throw exception if not found * @throws NoSuchMethodException for no such method */ public static Method findExactMethod(Class clazz, String name, Class... parameterTypes) throws NoSuchMethodException { Method method = findMethod(clazz, name, parameterTypes); if (method == null) throw new NoSuchMethodException(clazz + "." + name + " - " + arrayInfo((Object[]) parameterTypes)); return method; } /** * Find the field by name. * * @param clazz the class to look for field * @param name the name * @return field or null if not found */ public static Field findField(Class clazz, String name) { if (clazz == null) return null; Field[] fields = clazz.getDeclaredFields(); if (fields.length != 0) { for (Field field : fields) { if (field.getName().equals(name)) return field; } } return findField(clazz.getSuperclass(), name); } /** * Find the field by name. * * @param clazz the class to look for field * @param name the name * @return field or throw exception if not found * @throws NoSuchFieldException for no such field */ public static Field findExactField(Class clazz, String name) throws NoSuchFieldException { Field field = findField(clazz, name); if (field == null) throw new NoSuchFieldException(clazz + "." + name); return field; } /** * Find the constructor by parameters. * * @param clazz the class to look for constructor * @param parameterTypes the types * @return constructor or null if not found */ public static Constructor findConstructor(Class clazz, Class... parameterTypes) { if (clazz == null) return null; Constructor[] constructors = clazz.getDeclaredConstructors(); if (constructors.length != 0) { for (Constructor constructor : constructors) { Class[] constructorParams = constructor.getParameterTypes(); if (constructorParams.length != 0) { if (Arrays.equals(constructorParams, parameterTypes)) return constructor; } else if (parameterTypes == null || parameterTypes.length == 0) return constructor; } } return findConstructor(clazz.getSuperclass(), parameterTypes); } /** * Find the constructor by parameters. * * @param clazz the class to look for constructor * @param parameterTypes the types * @return method or throw exception if not found * @throws NoSuchMethodException for no such method */ public static Constructor findExactConstructor(Class clazz, Class... parameterTypes) throws NoSuchMethodException { Constructor constructor = findConstructor(clazz, parameterTypes); if (constructor == null) throw new NoSuchMethodException(clazz + " - " + arrayInfo((Object[]) parameterTypes)); return constructor; } /** * Handle errors * * @param context the context * @param target the target * @param parameters the parameters * @param arguments the arguments * @param t the error * @return never * @throws Throwable always */ public static Throwable handleErrors(String context, Object target, Class[] parameters, Object[] arguments, Throwable t) throws Throwable { if (t instanceof IllegalArgumentException) { if (target == null) throw new IllegalArgumentException("Null target for " + context); List expected = new ArrayList(); if (parameters != null) { for (Class parameter : parameters) expected.add(parameter.getName()); } List actual = new ArrayList(); if (arguments != null) { for (Object argument : arguments) { if (argument == null) actual.add(null); else actual.add(argument.getClass().getName()); } } throw new IllegalArgumentException("Wrong arguments. " + context + " for target " + target + " expected=" + expected + " actual=" + actual); } else if (t instanceof InvocationTargetException) { throw ((InvocationTargetException) t).getTargetException(); } throw t; } /** * Handle errors * * @param context the context * @param field the field * @param target the target * @param value the value * @param t the error * @return never * @throws Throwable always */ public static Throwable handleErrors(String context, Field field, Object target, Object value, Throwable t) throws Throwable { if (t instanceof IllegalArgumentException) { Class clazz = field.getDeclaringClass(); if (clazz.isInstance(target) == false) throw new IllegalArgumentException("Wrong target. " + target.getClass().getName() + " is not a " + clazz.getName()); String valueType = null; if (value != null) valueType = value.getClass().getName(); throw new IllegalArgumentException("Error invoking field " + context + " for target " + target + " field " + field.getName() + " expected=" + field.getType().getName() + " actual=" + valueType); } throw t; } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/introspection/ReflectMethodInfoImpl.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/introspection/ReflectMet0000644000175000017500000001363511010514643033377 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.reflect.plugins.introspection; 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.security.AccessController; 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.ParameterInfo; import org.jboss.reflect.spi.TypeInfo; /** * Method info * * @author Bill Burke * @author Adrian Brock * @author Ales Justin */ public class ReflectMethodInfoImpl extends MethodInfoImpl { /** The serialVersionUID */ private static final long serialVersionUID = 2; /** The permission */ private static Permission accessCheck = new ReflectPermission("suppressAccessChecks"); /** The method */ protected transient Method method; /** * Create a new method info */ public ReflectMethodInfoImpl() { } /** * Create a new MethodInfo. * * @param annotations the annotations * @param name the method name * @param returnType the return type * @param parameterTypes the parameter types * @param parameterAnnotations the parameter annotations * @param exceptionTypes the exception types * @param modifiers the modifiers * @param declaring the declaring class */ 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); } /** * Create a new MethodInfo. * * @param annotations the annotations * @param name the method name * @param returnType the return type * @param parameters the parameters * @param exceptionTypes the exception types * @param modifiers the modifiers * @param declaring the declaring class */ public ReflectMethodInfoImpl(AnnotationValue[] annotations, String name, TypeInfo returnType, ParameterInfo[] parameters, ClassInfo[] exceptionTypes, int modifiers, ClassInfo declaring) { super(annotations, name, returnType, parameters, exceptionTypes, modifiers, declaring); } /** * Set the method * * @param method the method */ public void setMethod(Method method) { if (method != null) accessCheck(Modifier.isPublic(method.getModifiers())); this.method = method; if (isPublic() == false && method != null) setAccessible(); } /** * Get the method * * @return the method */ public Method getMethod() { accessCheck(); return method; } /** * Check access permission. */ protected final void accessCheck() // final because we don't want subclasses to disable it { accessCheck(isPublic()); } /** * Check access permission. * * @param isPublic whether the field is public */ protected final void accessCheck(final boolean isPublic) // final because we don't want subclasses to disable it { if (isPublic == false) { SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkPermission(accessCheck); } } public Object invoke(Object target, Object[] args) throws Throwable { accessCheck(); return ReflectionUtils.invoke(method, target, args); } /** * Read the object, handling method read. * * @param oistream the stream * @throws IOException io error * @throws ClassNotFoundException cnf error * @throws NoSuchMethodException no such method error */ @SuppressWarnings("deprecation") private void readObject(ObjectInputStream oistream) throws IOException, ClassNotFoundException, NoSuchMethodException { oistream.defaultReadObject(); int length = parameterTypes != null ? parameterTypes.length : 0; Class[] classes = new Class[length]; for(int i = 0; i < length; i++) classes[i] = parameterTypes[i].getType(); method = ReflectionUtils.findExactMethod(getDeclaringClass().getType(), name, classes); } /** * Set field accessible to true */ private void setAccessible() { SecurityManager sm = System.getSecurityManager(); if (sm == null) method.setAccessible(true); else AccessController.doPrivileged(new SetAccessible()); } /** * Set accessible privileged block */ private class SetAccessible implements PrivilegedAction { public Object run() { method.setAccessible(true); return null; } } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/introspection/ParameterizedArrayInfo.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/introspection/Parameteri0000644000175000017500000000365410701166063033443 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.reflect.plugins.introspection; import java.lang.reflect.ParameterizedType; import org.jboss.reflect.spi.ArrayInfo; import org.jboss.reflect.spi.TypeInfo; /** * ParameterizedArrayInfo. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ParameterizedArrayInfo extends ParameterizedClassInfo implements ArrayInfo { /** The serialVersionUID */ private static final long serialVersionUID = -2126867826240682161L; /** * Create a new ParameterizedArrayInfo. * * @param factory the factory * @param delegate the raw array info * @param parameterizedType the parameterized type */ public ParameterizedArrayInfo(IntrospectionTypeInfoFactoryImpl factory, ArrayInfo delegate, ParameterizedType parameterizedType) { super(factory, delegate, parameterizedType); } public TypeInfo getComponentType() { return delegate.getComponentType(); } } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/introspection/IntrospectionTypeInfoFactory.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/introspection/Introspect0000644000175000017500000000375010756326650033513 0ustar twernertwerner/* * 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.reflect.plugins.introspection; import java.lang.reflect.Type; import org.jboss.reflect.spi.TypeInfo; import org.jboss.reflect.spi.TypeInfoFactory; /** * An introspection type factory that uses a static delegate.

* * This avoids recalculating things everytime a factory is * constructed inside the same classloader * * @author Adrian Brock */ public class IntrospectionTypeInfoFactory implements TypeInfoFactory { /** The delegate */ protected static IntrospectionTypeInfoFactoryImpl delegate = new IntrospectionTypeInfoFactoryImpl(); static TypeInfoFactory getDelegate() { return delegate; } public TypeInfo getTypeInfo(Class clazz) { return delegate.getTypeInfo(clazz); } public TypeInfo getTypeInfo(String name, ClassLoader cl) throws ClassNotFoundException { return delegate.getTypeInfo(name, cl); } public TypeInfo getTypeInfo(Type type) { return delegate.getTypeInfo(type); } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/introspection/package.htmllibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/introspection/package.ht0000644000175000017500000000151310271236104033343 0ustar twernertwerner

Introspection based extended reflection.

Package Specification

Related Documentation

Package Status

  • ALPHA

Todo

  • ???
././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/introspection/ParameterizedClassInfo.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/introspection/Parameteri0000644000175000017500000001002411112776757033446 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.reflect.plugins.introspection; import java.lang.reflect.ParameterizedType; import org.jboss.reflect.plugins.ClassInfoImpl; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.DelegateClassInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.reflect.spi.TypeInfoFactory; import org.jboss.util.JBossStringBuilder; /** * ParameterizedClassInfo. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ParameterizedClassInfo extends DelegateClassInfo { /** The serialVersionUID */ private static final long serialVersionUID = 2; /** The factory */ protected transient IntrospectionTypeInfoFactoryImpl factory; /** The parameterized type */ transient ParameterizedType parameterizedType; /** The owner type */ private TypeInfo ownerType = ClassInfoImpl.UNKNOWN_TYPE; /** The type arguments */ private TypeInfo[] typeArguments = ClassInfoImpl.UNKNOWN_TYPES; /** The component type */ private transient TypeInfo componentType = ClassInfoImpl.UNKNOWN_TYPE; /** The key type */ private transient TypeInfo keyType = ClassInfoImpl.UNKNOWN_TYPE; /** The key type */ private transient TypeInfo valueType = ClassInfoImpl.UNKNOWN_TYPE; /** * Create a new ParameterizedClassInfo. * * @param factory the factory * @param delegate the raw array info * @param parameterizedType the parameterized type */ public ParameterizedClassInfo(IntrospectionTypeInfoFactoryImpl factory, ClassInfo delegate, ParameterizedType parameterizedType) { super(delegate); this.factory = factory; this.delegate = delegate; this.parameterizedType = parameterizedType; } public TypeInfoFactory getTypeInfoFactory() { return factory; } @Override public TypeInfo[] getActualTypeArguments() { if (typeArguments == ClassInfoImpl.UNKNOWN_TYPES) typeArguments = factory.getActualTypeArguments(this); return typeArguments; } @Override public TypeInfo getOwnerType() { if (ownerType == ClassInfoImpl.UNKNOWN_TYPE) ownerType = factory.getOwnerType(this); return ownerType; } @Override public ClassInfo getRawType() { return delegate; } @Override public TypeInfo getComponentType() { if (componentType == ClassInfoImpl.UNKNOWN_TYPE) componentType = factory.getComponentType(this); return componentType; } @Override public TypeInfo getKeyType() { if (keyType == ClassInfoImpl.UNKNOWN_TYPE) keyType = factory.getKeyType(this); return keyType; } @Override public TypeInfo getValueType() { if (valueType == ClassInfoImpl.UNKNOWN_TYPE) valueType = factory.getValueType(this); return valueType; } @Override public void toShortString(JBossStringBuilder buffer) { buffer.append(parameterizedType); } @Override protected void toString(JBossStringBuilder buffer) { buffer.append(parameterizedType); } } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/introspection/IntrospectionTypeInfoFactoryImpl.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/introspection/Introspect0000644000175000017500000005620511033635321033501 0ustar twernertwerner/* * 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.reflect.plugins.introspection; import java.lang.annotation.Annotation; import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.GenericArrayType; import java.lang.reflect.Method; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.lang.reflect.TypeVariable; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Collection; import java.util.Map; import org.jboss.reflect.plugins.AnnotationAttributeImpl; import org.jboss.reflect.plugins.AnnotationHelper; import org.jboss.reflect.plugins.AnnotationInfoImpl; import org.jboss.reflect.plugins.AnnotationValueFactory; import org.jboss.reflect.plugins.ArrayInfoImpl; import org.jboss.reflect.plugins.ClassInfoHelper; import org.jboss.reflect.plugins.ClassInfoImpl; import org.jboss.reflect.plugins.ConstructorInfoImpl; import org.jboss.reflect.plugins.EnumConstantInfoImpl; import org.jboss.reflect.plugins.EnumInfoImpl; import org.jboss.reflect.plugins.FieldInfoImpl; import org.jboss.reflect.plugins.MethodInfoImpl; import org.jboss.reflect.plugins.PackageInfoImpl; import org.jboss.reflect.spi.AnnotationInfo; import org.jboss.reflect.spi.AnnotationValue; import org.jboss.reflect.spi.ArrayInfo; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.InterfaceInfo; import org.jboss.reflect.spi.NumberInfo; import org.jboss.reflect.spi.PrimitiveInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.reflect.spi.TypeInfoFactory; import org.jboss.util.collection.WeakTypeCache; /** * An introspection type factory. * * @author Adrian Brock */ public class IntrospectionTypeInfoFactoryImpl extends WeakTypeCache implements TypeInfoFactory, AnnotationHelper, ClassInfoHelper { final static AnnotationValue[] NO_ANNOTATIONS = new AnnotationValue[0]; /** * Generate the type info for a class * * @param clazz the class * @param info the class info */ public void generateTypeInfo(Class clazz, ClassInfoImpl info) { // Everything is done lazily } @SuppressWarnings("deprecation") public ClassInfoImpl getSuperClass(ClassInfoImpl classInfo) { Class clazz = classInfo.getType(); ClassInfoImpl superType = null; if (clazz.isInterface() == false) { Class superClazz = clazz.getSuperclass(); if (superClazz != null) superType = (ClassInfoImpl) getTypeInfo(superClazz); } return superType; } @SuppressWarnings("deprecation") public ClassInfo getGenericSuperClass(ClassInfoImpl classInfo) { Class clazz = classInfo.getType(); ClassInfo superType = null; if (clazz.isInterface() == false) { Type superClazz = clazz.getGenericSuperclass(); if (superClazz != null) superType = (ClassInfo) getTypeInfo(superClazz); } return superType; } public AnnotationValue[] getAnnotations(Object obj) { Annotation[] annotations; if (obj instanceof AnnotatedElement) annotations = readAnnotations((AnnotatedElement)obj); else { throw new RuntimeException("Attempt was made to read annotations from unsupported type " + obj.getClass().getName() + ": " + obj); } if (annotations.length == 0) { return NO_ANNOTATIONS; } AnnotationValue[] annotationValues = new AnnotationValue[annotations.length]; for (int i = 0 ; i < annotations.length ; i++) { AnnotationInfo info = (AnnotationInfo)getTypeInfo(annotations[i].annotationType()); annotationValues[i] = createAnnotationValue(info, annotations[i]); } return annotationValues; } public AnnotationValue createAnnotationValue(AnnotationInfo info, Object ann) { return AnnotationValueFactory.createAnnotationValue(this, this, info, ann); } @SuppressWarnings("deprecation") public ConstructorInfoImpl[] getConstructors(ClassInfoImpl classInfo) { Class clazz = classInfo.getType(); ReflectConstructorInfoImpl[] infos = null; if (clazz.isInterface() == false) { Constructor[] constructors = getDeclaredConstructors(clazz); if (constructors != null && constructors.length > 0) { infos = new ReflectConstructorInfoImpl[constructors.length]; for (int i = 0; i < constructors.length; ++i) { AnnotationValue[] annotations = getAnnotations(constructors[i]); Type[] genericParameterTypes = constructors[i].getGenericParameterTypes(); // HACK: This is to workaround a bug in Sun's compiler related to enum constructors // having no generic parameters? Type[] parameterTypes = constructors[i].getParameterTypes(); if (genericParameterTypes.length != parameterTypes.length) genericParameterTypes = parameterTypes; 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]); } } } return infos; } @SuppressWarnings("deprecation") public FieldInfoImpl[] getFields(final ClassInfoImpl classInfo) { return AccessController.doPrivileged(new PrivilegedAction() { public FieldInfoImpl[] run() { Class clazz = classInfo.getType(); Field[] fields = getDeclaredFields(clazz); if (fields == null || fields.length == 0) return null; ReflectFieldInfoImpl[] infos = new ReflectFieldInfoImpl[fields.length]; 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()), fields[i].getModifiers(), (ClassInfo) getTypeInfo(fields[i].getDeclaringClass())); infos[i].setField(fields[i]); } return infos; } }); } @SuppressWarnings("deprecation") public MethodInfoImpl[] getMethods(final ClassInfoImpl classInfo) { return AccessController.doPrivileged(new PrivilegedAction() { public MethodInfoImpl[] run() { Class clazz = classInfo.getType(); Method[] methods = getDeclaredMethods(clazz); if (methods == null || methods.length == 0) return null; ReflectMethodInfoImpl[] infos = new ReflectMethodInfoImpl[methods.length]; 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()), methods[i].getModifiers(), (ClassInfo) getTypeInfo(methods[i].getDeclaringClass())); infos[i].setMethod(methods[i]); } return infos; } }); } @SuppressWarnings("deprecation") public InterfaceInfo[] getInterfaces(ClassInfoImpl classInfo) { Class clazz = classInfo.getType(); Class[] interfaces = clazz.getInterfaces(); if (interfaces == null || interfaces.length == 0) return null; InterfaceInfo[] infos = new InterfaceInfo[interfaces.length]; for (int i = 0; i < interfaces.length; ++i) infos[i] = (InterfaceInfo) getTypeInfo(interfaces[i]); return infos; } @SuppressWarnings("deprecation") public InterfaceInfo[] getGenericInterfaces(ClassInfoImpl classInfo) { Class clazz = classInfo.getType(); Type[] interfaces = clazz.getGenericInterfaces(); if (interfaces == null || interfaces.length == 0) return null; InterfaceInfo[] infos = new InterfaceInfo[interfaces.length]; for (int i = 0; i < interfaces.length; ++i) infos[i] = (InterfaceInfo) getTypeInfo(interfaces[i]); return infos; } @SuppressWarnings("deprecation") public PackageInfoImpl getPackage(ClassInfoImpl classInfo) { Class clazz = classInfo.getType(); Package pkg = clazz.getPackage(); if (pkg == null) return null; AnnotationValue[] annotations = getAnnotations(pkg); return new PackageInfoImpl(pkg.getName(), annotations); } /** * Get the type infos for some classes * * @param classes the classes * @return the type infos */ public TypeInfo[] getTypeInfos(Type[] classes) { if (classes == null || classes.length == 0) return null; TypeInfo[] result = new TypeInfo[classes.length]; for (int i = 0; i < classes.length; ++i) result[i] = getTypeInfo(classes[i]); return result; } /** * Get the class infos for some classes * * @param classes the classes * @return the class infos */ public ClassInfo[] getClassInfos(Type[] classes) { if (classes == null || classes.length == 0) return null; ClassInfo[] result = new ClassInfo[classes.length]; for (int i = 0; i < classes.length; ++i) result[i] = (ClassInfo) getTypeInfo(classes[i]); return result; } public TypeInfo getTypeInfo(Class clazz) { if (clazz == null) throw new IllegalArgumentException("Null class"); TypeInfo primitive = PrimitiveInfo.valueOf(clazz.getName()); if (primitive != null) return primitive; NumberInfo number = NumberInfo.valueOf(clazz.getName()); if (number != null) { synchronized (number) { // are we (since it's our synch monitor) just initializing if (number.getPhase() != NumberInfo.Phase.INITIALIZING) { if (number.getPhase() != NumberInfo.Phase.COMPLETE) { number.initializing(); number.setDelegate(get(clazz)); } return number; } } } return get(clazz); } public TypeInfo getTypeInfo(Type type) { if (type == null) throw new IllegalArgumentException("Null type"); String name = null; if (type instanceof Class) name = ((Class) type).getName(); if (name != null) { TypeInfo primitive = PrimitiveInfo.valueOf(name); if (primitive != null) return primitive; NumberInfo number = NumberInfo.valueOf(name); if (number != null) { synchronized (number) { // are we (since it's our synch monitor) just initializing if (number.getPhase() != NumberInfo.Phase.INITIALIZING) { if (number.getPhase() != NumberInfo.Phase.COMPLETE) { number.initializing(); number.setDelegate(get(type)); } return number; } } } } return get(type); } public TypeInfo getTypeInfo(String name, ClassLoader cl) throws ClassNotFoundException { if (name == null) throw new IllegalArgumentException("Null class name"); TypeInfo primitive = PrimitiveInfo.valueOf(name); if (primitive != null) return primitive; NumberInfo number = NumberInfo.valueOf(name); if (number != null) { synchronized (number) { // are we (since it's our synch monitor) just initializing if (number.getPhase() != NumberInfo.Phase.INITIALIZING) { if (number.getPhase() != NumberInfo.Phase.COMPLETE) { number.initializing(); number.setDelegate(resolveComplexTypeInfo(cl, name)); } return number; } } } return resolveComplexTypeInfo(cl, name); } /** * Get the information for an array type * * @param type the array type * @return the info */ @Override protected TypeInfo getGenericArrayType(GenericArrayType type) { Type compType = type.getGenericComponentType(); TypeInfo componentType = getTypeInfo(compType); return new ArrayInfoImpl(componentType); } /** * Resolve complex type info. * * @param cl the classloader to use * @param name the class name * @return type info from the name and classloader * @throws ClassNotFoundException for any error */ protected TypeInfo resolveComplexTypeInfo(ClassLoader cl, String name) throws ClassNotFoundException { if (cl == null) cl = Thread.currentThread().getContextClassLoader(); Class clazz = Class.forName(name, false, cl); return getTypeInfo(clazz); } protected TypeInfo instantiate(Class clazz) { ClassInfoImpl result; if (clazz.isArray()) { TypeInfo componentType = getTypeInfo(clazz.getComponentType()); result = new ArrayInfoImpl(componentType); } else if (clazz.isEnum()) { EnumInfoImpl enumInfoImpl = new EnumInfoImpl(clazz.getName(), clazz.getModifiers()); result = enumInfoImpl; Field[] fields = clazz.getFields(); EnumConstantInfoImpl[] constants = new EnumConstantInfoImpl[fields.length]; int i = 0; for (Field field : fields) { AnnotationValue[] annotations = getAnnotations(field); constants[i++] = new EnumConstantInfoImpl(field.getName(), enumInfoImpl, annotations); } enumInfoImpl.setEnumConstants(constants); } else if (clazz.isAnnotation()) { 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++) { atttributes[i] = new AnnotationAttributeImpl(methods[i].getName(), getTypeInfo(methods[i].getReturnType()), null); } ((AnnotationInfoImpl)result).setAttributes(atttributes); } else { result = new ReflectClassInfoImpl(clazz.getName()); } result.setType(clazz); result.setTypeInfoFactory(this); result.setClassInfoHelper(this); result.setAnnotationHelper(this); return result; } protected TypeInfo instantiate(ParameterizedType type) { Class rawType = (Class) type.getRawType(); ClassInfo rawTypeInfo = (ClassInfo) getTypeInfo(rawType); if (rawTypeInfo instanceof ArrayInfo) return new ParameterizedArrayInfo(this, (ArrayInfo) rawTypeInfo, type); return new ParameterizedClassInfo(this, rawTypeInfo, type); } protected void generate(Class clazz, TypeInfo result) { generateTypeInfo(clazz, (ClassInfoImpl) result); } protected void generate(ParameterizedType type, TypeInfo result) { // Everything is lazy } protected Constructor[] getDeclaredConstructors(final Class clazz) { if (System.getSecurityManager() == null) return clazz.getDeclaredConstructors(); else { PrivilegedAction[]> action = new PrivilegedAction[]>() { public Constructor[] run() { return clazz.getDeclaredConstructors(); } }; return AccessController.doPrivileged(action); } } protected Field[] getDeclaredFields(final Class clazz) { if (System.getSecurityManager() == null) return clazz.getDeclaredFields(); else { PrivilegedAction action = new PrivilegedAction() { public Field[] run() { return clazz.getDeclaredFields(); } }; return AccessController.doPrivileged(action); } } protected Method[] getDeclaredMethods(final Class clazz) { if (System.getSecurityManager() == null) return clazz.getDeclaredMethods(); else { PrivilegedAction action = new PrivilegedAction() { public Method[] run() { return clazz.getDeclaredMethods(); } }; return AccessController.doPrivileged(action); } } private Annotation[] readAnnotations(final AnnotatedElement ao) { if (System.getSecurityManager() == null) return ao.getAnnotations(); else { PrivilegedAction action = new PrivilegedAction() { public Annotation[] run() { return ao.getAnnotations(); } }; return AccessController.doPrivileged(action); } } protected AnnotationValue[][] getParameterAnnotations(Annotation[][] annotations) { AnnotationValue[][] annotationValues = new AnnotationValue[annotations.length][]; for (int param = 0 ; param < annotations.length ; param++) { annotationValues[param] = new AnnotationValue[annotations[param].length]; for (int ann = 0 ; ann < annotations[param].length ; ann++) { AnnotationInfo info = (AnnotationInfo)getTypeInfo(annotations[param][ann].annotationType()); annotationValues[param][ann] = createAnnotationValue(info, annotations[param][ann]); } } return annotationValues; } public TypeInfo[] getActualTypeArguments(ParameterizedClassInfo classInfo) { ParameterizedType type = classInfo.parameterizedType; Type[] types = type.getActualTypeArguments(); if (types == null) return null; TypeInfo[] result = new TypeInfo[types.length]; for (int i = 0; i < types.length; ++i) result[i] = getTypeInfo(types[i]); return result; } public TypeInfo getOwnerType(ParameterizedClassInfo classInfo) { ParameterizedType type = classInfo.parameterizedType; Type owner = type.getOwnerType(); if (owner == null) return null; return getTypeInfo(owner); } public TypeInfo getComponentType(ClassInfo classInfo) { if (classInfo.isCollection() == false) return null; return findActualType(classInfo, Collection.class, 0); } public TypeInfo getKeyType(ClassInfo classInfo) { if (classInfo.isMap() == false) return null; return findActualType(classInfo, Map.class, 0); } public TypeInfo getValueType(ClassInfo classInfo) { if (classInfo.isMap() == false) return null; return findActualType(classInfo, Map.class, 1); } @SuppressWarnings("deprecation") protected TypeInfo findActualType(ClassInfo classInfo, Class reference, int parameter) { Type type = classInfo.getType(); if (classInfo instanceof ParameterizedClassInfo) type = ((ParameterizedClassInfo) classInfo).parameterizedType; Type result = locateActualType(reference, parameter, classInfo.getType(), type); if (result instanceof TypeVariable) { TypeVariable typeVariable = (TypeVariable) result; result = typeVariable.getBounds()[0]; } return getTypeInfo(result); } @SuppressWarnings("unchecked") protected static Type locateActualType(Class reference, int parameter, Class clazz, Type type) { if (reference.equals(clazz)) { if (type instanceof Class) { Class typeClass = (Class) type; return typeClass.getTypeParameters()[parameter]; } else { ParameterizedType parameterized = (ParameterizedType) type; return parameterized.getActualTypeArguments()[parameter]; } } Type[] interfaces = clazz.getGenericInterfaces(); for (Type intf : interfaces) { Class interfaceClass; if (intf instanceof Class) { interfaceClass = (Class) intf; } else if (intf instanceof ParameterizedType) { ParameterizedType interfaceType = (ParameterizedType) intf; interfaceClass = (Class) interfaceType.getRawType(); } else throw new IllegalStateException("Unexpected type " + intf.getClass()); Type result = null; if (reference.isAssignableFrom(interfaceClass)) { result = locateActualType(reference, parameter, interfaceClass, intf); if (result instanceof TypeVariable) result = getParameter(clazz, type, (TypeVariable) result); } if (result != null) return result; } Class superClass = clazz.getSuperclass(); Type genericSuperClass = clazz.getGenericSuperclass(); Type result = locateActualType(reference, parameter, superClass, genericSuperClass); if (result instanceof TypeVariable) result = getParameter(clazz, type, (TypeVariable) result); return result; } private static Type getParameter(Class clazz, Type type, TypeVariable variable) { TypeVariable[] variables = clazz.getTypeParameters(); for (int i = 0; i < variables.length; ++i) { if (variables[i].getName().equals(variable.getName())) { if (type instanceof ParameterizedType) { ParameterizedType parameterized = (ParameterizedType) type; return parameterized.getActualTypeArguments()[i]; } return variable; } } // Not generic return Object.class; } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/introspection/ReflectFieldInfoImpl.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/introspection/ReflectFie0000644000175000017500000001147510770664675033404 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.reflect.plugins.introspection; import java.io.IOException; import java.io.ObjectInputStream; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.lang.reflect.ReflectPermission; import java.security.AccessController; import java.security.Permission; import java.security.PrivilegedAction; import org.jboss.reflect.plugins.FieldInfoImpl; import org.jboss.reflect.spi.AnnotationValue; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.TypeInfo; /** * A field info * * @author Ales Justin * @author Bill Burke * @author Adrian Brock */ public class ReflectFieldInfoImpl extends FieldInfoImpl { /** The serialVersionUID */ private static final long serialVersionUID = 2; /** The permission */ private static Permission accessCheck = new ReflectPermission("suppressAccessChecks"); /** The field */ protected transient Field field; /** * Create a new field info */ public ReflectFieldInfoImpl() { } /** * Create a new FieldInfo. * * @param annotations the annotations * @param name the name * @param type the field type * @param modifiers the field modifiers * @param declaring the declaring class */ public ReflectFieldInfoImpl(AnnotationValue[] annotations, String name, TypeInfo type, int modifiers, ClassInfo declaring) { super(annotations, name, type, modifiers, declaring); } /** * Set the field * * @param field the field */ public void setField(Field field) { if (field != null) accessCheck(Modifier.isPublic(field.getModifiers())); this.field = field; if (isPublic() == false && field != null) setAccessible(); } /** * Get the field * * @return the field */ public Field getField() { accessCheck(); return field; } /** * Check access permission. */ protected final void accessCheck() // final because we don't want subclasses to disable it { accessCheck(isPublic()); } /** * Check access permission. * * @param isPublic whether the field is public */ protected final void accessCheck(final boolean isPublic) // final because we don't want subclasses to disable it { if (isPublic == false) { SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkPermission(accessCheck); } } public Object get(Object target) throws Throwable { accessCheck(); return ReflectionUtils.getField(field, target); } public Object set(Object target, Object value) throws Throwable { accessCheck(); return ReflectionUtils.setField(field, target, value); } /** * Read the object, handling field read. * * @param oistream the stream * @throws IOException io error * @throws ClassNotFoundException cnf error * @throws NoSuchFieldException no such field error */ @SuppressWarnings("deprecation") private void readObject(ObjectInputStream oistream) throws IOException, ClassNotFoundException, NoSuchFieldException { oistream.defaultReadObject(); setField(ReflectionUtils.findExactField(getDeclaringClass().getType(), name)); } /** * Set field accessible to true */ private void setAccessible() { SecurityManager sm = System.getSecurityManager(); if (sm == null) field.setAccessible(true); else AccessController.doPrivileged(new SetAccessible()); } /** * Set accessible privileged block */ private class SetAccessible implements PrivilegedAction { public Object run() { field.setAccessible(true); return null; } } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/introspection/ReflectClassInfoImpl.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/introspection/ReflectCla0000644000175000017500000000472610770506700033361 0ustar twernertwerner/* * 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.reflect.plugins.introspection; import org.jboss.reflect.plugins.ClassInfoImpl; import org.jboss.reflect.spi.InterfaceInfo; import org.jboss.reflect.spi.TypeInfoFactory; /** * Class info * * @author Bill Burke * @author Adrian Brock */ public class ReflectClassInfoImpl extends ClassInfoImpl implements InterfaceInfo { /** The serialVersionUID */ private static final long serialVersionUID = 2719363625297177304L; /** * Create a new abstract ClassInfo. */ public ReflectClassInfoImpl() { } /** * Create a new class info * * @param name the class name */ public ReflectClassInfoImpl(String name) { super(name); } /** * Create a new abstract ClassInfo. * * @param name the class name * @param modifiers the class modifiers * @param interfaces the interfaces * @param superclass the super class */ public ReflectClassInfoImpl(String name, int modifiers, InterfaceInfo[] interfaces, ReflectClassInfoImpl superclass) { super(name, modifiers, interfaces, superclass); } @SuppressWarnings("deprecation") public boolean isInterface() { return getType().isInterface(); } @SuppressWarnings("deprecation") Object readResolve() { TypeInfoFactory typeInfoFactory = IntrospectionTypeInfoFactory.getDelegate(); return typeInfoFactory.getTypeInfo(getType()); } } ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/introspection/IntrospectionAnnotationHelper.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/introspection/Introspect0000644000175000017500000000371310660625117033504 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.reflect.plugins.introspection; import org.jboss.reflect.plugins.AnnotationHelper; import org.jboss.reflect.spi.AnnotationInfo; import org.jboss.reflect.spi.AnnotationValue; /** * An introspection annotation helper that uses a static delegate.

* * This avoids recalculating things everytime a helper is * constructed inside the same classloader. * * Extends IntrospectionTypeInfo to get access to delegate + * simplifies usage when TIF must also be used as AnnotationHelper. * * @author Ales Justin */ public class IntrospectionAnnotationHelper extends IntrospectionTypeInfoFactory implements AnnotationHelper { public AnnotationValue[] getAnnotations(Object object) { return delegate.getAnnotations(object); } public AnnotationValue createAnnotationValue(AnnotationInfo info, Object ann) { return delegate.createAnnotationValue(info, ann); } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/introspection/ReflectConstructorInfoImpl.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/introspection/ReflectCon0000644000175000017500000001025010770506700033366 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.reflect.plugins.introspection; import java.io.IOException; import java.io.ObjectInputStream; import java.lang.reflect.Constructor; import org.jboss.reflect.plugins.ConstructorInfoImpl; import org.jboss.reflect.spi.AnnotationValue; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.ParameterInfo; import org.jboss.reflect.spi.TypeInfo; /** * Constructor info * * @author Bill Burke * @author Adrian Brock */ public class ReflectConstructorInfoImpl extends ConstructorInfoImpl { /** The serialVersionUID */ private static final long serialVersionUID = 2; /** The constructor */ protected transient Constructor constructor; /** * Create a new ConstructorInfo. */ public ReflectConstructorInfoImpl() { } /** * Create a new ConstructorInfo. * * @param annotations the annotations * @param parameterTypes the parameter types * @param parameterAnnotations the parameter annotations * @param exceptionTypes the exception types * @param modifiers the modifiers * @param declaring the declaring class */ public ReflectConstructorInfoImpl(AnnotationValue[] annotations, TypeInfo[] parameterTypes, AnnotationValue[][] parameterAnnotations, ClassInfo[] exceptionTypes, int modifiers, ClassInfo declaring) { super(annotations, parameterTypes, parameterAnnotations, exceptionTypes, modifiers, declaring); } /** * Create a new ConstructorInfo. * * @param annotations the annotations * @param parameters the parameters * @param exceptionTypes the exception types * @param modifiers the modifiers * @param declaring the declaring class */ public ReflectConstructorInfoImpl(AnnotationValue[] annotations, ParameterInfo[] parameters, ClassInfo[] exceptionTypes, int modifiers, ClassInfo declaring) { super(annotations, parameters, exceptionTypes, modifiers, declaring); } /** * Set the constructor * * @param constructor the constructor */ public void setConstructor(Constructor constructor) { this.constructor = constructor; } /** * Get the constructor * * @return the constructor */ public Constructor getConstructor() { return constructor; } public Object newInstance(Object[] args) throws Throwable { return ReflectionUtils.newInstance(constructor, args); } /** * Read the object, handling constructor read. * * @param oistream the stream * @throws IOException io error * @throws ClassNotFoundException cnf error * @throws NoSuchMethodException no such method error */ @SuppressWarnings("deprecation") private void readObject(ObjectInputStream oistream) throws IOException, ClassNotFoundException, NoSuchMethodException { oistream.defaultReadObject(); int length = parameterTypes != null ? parameterTypes.length : 0; Class[] classes = new Class[length]; for(int i = 0; i < length; i++) classes[i] = parameterTypes[i].getType(); constructor = ReflectionUtils.findExactConstructor(getDeclaringClass().getType(), classes); } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/AnnotationValueFactory.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/AnnotationValueFactory.j0000644000175000017500000001501610756326650033346 0ustar twernertwerner/* * 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.reflect.plugins; import java.lang.annotation.Annotation; import java.util.HashMap; import org.jboss.reflect.spi.AnnotationInfo; import org.jboss.reflect.spi.AnnotationValue; import org.jboss.reflect.spi.ArrayInfo; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.EnumInfo; import org.jboss.reflect.spi.MethodInfo; import org.jboss.reflect.spi.PrimitiveInfo; import org.jboss.reflect.spi.PrimitiveValue; import org.jboss.reflect.spi.TypeInfo; import org.jboss.reflect.spi.TypeInfoFactory; import org.jboss.reflect.spi.Value; /** * * @author Kabir Khan * @version $Revision: 69888 $ */ public class AnnotationValueFactory { public static Value createValue(AnnotationHelper annotationHelper, TypeInfo type, Object value) { Value rtnValue = null; if (type instanceof ArrayInfo) { Object[] objects = getArray((ArrayInfo)type, value); Value[] values = new Value[objects.length]; for (int i = 0 ; i < objects.length ; i++) { values[i] = createValue(annotationHelper, ((ArrayInfo)type).getComponentType(), objects[i]); } rtnValue = new ArrayValueImpl(type, values); } else if (type instanceof PrimitiveInfo) { rtnValue = new PrimitiveValue(value.toString(), (PrimitiveInfo)type); } else if (type.getName().equals("java.lang.String")) { rtnValue = new StringValueImpl((String)value, type); } else if (type instanceof AnnotationInfo) { rtnValue = annotationHelper.createAnnotationValue((AnnotationInfo)type, value); } else if (type instanceof EnumInfo) { rtnValue = new EnumValueImpl(type, value.toString()); } else if (type instanceof ClassInfo) { // TODO JBMICROCONT-118 do not depend on Class rtnValue = new ClassValueImpl(((Class)value).getName(), type); } return rtnValue; } public static AnnotationValue createAnnotationValue(TypeInfoFactory typeInfoFactory, AnnotationHelper annotationHelper, AnnotationInfo info, Object ann) { Annotation annotation = (Annotation)ann; Class clazz = annotation.annotationType(); ClassInfo clazzInfo = (ClassInfo) typeInfoFactory.getTypeInfo(clazz); HashMap attributes = new HashMap(); MethodInfo[] methods = clazzInfo.getDeclaredMethods(); if (methods != null) { for (int j = 0 ; j < methods.length ; j++) { try { Object val = methods[j].invoke(annotation, null); TypeInfo typeInfo = methods[j].getReturnType(); Value value = createValue(annotationHelper, typeInfo, val); attributes.put(methods[j].getName(), value); } catch (Throwable e) { throw new RuntimeException("Error retrieving annotation attribute values", e); } } } return new AnnotationValueImpl(info, attributes, annotation); } private static Object[] getArray(ArrayInfo arrayInfo, Object value) { TypeInfo componentType = arrayInfo.getComponentType(); if (!(componentType instanceof PrimitiveInfo)) { return (Object[])value; } else { Object[] ret = null; String typeName = componentType.getName(); if (typeName.equals("boolean")) { boolean[] input = (boolean[])value; ret = new Boolean[input.length]; for (int i = 0 ; i < ret.length ; i++) { ret[i] = new Boolean(input[i]); } } else if (typeName.equals("char")) { char[] input = (char[])value; ret = new Character[input.length]; for (int i = 0 ; i < ret.length ; i++) { ret[i] = new Character(input[i]); } } else if (typeName.equals("double")) { double[] input = (double[])value; ret = new Double[input.length]; for (int i = 0 ; i < ret.length ; i++) { ret[i] = new Double(input[i]); } } else if (typeName.equals("float")) { float[] input = (float[])value; ret = new Float[input.length]; for (int i = 0 ; i < ret.length ; i++) { ret[i] = new Float(input[i]); } } else if (typeName.equals("int")) { int[] input = (int[])value; ret = new Integer[input.length]; for (int i = 0 ; i < ret.length ; i++) { ret[i] = new Integer(input[i]); } } else if (typeName.equals("long")) { long[] input = (long[])value; ret = new Long[input.length]; for (int i = 0 ; i < ret.length ; i++) { ret[i] = new Long(input[i]); } } else if (typeName.equals("short")) { short[] input = (short[])value; ret = new Short[input.length]; for (int i = 0 ; i < ret.length ; i++) { ret[i] = new Short(input[i]); } } if (ret == null) { throw new RuntimeException("Array component type " + componentType + " is not handled"); } return ret; } } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/AnnotationValueImpl.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/AnnotationValueImpl.java0000644000175000017500000001273011302615310033306 0ustar twernertwerner/* * 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.reflect.plugins; import java.lang.annotation.Annotation; import java.util.HashMap; import java.util.Map; import java.security.AccessController; import java.security.PrivilegedAction; import org.jboss.reflect.spi.AbstractValue; import org.jboss.reflect.spi.AnnotationInfo; import org.jboss.reflect.spi.AnnotationValue; import org.jboss.reflect.spi.TypeInfo; import org.jboss.reflect.spi.Value; import org.jboss.util.JBossStringBuilder; /** * An annotation value * * @author Bill Burke * @author Adrian Brock */ public class AnnotationValueImpl extends AbstractValue implements AnnotationValue { /** serialVersionUID */ private static final long serialVersionUID = 3257290210164289843L; /** The annotation type */ protected AnnotationInfo annotationType; /** The attribute values */ protected HashMap attributeValues; /** The underlying annotation */ protected Annotation underlying; /** The hash code */ protected int hash = -1; /** * Create a new Annotation value */ public AnnotationValueImpl() { } /** * Create a new Annotation value * * @param annotationType the annotation info * @param attributeValues the attribute values */ @Deprecated public AnnotationValueImpl(AnnotationInfo annotationType, HashMap attributeValues) { this(annotationType, attributeValues, null); } /** * Create a new Annotation value * * @param annotationType the annotation info * @param attributeValues the attribute values * @param underlying the underlying annotation */ public AnnotationValueImpl(AnnotationInfo annotationType, HashMap attributeValues, Annotation underlying) { if (annotationType == null) throw new IllegalArgumentException("Null annotationType"); if (attributeValues == null) throw new IllegalArgumentException("Null attribute values"); this.annotationType = annotationType; this.attributeValues = attributeValues; this.underlying = underlying; calculateHash(); } @Override public boolean isAnnotation() { return true; } public AnnotationInfo getAnnotationType() { return annotationType; } public Value getValue(String attributeName) { return attributeValues.get(attributeName); } public Map getValues() { return attributeValues; } public TypeInfo getType() { return annotationType; } public Annotation getUnderlyingAnnotation() { return underlying; } public T getUnderlyingAnnotation(Class annotationType) { return annotationType.cast(underlying); } public boolean equals(Object o) { if (this == o) return true; if (o == null || !(o instanceof AnnotationValue)) return false; final AnnotationValue annotationValue = (AnnotationValue) o; if (!annotationType.equals(annotationValue.getAnnotationType())) return false; if (!attributeValues.equals(annotationValue.getValues())) return false; final Annotation otherUnderlying = annotationValue.getUnderlyingAnnotation(); if (underlying == null && otherUnderlying != null) return false; if (underlying != null && otherUnderlying == null) return false; // Workaround for JDK bug -- should be fixed in 5 update and 6 SecurityManager sm = System.getSecurityManager(); if (sm != null) return AccessController.doPrivileged(new PrivilegedAction() { public Boolean run() { return underlying.equals(otherUnderlying); } }); else return underlying.equals(otherUnderlying); } public int hashCode() { return hash; } /** * Calculate the hashcode */ protected void calculateHash() { int result; result = (annotationType != null) ? annotationType.hashCode() : 0; result = 29 * result + attributeValues.hashCode(); hash = result; } public void toShortString(JBossStringBuilder buffer) { buffer.append(annotationType.getName()); } protected void toString(JBossStringBuilder buffer) { buffer.append("name=").append(annotationType.getName()); if (attributeValues != null && attributeValues.size() > 0) buffer.append(" values=").append(attributeValues); } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/ValueConvertor.java0000644000175000017500000001376711374537405032367 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.reflect.plugins; import java.beans.PropertyEditor; import java.beans.PropertyEditorManager; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import org.jboss.logging.Logger; import org.jboss.reflect.plugins.introspection.ReflectionUtils; import org.jboss.reflect.spi.ProgressionConvertor; import org.jboss.reflect.spi.ProgressionConvertorFactory; import org.jboss.util.StringPropertyReplacer; import org.jboss.util.propertyeditor.PropertyEditors; /** * PropertyEditorHelper. *

* TODO JBMICROCONT-118 fix the introspection assumption * * @author Adrian Brock * @version $Revision: 104938 $ */ public class ValueConvertor { /** * The log */ private static final Logger log = Logger.getLogger(ValueConvertor.class); static { try { PropertyEditors.init(); } catch (Throwable t) { log.debug("Unable to initialise property editors", t); } } /** * Convert a value *

* * @param clazz the class * @param value the value * @return the value or null if there is no editor * @throws Throwable for any error */ public static Object convertValue(Class clazz, Object value) throws Throwable { return convertValue(clazz, value, false); } /** * Convert a value * * @param clazz the class * @param value the value * @param replaceProperties whether to replace system properties * @return the value or null if there is no editor * @throws Throwable for any error */ @SuppressWarnings("unchecked") public static Object convertValue(Class clazz, Object value, boolean replaceProperties) throws Throwable { return convertValue(clazz, value, replaceProperties, false); } /** * Convert a value * * @param clazz the class * @param value the value * @param replaceProperties whether to replace system properties * @param trim whether to trim string value * @return the value or null if there is no editor * @throws Throwable for any error */ @SuppressWarnings("unchecked") public static Object convertValue(Class clazz, Object value, boolean replaceProperties, boolean trim) throws Throwable { if (clazz == null) throw new IllegalArgumentException("Null class"); if (value == null) return null; Class valueClass = value.getClass(); // If we have a string, trim and replace any system properties when requested if (valueClass == String.class) { String string = (String)value; if (trim) string = string.trim(); if (replaceProperties) value = StringPropertyReplacer.replaceProperties(string); } if (clazz.isAssignableFrom(valueClass)) return value; // First see if this is an Enum if (clazz.isEnum()) { Class eclazz = clazz.asSubclass(Enum.class); return Enum.valueOf(eclazz, value.toString()); } // Next look for a property editor if (valueClass == String.class) { PropertyEditor editor = PropertyEditorManager.findEditor(clazz); if (editor != null) { editor.setAsText((String)value); return editor.getValue(); } } // Try a static clazz.valueOf(value) try { Method method = clazz.getMethod("valueOf", valueClass); int modifiers = method.getModifiers(); if (Modifier.isPublic(modifiers) && Modifier.isStatic(modifiers) && clazz.isAssignableFrom(method.getReturnType())) return ReflectionUtils.invoke(method, null, new Object[]{value}); } catch (Exception ignored) { } // TODO JBMICROCONT-132 improve (String) might not be relevent? if (valueClass == String.class) { try { Constructor constructor = clazz.getConstructor(valueClass); if (Modifier.isPublic(constructor.getModifiers())) return ReflectionUtils.newInstance(constructor, new Object[]{value}); } catch (Exception ignored) { } } return value; } /** * Progress a value *

* * @param clazz the class * @param value the value * @return the progressed value or null if unsupported * @throws Throwable for any error */ public static Object progressValue(Class clazz, Object value) throws Throwable { if (value != null) { ProgressionConvertor convertor = ProgressionConvertorFactory.getInstance().getConvertor(); if (convertor.canProgress(clazz, value.getClass())) { return convertor.doProgression(clazz, value); } else { return null; } } return value; } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/InheritableAnnotationHolder.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/InheritableAnnotationHol0000644000175000017500000001427710645410013033373 0ustar twernertwerner/* * 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.reflect.plugins; import java.lang.annotation.Inherited; import java.util.Collections; import java.util.HashMap; import java.util.Map; import org.jboss.reflect.spi.AnnotationValue; /** * An annotation holder * * @author Bill Burke * @author Adrian Brock */ public abstract class InheritableAnnotationHolder extends AbstractAnnotatedInfo { /** serialVersionUID */ private static final long serialVersionUID = 3257290210164289843L; /** The classname of the @Inherited annotation, this needs retroing to work on JDK 1.4 */ private static final String INHERITED_NAME = Inherited.class.getName();//This /** Unknown annotations map */ static final Map UNKNOWN_ANNOTATIONS_MAP = Collections.unmodifiableMap(new HashMap()); /** Unknown annotations */ static final AnnotationValue[] UNKNOWN_ANNOTATIONS = new AnnotationValue[0]; /** Declared annotations Map */ protected Map declaredAnnotations = UNKNOWN_ANNOTATIONS_MAP; /** All annotations Map */ protected Map allAnnotations = UNKNOWN_ANNOTATIONS_MAP; /** All annotations */ protected AnnotationValue[] allAnnotationsArray = UNKNOWN_ANNOTATIONS; /** Declared annotations */ protected AnnotationValue[] declaredAnnotationsArray = UNKNOWN_ANNOTATIONS; /** The annotated element */ protected Object annotatedElement; /** The annotation helper */ protected transient AnnotationHelper annotationHelper; /** * Create a new InheritableAnnotationHolder. */ public InheritableAnnotationHolder() { } public void setAnnotatedElement(Object annotatedElement) { this.annotatedElement = annotatedElement; } public void setAnnotationHelper(AnnotationHelper annotationHelper) { this.annotationHelper = annotationHelper; } /** * Get the declared annotations * * @return the declared annotations */ public AnnotationValue[] getDeclaredAnnotations() { if (declaredAnnotationsArray == UNKNOWN_ANNOTATIONS) setupAnnotations(annotationHelper.getAnnotations(annotatedElement)); return declaredAnnotationsArray; } public AnnotationValue[] getAnnotations() { if (allAnnotationsArray == UNKNOWN_ANNOTATIONS) setupAnnotations(annotationHelper.getAnnotations(annotatedElement)); return allAnnotationsArray; } public AnnotationValue getAnnotation(String name) { if (allAnnotations == UNKNOWN_ANNOTATIONS_MAP) setupAnnotations(annotationHelper.getAnnotations(annotatedElement)); return allAnnotations.get(name); } public boolean isAnnotationPresent(String name) { if (allAnnotations == UNKNOWN_ANNOTATIONS_MAP) setupAnnotations(annotationHelper.getAnnotations(annotatedElement)); return allAnnotations.containsKey(name); } /** * Set up the annotations * * @param annotations the annotations */ public void setupAnnotations(AnnotationValue[] annotations) { InheritableAnnotationHolder superHolder = getSuperHolder(); AnnotationValue[] superAllAnnotations = (superHolder != null) ? superHolder.getAnnotations() : null; if (annotations != null && annotations.length > 0) { declaredAnnotations = new HashMap(); declaredAnnotationsArray = annotations; for (int i = 0; i < annotations.length; i++) declaredAnnotations.put(annotations[i].getAnnotationType().getName(), annotations[i]); allAnnotations = new HashMap(); if (superHolder != null && superAllAnnotations != null && superAllAnnotations.length != 0) { for (int i = 0; i < superAllAnnotations.length; i++) { AnnotationValue av = superAllAnnotations[i]; if (av.getAnnotationType().isAnnotationPresent(INHERITED_NAME)) { allAnnotations.put(av.getAnnotationType().getName(), av); } } } else allAnnotationsArray = declaredAnnotationsArray; for (int i = 0; i < annotations.length; i++) allAnnotations.put(annotations[i].getAnnotationType().getName(), annotations[i]); allAnnotationsArray = allAnnotations.values().toArray(new AnnotationValue[allAnnotations.size()]); } else { if (superHolder != null) { allAnnotations = superHolder.getAllAnnotations(); allAnnotationsArray = superAllAnnotations; } } } /** * Get all the annotations as a map * * @return the map */ protected Map getAllAnnotations() { if (allAnnotations == UNKNOWN_ANNOTATIONS_MAP) setupAnnotations(annotationHelper.getAnnotations(annotatedElement)); return allAnnotations; } /** * Get the super holder of annoations * * @return the super holder */ protected abstract InheritableAnnotationHolder getSuperHolder(); } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/ParameterInfoImpl.java0000644000175000017500000000473610332003260032737 0ustar twernertwerner/* * 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.reflect.plugins; import org.jboss.reflect.spi.AnnotationValue; import org.jboss.reflect.spi.ParameterInfo; import org.jboss.reflect.spi.TypeInfo; /** * Parameter info * * @author Adrian Brock */ public class ParameterInfoImpl extends AnnotationHolder implements ParameterInfo { /** serialVersionUID */ private static final long serialVersionUID = 3256725082746664754L; /** The parameter name */ protected String name; /** The parameter type */ protected TypeInfo parameterType; /** * Create a new method info */ public ParameterInfoImpl() { } /** * Create a new MethodInfo. * * @param annotations the annotations * @param name the method name * @param parameterType the parameter type */ public ParameterInfoImpl(AnnotationValue[] annotations, String name, TypeInfo parameterType) { super(annotations); this.name = name; this.parameterType = parameterType; } public String getName() { return name; } public TypeInfo getParameterType() { return parameterType; } public boolean equals(Object obj) { if (this == obj) return true; if (obj == null || obj instanceof ParameterInfo == false) return false; ParameterInfo other = (ParameterInfo) obj; return parameterType.equals(other.getParameterType()); } public int hashCode() { return parameterType.hashCode(); } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/AnnotationAttributeImpl.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/AnnotationAttributeImpl.0000644000175000017500000000611310332003260033326 0ustar twernertwerner/* * 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.reflect.plugins; import java.io.Serializable; import org.jboss.reflect.spi.AnnotationAttribute; import org.jboss.reflect.spi.TypeInfo; import org.jboss.reflect.spi.Value; import org.jboss.util.JBossObject; /** * An annotation attribute * * @author Bill Burke * @author Adrian Brock */ public class AnnotationAttributeImpl extends JBossObject implements AnnotationAttribute, Serializable { /** serialVersionUID */ private static final long serialVersionUID = 3546645408219542832L; /** The name */ protected String name; /** The attribute type */ protected TypeInfo type; /** The default value */ protected Value defaultValue; /** The hash code */ protected int hash = -1; /** * Create a new annotation attribute */ public AnnotationAttributeImpl() { } /** * Create a new AnnotationAttribute. * * @param name the annotation name * @param type the attribute type * @param defaultValue the default value */ public AnnotationAttributeImpl(String name, TypeInfo type, Value defaultValue) { this.name = name; this.type = type; this.defaultValue = defaultValue; calcHashCode(); } public String getName() { return name; } public TypeInfo getType() { return type; } public Value getDefaultValue() { return defaultValue; } public boolean equals(Object obj) { if (this == obj) return true; if (obj == null || obj instanceof AnnotationAttributeImpl == false) return false; final AnnotationAttributeImpl other = (AnnotationAttributeImpl) obj; if (!name.equals(other.name)) return false; if (!type.equals(other.type)) return false; return true; } public int hashCode() { return hash; } /** * Calculate the hash code */ protected void calcHashCode() { int result; result = name.hashCode(); result = 29 * result + type.hashCode(); hash = result; } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/EnumValueImpl.java0000644000175000017500000000545310560156111032110 0ustar twernertwerner/* * 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.reflect.plugins; import org.jboss.reflect.spi.AbstractValue; import org.jboss.reflect.spi.EnumValue; import org.jboss.reflect.spi.TypeInfo; /** * An enumeration value * * @author Bill Burke * @author Adrian Brock */ public class EnumValueImpl extends AbstractValue implements EnumValue { /** serialVersionUID */ private static final long serialVersionUID = 4120848858889662517L; /** The type */ protected TypeInfo type; /** The value */ protected String value; /** The hash code */ protected int hash = -1; /** * Create a new EnumValue. */ public EnumValueImpl() { } /** * Create a new EnumValue. * * @param type the type * @param value the value */ public EnumValueImpl(TypeInfo type, String value) { this.type = type; this.value = value; calculateHash(); } @Override public boolean isEnum() { return true; } public String getValue() { return value; } public TypeInfo getType() { return type; } public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof EnumValueImpl)) return false; final EnumValueImpl enumValue = (EnumValueImpl) o; if (type != null ? !type.equals(enumValue.type) : enumValue.type != null) return false; if (value != null ? !value.equals(enumValue.value) : enumValue.value != null) return false; return true; } public int hashCode() { return hash; } /** * Calculate the hash code */ protected void calculateHash() { int result; result = (type != null ? type.hashCode() : 0); result = 29 * result + (value != null ? value.hashCode() : 0); hash = result; } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/ArrayValueImpl.java0000644000175000017500000000527310560156111032262 0ustar twernertwerner/* * 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.reflect.plugins; import java.util.Arrays; import org.jboss.reflect.spi.AbstractValue; import org.jboss.reflect.spi.ArrayValue; import org.jboss.reflect.spi.TypeInfo; import org.jboss.reflect.spi.Value; /** * Annotation value * * @author Bill Burke * @author Adrian Brock */ public class ArrayValueImpl extends AbstractValue implements ArrayValue { /** serialVersionUID */ private static final long serialVersionUID = 3979266949899367475L; /** The type */ protected TypeInfo type; /** The values */ protected Value[] values; /** The hash code */ protected int hash = -1; /** * Create a new ArrayValue */ public ArrayValueImpl() { } /** * Create a new ArrayValue * * @param type the type * @param values the values */ public ArrayValueImpl(TypeInfo type, Value[] values) { this.type = type; this.values = values; calculateHash(); } @Override public boolean isArray() { return true; } public Value[] getValues() { return values; } public TypeInfo getType() { return type; } public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof ArrayValueImpl)) return false; final ArrayValueImpl arrayValue = (ArrayValueImpl) o; if (!type.equals(arrayValue.type)) return false; if (!Arrays.equals(values, arrayValue.values)) return false; return true; } public int hashCode() { return hash; } /** * Calculate the hash code */ protected void calculateHash() { hash = Arrays.hashCode(values); } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/InterfaceInfoImpl.java0000644000175000017500000000434310560404111032714 0ustar twernertwerner/* * 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.reflect.plugins; import org.jboss.reflect.spi.InterfaceInfo; /** * Interface info * * @author Bill Burke * @author Adrian Brock */ public class InterfaceInfoImpl extends ClassInfoImpl implements InterfaceInfo { /** serialVersionUID */ private static final long serialVersionUID = 3258690987944522291L; /** * Create a new interface info */ public InterfaceInfoImpl() { } /** * Create a new interface info * * @param name the interface name */ public InterfaceInfoImpl(String name) { super(name); } /** * Create a new InterfaceInfo. * * @param name the interface name * @param modifiers the interface modifier */ public InterfaceInfoImpl(String name, int modifiers) { super(name, modifiers); } /** * Create a new InterfaceInfo. * * @param name the interface name * @param modifiers the interface modifier * @param interfaces the interfaces */ public InterfaceInfoImpl(String name, int modifiers, InterfaceInfo[] interfaces) { super(name, modifiers, interfaces, null); } public boolean isInterface() { return true; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/EnumConstantInfoImpl.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/EnumConstantInfoImpl.jav0000644000175000017500000000664510560664062033315 0ustar twernertwerner/* * 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.reflect.plugins; import org.jboss.reflect.spi.AnnotationValue; import org.jboss.reflect.spi.EnumConstantInfo; import org.jboss.reflect.spi.EnumInfo; import org.jboss.util.JBossStringBuilder; /** * An enumeration constant * * @author Bill Burke * @author Adrian Brock */ public class EnumConstantInfoImpl extends AnnotationHolder implements EnumConstantInfo { /** serialVersionUID */ private static final long serialVersionUID = 3761411923568243761L; /** The constant name */ protected String name; /** The enumeration */ protected EnumInfo declaring; /** The hash code */ protected int hash = -1; /** * Create a new constant */ public EnumConstantInfoImpl() { } /** * Create a new constant * * @param name the name * @param declaring the enumeration */ public EnumConstantInfoImpl(String name, EnumInfo declaring) { this.name = name; this.declaring = declaring; } /** * Create a new constant * * @param name the name * @param declaring the enumeration * @param annotations the annotations */ public EnumConstantInfoImpl(String name, EnumInfo declaring, AnnotationValue[] annotations) { super(annotations); this.name = name; this.declaring = declaring; } public String getName() { return name; } public EnumInfo getDeclaring() { return declaring; } public Object getValue() { return declaring.getEnumValue(getName()); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || !(o instanceof EnumConstantInfo)) return false; final EnumConstantInfo enumConstantInfo = (EnumConstantInfo) o; if (name.equals(enumConstantInfo.getName()) == false) return false; if (!declaring.equals(enumConstantInfo.getDeclaring())) return false; return true; } @Override public int getHashCode() { int result = name.hashCode(); result = 29 * result + declaring.hashCode(); return result; } @Override public void toShortString(JBossStringBuilder buffer) { buffer.append(name); } @Override protected void toString(JBossStringBuilder buffer) { buffer.append("name=").append(name); buffer.append(" declaring=").append(declaring); } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/PackageInfoImpl.java0000644000175000017500000000537210560664062032367 0ustar twernertwerner/* * 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.reflect.plugins; import org.jboss.reflect.spi.AnnotationValue; import org.jboss.reflect.spi.PackageInfo; import org.jboss.util.JBossStringBuilder; /** * Class info * * TODO JBMICROCONT-118 fix the introspection assumption * @author Bill Burke * @author Adrian Brock */ public class PackageInfoImpl extends AnnotationHolder implements PackageInfo { /** serialVersionUID */ private static final long serialVersionUID = 3545798779904340792L; /** The package name */ protected String name; /** * Create a new abstract PackageInfo. */ public PackageInfoImpl() { } /** * Create a new package info * * @param name the package name */ public PackageInfoImpl(String name) { this.name = name; } /** * Create a new package info * * @param name the package name * @param annotations the annotations */ public PackageInfoImpl(String name, AnnotationValue[] annotations) { super(annotations); this.name = name; } public String getName() { return name; } @Override protected void toString(JBossStringBuilder buffer) { buffer.append("name=").append(getName()); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null || obj instanceof PackageInfo == false) return false; final PackageInfo other = (PackageInfo) obj; String name = getName(); if (name != null ? name.equals(other.getName()) == false : other.getName() != null) return false; return true; } @Override public int hashCode() { return (name != null ? name.hashCode() : 0); } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/StringValueImpl.java0000644000175000017500000000505310560156111032446 0ustar twernertwerner/* * 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.reflect.plugins; import org.jboss.reflect.spi.AbstractValue; import org.jboss.reflect.spi.StringValue; import org.jboss.reflect.spi.TypeInfo; /** * A string value * * @author Bill Burke * @author Adrian Brock */ public class StringValueImpl extends AbstractValue implements StringValue { /** serialVersionUID */ private static final long serialVersionUID = 3977862864859836468L; /** The value */ protected String value; /** The type */ protected TypeInfo type; /** * Create a new string value */ public StringValueImpl() { } /** * Create a new string value * * @param value the value * @param type the type */ public StringValueImpl(String value, TypeInfo type) { this.value = value; this.type = type; } @Override public boolean isString() { return true; } public String getValue() { return value; } public TypeInfo getType() { return type; } public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof StringValueImpl)) return false; final StringValueImpl primitiveValue = (StringValueImpl) o; if (!type.equals(primitiveValue.type)) return false; if (!value.equals(primitiveValue.value)) return false; return true; } public int hashCode() { int result; result = (value != null) ? value.hashCode() : 0; result = 29 * result + type.hashCode(); return result; } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/0000755000175000017500000000000011620314125030521 5ustar twernertwerner././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistConstructorInfo.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistConst0000644000175000017500000001405010711405721033425 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.reflect.plugins.javassist; import java.lang.reflect.Modifier; import java.util.Arrays; import javassist.CtClass; import javassist.CtConstructor; import javassist.NotFoundException; import org.jboss.reflect.plugins.AnnotationHelper; import org.jboss.reflect.spi.AnnotationValue; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.ConstructorInfo; import org.jboss.reflect.spi.ParameterInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.util.JBossStringBuilder; /** * JavassistConstructor. * * @author Adrian Brock * @version $Revision: 66537 $ */ public class JavassistConstructorInfo extends JavassistAnnotatedParameterInfo implements ConstructorInfo { /** The serialVersionUID */ private static final long serialVersionUID = -2255405601790592604L; /** The reflection factory */ private static final JavassistReflectionFactory reflectionFactory = new JavassistReflectionFactory(true); /** The constructor */ private CtConstructor ctConstructor; /** The constructor implementation */ private transient JavassistConstructor constructor; /** * Create a new JavassistConstructor. * * @param annotationHelper the annotation helper * @param typeInfo the type ifo * @param ctConstructor the constructor */ public JavassistConstructorInfo(AnnotationHelper annotationHelper, JavassistTypeInfo typeInfo, CtConstructor ctConstructor) { super(annotationHelper); this.typeInfo = typeInfo; this.ctConstructor = ctConstructor; } public int getModifiers() { return ctConstructor.getModifiers(); } public boolean isPublic() { return Modifier.isPublic(getModifiers()); } public boolean isStatic() { return Modifier.isStatic(getModifiers()); } public boolean isVolatile() { return Modifier.isVolatile(getModifiers()); } public ClassInfo getDeclaringClass() { return typeInfo; } public ClassInfo[] getExceptionTypes() { if (exceptionTypes == null) { try { CtClass[] types = ctConstructor.getExceptionTypes(); exceptionTypes = new ClassInfo[types.length]; for (int i = 0; i < types.length; ++i) exceptionTypes[i] = (ClassInfo) typeInfo.getFactory().getTypeInfo(types[i]); } catch (NotFoundException e) { throw JavassistTypeInfoFactoryImpl.raiseClassNotFound("for exception types of constructor", e); } } return exceptionTypes; } public ParameterInfo[] getParameters() { if (parameters == null) generateParameters(); return parameters; } public TypeInfo[] getParameterTypes() { if (parameterTypes == null) generateParameters(); return parameterTypes; } public Object newInstance(Object[] args) throws Throwable { if (constructor == null) constructor = reflectionFactory.createConstructor(ctConstructor); return constructor.newInstance(args); } protected int getHashCode() { int result = getDeclaringClass().hashCode(); generateParameters(); if (parameterTypes != null) { for (int i = 0; i < parameterTypes.length; i++) result = 29 * result + parameterTypes[i].hashCode(); } return result; } public boolean equals(Object obj) { if (this == obj) return true; if (obj == null || obj instanceof ConstructorInfo == false) return false; final ConstructorInfo other = (ConstructorInfo) obj; if (getDeclaringClass().equals(other.getDeclaringClass()) == false) return false; return (Arrays.equals(getParameterTypes(), other.getParameterTypes())); } protected void toString(JBossStringBuilder buffer) { buffer.append(Arrays.asList(getParameterTypes())); super.toString(buffer); } /** * Generate parameters */ protected void generateParameters() { try { CtClass[] types = ctConstructor.getParameterTypes(); parameterTypes = new TypeInfo[types.length]; for (int i = 0; i < types.length; ++i) parameterTypes[i] = typeInfo.getFactory().getTypeInfo(types[i]); parameters = new ParameterInfo[types.length]; for (int i = 0; i < types.length; ++i) parameters[i] = new JavassistParameterInfo(annotationHelper, this, i, parameterTypes[i]); } catch (NotFoundException e) { throw JavassistTypeInfoFactoryImpl.raiseClassNotFound("for parameters of constructor", e); } } public AnnotationValue[] getAnnotations() { return getAnnotations(ctConstructor); } protected void createParameterAnnotations() { try { Object[][] parameterAnnotations = ctConstructor.getParameterAnnotations(); super.setupParameterAnnotations(parameterAnnotations); } catch (ClassNotFoundException e) { // AutoGenerated throw new RuntimeException(e); } } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeInfo.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeI0000644000175000017500000004436211112776757033422 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.reflect.plugins.javassist; import java.lang.reflect.Array; import java.lang.reflect.Modifier; import java.util.Collection; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import javassist.CtClass; import javassist.CtConstructor; import javassist.CtField; import javassist.CtMethod; import javassist.NotFoundException; import org.jboss.reflect.plugins.PackageInfoImpl; import org.jboss.reflect.plugins.TypeInfoAttachments; import org.jboss.reflect.plugins.ValueConvertor; 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.InterfaceInfo; import org.jboss.reflect.spi.MethodInfo; import org.jboss.reflect.spi.PackageInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.reflect.spi.TypeInfoFactory; import org.jboss.util.JBossStringBuilder; /** * JavassistTypeInfo. * * @author Adrian Brock * @version $Revision: 81545 $ */ public class JavassistTypeInfo extends JavassistInheritableAnnotationHolder implements ClassInfo, InterfaceInfo { /** The serialVersionUID */ private static final long serialVersionUID = -5072033691434335775L; /** The factory */ private JavassistTypeInfoFactoryImpl factory; /** The name */ private String name; /** The class */ private Class clazz; /** The constructors */ private Map constructors = new ConcurrentHashMap(); /** The constructors */ private ConstructorInfo[] constructorArray; /** The fields */ private Map fields = new ConcurrentHashMap(); /** The fields */ private FieldInfo[] fieldArray; /** The methods */ private Map methods = new ConcurrentHashMap(); /** The methods */ private MethodInfo[] methodArray; /** The package info */ private PackageInfo packageInfo; /** The attachments */ private transient TypeInfoAttachments attachments; /** * Create a new JavassistTypeInfo. * * @param factory the factory * @param ctClass the ctClass * @param clazz the class */ JavassistTypeInfo(JavassistTypeInfoFactoryImpl factory, CtClass ctClass, Class clazz) { this(factory, ctClass.getName(), ctClass, clazz); } /** * Create a new JavassistTypeInfo. * * @param factory the factory * @param ctClass the ctClass * @param clazz the class * @param name the name */ JavassistTypeInfo(JavassistTypeInfoFactoryImpl factory, String name, CtClass ctClass, Class clazz) { super(ctClass, factory); this.factory = factory; this.clazz = clazz; this.name = name; } public String getName() { return name; } public boolean isInterface() { return ctClass.isInterface(); } public String getSimpleName() { return getType().getSimpleName(); } public int getModifiers() { return ctClass.getModifiers(); } public boolean isPublic() { return Modifier.isPublic(getModifiers()); } public boolean isStatic() { return Modifier.isStatic(getModifiers()); } public boolean isVolatile() { return Modifier.isVolatile(getModifiers()); } @Deprecated public Class getType() { return clazz; } public ClassInfo getSuperclass() { if (isInterface()) return null; try { CtClass superclass = ctClass.getSuperclass(); if (superclass == null) return null; return (ClassInfo) factory.getTypeInfo(superclass); } catch (NotFoundException e) { throw JavassistTypeInfoFactoryImpl.raiseClassNotFound(clazz.getSuperclass().getName(), e); } } public ClassInfo getGenericSuperclass() { // TODO JBMICROCONT-129 getGenericSuperclass throw new org.jboss.util.NotImplementedException("getGenericSuperclass"); } public InterfaceInfo[] getInterfaces() { try { CtClass[] interfaces = ctClass.getInterfaces(); if (interfaces == null || interfaces.length == 0) return null; InterfaceInfo[] result = new InterfaceInfo[interfaces.length]; for (int i = 0; i < result.length; ++i) result[i] = (InterfaceInfo) factory.getTypeInfo(interfaces[i]); return result; } catch (NotFoundException e) { throw JavassistTypeInfoFactoryImpl.raiseClassNotFound("for interfaces of " + getName(), e); } } public InterfaceInfo[] getGenericInterfaces() { // TODO JBMICROCONT-129 getGenericInterfaces throw new org.jboss.util.NotImplementedException("getGenericInterfaces"); } public ConstructorInfo[] getDeclaredConstructors() { if (constructorArray == null) { CtConstructor[] declaredConstructors = ctClass.getDeclaredConstructors(); if (declaredConstructors == null || declaredConstructors.length == 0) constructorArray = new ConstructorInfo[0]; else { synchronized (constructors) { for (int i = 0; i < declaredConstructors.length; ++i) generateConstructorInfo(declaredConstructors[i]); Collection constructorCollection = constructors.values(); constructorArray = constructorCollection.toArray(new ConstructorInfo[constructorCollection.size()]); } } } return constructorArray; } public ConstructorInfo getDeclaredConstructor(TypeInfo[] parameters) { SignatureKey key = new SignatureKey(null, parameters); synchronized (constructors) { ConstructorInfo constructor = constructors.get(key); if (constructor != null) return constructor; } if (constructorArray != null) return null; return generateConstructorInfo(key); } public FieldInfo getDeclaredField(String name) { synchronized (fields) { FieldInfo field = fields.get(name); if (field != null) return field; } if (fieldArray != null) return null; try { CtField field = ctClass.getDeclaredField(name); if (field == null) return null; return generateFieldInfo(field); } catch (NotFoundException e) { return null; } } public FieldInfo[] getDeclaredFields() { if (fieldArray == null) { CtField[] declaredFields = ctClass.getDeclaredFields(); if (declaredFields == null || declaredFields.length == 0) fieldArray = new FieldInfo[0]; else { synchronized (fields) { for (int i = 0; i < declaredFields.length; ++i) generateFieldInfo(declaredFields[i]); Collection fieldCollection = fields.values(); fieldArray = fieldCollection.toArray(new FieldInfo[fieldCollection.size()]); } } } return fieldArray; } public MethodInfo getDeclaredMethod(String name, TypeInfo[] parameters) { SignatureKey key = new SignatureKey(name, parameters); synchronized (methods) { MethodInfo method = methods.get(key); if (method != null) return method; } if (methodArray != null) return null; return generateMethodInfo(key); } public MethodInfo[] getDeclaredMethods() { if (methodArray == null) { CtMethod[] declaredMethods = ctClass.getDeclaredMethods(); if (declaredMethods == null || declaredMethods.length == 0) methodArray = new MethodInfo[0]; else { synchronized (methods) { for (int i = 0; i < declaredMethods.length; ++i) generateMethodInfo(declaredMethods[i]); Collection methodCollection = methods.values(); methodArray = methodCollection.toArray(new MethodInfo[methodCollection.size()]); } } } return methodArray; } public boolean isArray() { return getType().isArray(); } public boolean isCollection() { return Collection.class.isAssignableFrom(getType()); } public boolean isMap() { return Map.class.isAssignableFrom(getType()); } public boolean isAnnotation() { return getType().isAnnotation(); } public boolean isEnum() { return getType().isEnum(); } public boolean isPrimitive() { return getType().isPrimitive(); } /** * Get an array class * * @param clazz the class * @return the array class */ public static Class getArrayClass(Class clazz) { return Array.newInstance(clazz, 0).getClass(); } public TypeInfo getArrayType() { Class arrayClass = getArrayClass(getType()); return factory.getTypeInfo(arrayClass); } @SuppressWarnings("deprecation") public Object newArrayInstance(int size) throws Throwable { if (isArray() == false) throw new ClassCastException(this + " is not an array."); return Array.newInstance(getComponentType().getType(), size); } @SuppressWarnings("deprecation") public boolean isAssignableFrom(TypeInfo info) { if (info == null) throw new NullPointerException("Parameter info cannot be null!"); return getType().isAssignableFrom(info.getType()); } @SuppressWarnings("deprecation") public boolean isInstance(Object object) { return getType().isInstance(object); } public TypeInfoFactory getTypeInfoFactory() { return factory; } public Object convertValue(Object value) throws Throwable { return ValueConvertor.convertValue(getType(), value); } public Object convertValue(Object value, boolean replaceProperties) throws Throwable { return ValueConvertor.convertValue(getType(), value, replaceProperties); } public Object convertValue(Object value, boolean replaceProperties, boolean trim) throws Throwable { return ValueConvertor.convertValue(getType(), value, replaceProperties, trim); } protected int getHashCode() { return getName().hashCode(); } public boolean equals(Object obj) { if (obj == this) return true; if (obj == null || obj instanceof TypeInfo == false) return false; TypeInfo other = (TypeInfo) obj; return getName().equals(other.getName()); } public void toShortString(JBossStringBuilder buffer) { buffer.append(getName()); } protected void toString(JBossStringBuilder buffer) { buffer.append("name=").append(getName()); super.toString(buffer); } /** * Get the factory * * @return the factory */ protected JavassistTypeInfoFactoryImpl getFactory() { return factory; } /** * Generate constructor info * * @param constructor the constructor * @return the constructor info */ protected ConstructorInfo generateConstructorInfo(CtConstructor constructor) { try { CtClass[] parameterTypes = constructor.getParameterTypes(); String[] params = new String[parameterTypes.length]; for (int i = 0; i < params.length; ++i) params[i] = parameterTypes[i].getName(); SignatureKey key = new SignatureKey(null, params); JavassistConstructorInfo info = new JavassistConstructorInfo(factory, this, constructor); synchronized (constructors) { constructors.put(key, info); } return info; } catch (NotFoundException e) { throw JavassistTypeInfoFactoryImpl.raiseClassNotFound("for constructor of " + getName(), e); } } /** * Generate constructor info * * @param key the key * @return the constructor info */ protected ConstructorInfo generateConstructorInfo(SignatureKey key) { CtClass[] params = getParameterTypes(key); try { CtConstructor ctConstructor = ctClass.getDeclaredConstructor(params); return generateConstructorInfo(ctConstructor); } catch (NotFoundException e) { throw JavassistTypeInfoFactoryImpl.raiseMethodNotFound("for constructor " + getName(), e); } } /** * Generate field info * * @param field the field * @return the field info */ protected FieldInfo generateFieldInfo(CtField field) { JavassistFieldInfo info = new JavassistFieldInfo(factory, this, field); synchronized (fields) { fields.put(field.getName(), info); } return info; } /** * Generate method info * * @param key the key * @return the method info */ protected MethodInfo generateMethodInfo(SignatureKey key) { CtClass[] params = getParameterTypes(key); try { CtMethod ctMethod = ctClass.getDeclaredMethod(key.name, params); return generateMethodInfo(key, ctMethod); } catch (NotFoundException e) { throw JavassistTypeInfoFactoryImpl.raiseMethodNotFound("for method " + key.name, e); } } /** * Generate method info * * @param method the method * @return the method info */ protected MethodInfo generateMethodInfo(CtMethod method) { try { CtClass[] parameterTypes = method.getParameterTypes(); String[] params = new String[parameterTypes.length]; for (int i = 0; i < params.length; ++i) params[i] = parameterTypes[i].getName(); SignatureKey key = new SignatureKey(method.getName(), params); return generateMethodInfo(key, method); } catch (NotFoundException e) { throw JavassistTypeInfoFactoryImpl.raiseClassNotFound("for method " + method.getName(), e); } } /** * Generate method info * * @param key the key * @param method the method * @return the method info */ protected MethodInfo generateMethodInfo(SignatureKey key, CtMethod method) { JavassistMethodInfo info = new JavassistMethodInfo(factory, this, key, method); synchronized (methods) { methods.put(key, info); } return info; } /** * Get the parameter types * * @param key the key * @return the parameter types */ protected CtClass[] getParameterTypes(SignatureKey key) { if (key.params == null) return null; CtClass[] result = new CtClass[key.params.length]; for (int i = 0; i < key.params.length; ++i) result[i] = factory.getCtClass(key.params[i]); return result; } protected Object getAnnotatedTarget() { return ctClass; } public AnnotationValue[] getAnnotations() { return getAnnotations(ctClass); } @Override public JavassistInheritableAnnotationHolder getSuperHolder() { try { CtClass zuper = ctClass.getSuperclass(); if (zuper == null) { return null; } return (JavassistTypeInfo)factory.getTypeInfo(zuper); } catch (NotFoundException e) { throw new RuntimeException(e); } } public TypeInfo[] getActualTypeArguments() { return null; } public TypeInfo getOwnerType() { return null; } public ClassInfo getRawType() { return this; } public TypeInfo getComponentType() { return null; } public TypeInfo getKeyType() { return null; } public TypeInfo getValueType() { return null; } public PackageInfo getPackage() { if (packageInfo == null) { String name = ctClass.getPackageName(); if (name != null) packageInfo = new PackageInfoImpl(ctClass.getPackageName()); } // TODO package annotations return packageInfo; } public void setAttachment(String name, Object attachment) { if (name == null) throw new IllegalArgumentException("Null name"); synchronized (this) { if (attachments == null) { if (attachment == null) return; attachments = new TypeInfoAttachments();; } } if (attachment == null) attachments.removeAttachment(name); else attachments.addAttachment(name, attachment); } public T getAttachment(Class expectedType) { if (expectedType == null) throw new IllegalArgumentException("Null expectedType"); Object result = getAttachment(expectedType.getName()); if (result == null) return null; return expectedType.cast(result); } public Object getAttachment(String name) { if (name == null) throw new IllegalArgumentException("Null name"); synchronized (this) { if (attachments == null) return null; } return attachments.getAttachment(name); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistEnumInfo.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistEnumI0000644000175000017500000000615410770506700033366 0ustar twernertwerner/* * 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.reflect.plugins.javassist; import java.util.HashMap; import javassist.CtClass; import org.jboss.reflect.plugins.EnumConstantInfoImpl; import org.jboss.reflect.spi.EnumConstantInfo; import org.jboss.reflect.spi.EnumInfo; /** * * @author Kabir Khan * @version $Revision: 71080 $ */ public class JavassistEnumInfo extends JavassistTypeInfo implements EnumInfo { /** serialVersionUID */ private static final long serialVersionUID = 3546645408219542832L; /** Enumeration constants */ protected EnumConstantInfoImpl[] enumConstants; /** The constants */ protected HashMap constants = new HashMap(); /** * Create a new JavassistEnumInfo. * * @param factory the factory * @param ctClass the ctClass * @param clazz the class */ public JavassistEnumInfo(JavassistTypeInfoFactoryImpl factory, CtClass ctClass, Class clazz) { super(factory, ctClass, clazz); } /** * Set the enumeration constants * * @param enumConstants the enumeration constants */ public void setEnumConstants(EnumConstantInfoImpl[] enumConstants) { for (int i = 0; i < enumConstants.length; i++) constants.put(enumConstants[i].getName(), enumConstants[i]); this.enumConstants = enumConstants; } public EnumConstantInfo[] getEnumConstants() { return enumConstants; } public EnumConstantInfo getEnumConstant(String name) { return constants.get(name); } @SuppressWarnings({"unchecked", "deprecation"}) public Object getEnumValue(String name) { return Enum.valueOf((Class) getType(), name); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || !(o instanceof EnumInfo)) return false; if (!super.equals(o)) return false; final EnumInfo enumInfo = (EnumInfo) o; if (!getName().equals(enumInfo.getName())) return false; return true; } @Override public int hashCode() { return getName().hashCode(); } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistArrayInfoImpl.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistArray0000644000175000017500000000742110763226747033441 0ustar twernertwerner/* * 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.reflect.plugins.javassist; import javassist.CtClass; import org.jboss.reflect.spi.AnnotationValue; import org.jboss.reflect.spi.ArrayInfo; import org.jboss.reflect.spi.PrimitiveInfo; import org.jboss.reflect.spi.TypeInfo; /** * Javassist array info * * @author Kabir Khan * @version $Revision: 70356 $ */ public class JavassistArrayInfoImpl extends JavassistTypeInfo implements ArrayInfo { /** The serialVersionUID */ private static final long serialVersionUID = 9195834689976459024L; /** Unknown annotations */ static final AnnotationValue[] UNKNOWN_ANNOTATIONS = new AnnotationValue[0]; /** The component type */ protected TypeInfo componentType; /** The hash code */ protected int hash = -1; private static String getName(TypeInfo componentType) { StringBuilder builder = new StringBuilder(); builder.append("["); TypeInfo temp = componentType; while (temp.isArray()) { builder.append("["); temp = ((JavassistArrayInfoImpl) temp).componentType; } if (temp.isPrimitive()) { // Use the signature encoded name for the primitive element type String encodedName = PrimitiveInfo.getPrimativeArrayType(temp.getName()); builder.append(encodedName); } else { builder.append("L").append(temp.getName()).append(";"); } return builder.toString(); } /** * Create a new JavassistArrayInfoImpl. * * @param factory the factory * @param ctClass the ctClass * @param clazz the class * @param componentType the component type */ JavassistArrayInfoImpl(JavassistTypeInfoFactoryImpl factory, CtClass ctClass, Class clazz, TypeInfo componentType) { super(factory, getName(componentType), ctClass, clazz); this.componentType = componentType; calculateHash(); } public TypeInfo getComponentType() { return componentType; } public AnnotationValue getAnnotation(String name) { return null; } public AnnotationValue[] getAnnotations() { return UNKNOWN_ANNOTATIONS; } public boolean isAnnotationPresent(String name) { return false; } public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof ArrayInfo)) return false; if (!super.equals(o)) return false; final ArrayInfo arrayInfo = (ArrayInfo) o; if (!componentType.equals(arrayInfo.getComponentType())) return false; return true; } public int hashCode() { return hash; } /** * Calculate the hash code */ protected void calculateHash() { int result = super.hashCode(); result = 29 * result + componentType.hashCode(); hash = result; } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistField.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistField0000644000175000017500000000304610376314651033375 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.reflect.plugins.javassist; /** * JavassistField. * * @author Adrian Brock * @version $Revision: 41318 $ */ public interface JavassistField { /** * Get the field * * @param target the target * @return the result * @throws Throwable for any error */ Object get(Object target) throws Throwable; /** * Set the field * * @param target the target * @param value the value * @throws Throwable for any error */ void set(Object target, Object value) throws Throwable; } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistAnnotationHelper.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistAnnot0000644000175000017500000000366710660625117033440 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.reflect.plugins.javassist; import org.jboss.reflect.plugins.AnnotationHelper; import org.jboss.reflect.spi.AnnotationInfo; import org.jboss.reflect.spi.AnnotationValue; /** * An javassist annotation helper that uses a static delegate.

* * This avoids recalculating things everytime a helper is * constructed inside the same classloader. * * Extends JavassistTypeInfo to get access to delegate + * simplifies usage when TIF must also be used as AnnotationHelper. * * @author Ales Justin */ public class JavassistAnnotationHelper extends JavassistTypeInfoFactory implements AnnotationHelper { public AnnotationValue[] getAnnotations(Object object) { return delegate.getAnnotations(object); } public AnnotationValue createAnnotationValue(AnnotationInfo info, Object ann) { return delegate.createAnnotationValue(info, ann); } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistMethodInfo.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistMetho0000644000175000017500000001511610711405721033417 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.reflect.plugins.javassist; import java.lang.reflect.Modifier; import java.util.Arrays; import javassist.CtBehavior; import javassist.CtClass; import javassist.CtMethod; import javassist.NotFoundException; import org.jboss.reflect.plugins.AnnotationHelper; import org.jboss.reflect.spi.AnnotationValue; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.MethodInfo; import org.jboss.reflect.spi.ParameterInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.util.JBossStringBuilder; public class JavassistMethodInfo extends JavassistAnnotatedParameterInfo implements MethodInfo { /** The serialVersionUID */ private static final long serialVersionUID = 101183748227690112L; /** The reflection factory */ private static final JavassistReflectionFactory reflectionFactory = new JavassistReflectionFactory(true); /** The key */ private SignatureKey key; /** The method */ private CtMethod ctMethod; /** The method implementation */ private transient JavassistMethod method; /** The return type */ private transient TypeInfo returnType; /** * Create a new JavassistMethodInfo. * * @param annotationHelper the annotation helper * @param typeInfo the type info * @param key the key * @param ctMethod the method */ public JavassistMethodInfo(AnnotationHelper annotationHelper, JavassistTypeInfo typeInfo, SignatureKey key, CtMethod ctMethod) { super(annotationHelper); this.typeInfo = typeInfo; this.key = key; this.ctMethod = ctMethod; } public String getName() { return key.name; } public ClassInfo getDeclaringClass() { return typeInfo; } public int getModifiers() { return ctMethod.getModifiers(); } public boolean isPublic() { return Modifier.isPublic(getModifiers()); } public boolean isStatic() { return Modifier.isStatic(getModifiers()); } public boolean isVolatile() { return Modifier.isVolatile(getModifiers()); } public ClassInfo[] getExceptionTypes() { if (exceptionTypes == null) { try { CtClass[] types = ctMethod.getExceptionTypes(); exceptionTypes = new ClassInfo[types.length]; for (int i = 0; i < types.length; ++i) exceptionTypes[i] = (ClassInfo) typeInfo.getFactory().getTypeInfo(types[i]); } catch (NotFoundException e) { throw JavassistTypeInfoFactoryImpl.raiseClassNotFound("for exception types of method " + getName(), e); } } return exceptionTypes; } public TypeInfo getReturnType() { if (returnType != null) return returnType; try { CtClass clazz = ctMethod.getReturnType(); returnType = typeInfo.getFactory().getTypeInfo(clazz); return returnType; } catch (NotFoundException e) { throw JavassistTypeInfoFactoryImpl.raiseClassNotFound("for return type of method " + getName(), e); } } public ParameterInfo[] getParameters() { if (parameters == null) generateParameters(); return parameters; } public TypeInfo[] getParameterTypes() { if (parameterTypes == null) generateParameters(); return parameterTypes; } public Object invoke(Object target, Object[] args) throws Throwable { if (method == null) method = reflectionFactory.createMethod(ctMethod); return method.invoke(target, args); } protected int getHashCode() { return getName().hashCode(); } public boolean equals(Object obj) { if (obj == this) return true; if (obj == null || obj instanceof MethodInfo == false) return false; final MethodInfo other = (MethodInfo) obj; if (getName().equals(other.getName()) == false) return false; if (getDeclaringClass().equals(other.getDeclaringClass()) == false) return false; if (getReturnType().equals(other.getReturnType()) == false) return false; return Arrays.equals(getParameterTypes(), other.getParameterTypes()); } public void toShortString(JBossStringBuilder buffer) { buffer.append(getName()); } protected void toString(JBossStringBuilder buffer) { buffer.append("name=").append(getName()); super.toString(buffer); } /** * Generate parameters */ protected void generateParameters() { try { CtClass[] types = ctMethod.getParameterTypes(); parameterTypes = new TypeInfo[types.length]; for (int i = 0; i < types.length; ++i) parameterTypes[i] = typeInfo.getFactory().getTypeInfo(types[i]); parameters = new ParameterInfo[types.length]; for (int i = 0; i < types.length; ++i) parameters[i] = new JavassistParameterInfo(annotationHelper, this, i, parameterTypes[i]); } catch (NotFoundException e) { throw JavassistTypeInfoFactoryImpl.raiseClassNotFound("for parameters of " + getName(), e); } } public AnnotationValue[] getAnnotations() { return getAnnotations(ctMethod); } protected CtBehavior getParameterizedObject() { return ctMethod; } protected void createParameterAnnotations() { try { Object[][] parameterAnnotations = ctMethod.getParameterAnnotations(); super.setupParameterAnnotations(parameterAnnotations); } catch (ClassNotFoundException e) { // AutoGenerated throw new RuntimeException(e); } } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistAnnotatedInfo.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistAnnot0000644000175000017500000000601410560156111033415 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.reflect.plugins.javassist; import java.util.HashMap; import org.jboss.reflect.plugins.AbstractAnnotatedInfo; import org.jboss.reflect.plugins.AnnotationHelper; import org.jboss.reflect.spi.AnnotationInfo; import org.jboss.reflect.spi.AnnotationValue; /** * JavassistAnnotatedInfo. * * @author Adrian Brock * @version $Revision: 60147 $ */ public abstract class JavassistAnnotatedInfo extends AbstractAnnotatedInfo { final static AnnotationValue[] NOT_CONFIGURED = new AnnotationValue[0]; /** The annotations */ protected AnnotationValue[] annotationsArray = NOT_CONFIGURED; /** Annotations map Map */ protected HashMap annotationMap; protected AnnotationHelper annotationHelper; public JavassistAnnotatedInfo(AnnotationHelper annotationHelper) { this.annotationHelper = annotationHelper; } protected AnnotationValue[] getAnnotations(Object obj) { synchronized (this) { if (annotationsArray == NOT_CONFIGURED) { annotationsArray = null; setupAnnotations(annotationHelper.getAnnotations(obj)); } } return annotationsArray; } public AnnotationValue getAnnotation(String name) { getAnnotations(); return annotationMap.get(name); } public boolean isAnnotationPresent(String name) { getAnnotations(); return annotationMap.containsKey(name); } /** * Set up the annotations * * @param annotations the annotations */ protected void setupAnnotations(AnnotationValue[] annotations) { if (annotations != null && annotations.length > 0) { this.annotationsArray = annotations; annotationMap = new HashMap(); for (int i = 0; i < annotations.length; i++) { AnnotationInfo type = annotations[i].getAnnotationType(); annotationMap.put(type.getName(), annotations[i]); } } } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/SignatureKey.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/SignatureKey.j0000644000175000017500000000720510533536206033322 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.reflect.plugins.javassist; import java.util.Arrays; import org.jboss.reflect.spi.TypeInfo; import org.jboss.util.JBossStringBuilder; /** * SignatureKey. * * @author Adrian Brock * @version $Revision: 58766 $ */ class SignatureKey { /** The name */ String name; /** The parameter names */ String[] params; /** The cached hashcode */ private transient int cachedHashCode = Integer.MIN_VALUE; /** * Create a new SignatureKey. * * @param name the name * @param typeInfos the type infos */ public SignatureKey(String name, TypeInfo[] typeInfos) { this.name = name; if (typeInfos != null && typeInfos.length > 0) { params = new String[typeInfos.length]; for (int i = 0; i < typeInfos.length; ++i) params[i] = typeInfos[i].getName(); } } /** * Create a new SignatureKey. * * @param name the name * @param params the params */ public SignatureKey(String name, String[] params) { this.name = name; if (params != null && params.length > 0) this.params = params; } public boolean equals(Object obj) { if (obj == this) return true; if (obj == null || obj instanceof SignatureKey == false) return false; SignatureKey other = (SignatureKey) obj; if (name == null && other.name != null) return false; if (name != null && other.name == null) return false; if (name != null && name.equals(other.name) == false) return false; if (params == null && other.params == null) return true; if (params == null && other.params != null) return false; if (params != null && other.params == null) return false; if (params.length != other.params.length) return false; for (int i = 0; i < params.length; ++i) { if (params[i].equals(other.params[i]) == false) return false; } return true; } public int hashCode() { if (cachedHashCode == Integer.MIN_VALUE) { JBossStringBuilder builder = new JBossStringBuilder(); if (name != null) builder.append(name); if (params != null) { for (int i = 0; i < params.length; ++i) builder.append(params[i]); } cachedHashCode = builder.toString().hashCode(); } return cachedHashCode; } public String toString() { if (params == null) return name + "[]"; return name + Arrays.asList(params); } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistParameterInfo.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistParam0000644000175000017500000000710310560156111033376 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.reflect.plugins.javassist; import org.jboss.reflect.plugins.AnnotationHelper; import org.jboss.reflect.spi.AnnotationValue; import org.jboss.reflect.spi.ParameterInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.util.JBossStringBuilder; /** * JavassistParameterInfo. * * @author Adrian Brock * @version $Revision: 60147 $ */ public class JavassistParameterInfo extends JavassistAnnotatedInfo implements ParameterInfo { /** The serialVersionUID */ private static final long serialVersionUID = 7388866103874412735L; /** The annotated info */ private JavassistAnnotatedParameterInfo annotated; /** The name */ private String name; /** The paramter type */ private TypeInfo parameterType; /** * Create a new JavassistParameterInfo. * * @param annotationHelper the annotation helper * @param annotated the annotated object * @param index the index * @param parameterType the type */ public JavassistParameterInfo(AnnotationHelper annotationHelper, JavassistAnnotatedParameterInfo annotated, int index, TypeInfo parameterType) { super(annotationHelper); this.annotated = annotated; this.name = "arg" + index; this.parameterType = parameterType; } /** * Get the annotated info * * @return the annotated */ protected JavassistAnnotatedInfo getAnnotated() { return annotated; } public String getName() { return name; } public TypeInfo getParameterType() { return parameterType; } public boolean equals(Object obj) { if (this == obj) return true; if (obj == null || obj instanceof ParameterInfo == false) return false; ParameterInfo other = (ParameterInfo) obj; return parameterType.equals(other.getParameterType()); } protected int getHashCode() { return getName().hashCode(); } public void toShortString(JBossStringBuilder buffer) { buffer.append(getParameterType()); } protected void toString(JBossStringBuilder buffer) { buffer.append("type=").append(getParameterType()); super.toString(buffer); } public AnnotationValue[] getAnnotations() { if (annotationsArray == NOT_CONFIGURED) { annotated.createParameterAnnotations(); //Calls setAnnotations() so annotationsArray is created } return annotationsArray; } public void setAnnotations(AnnotationValue[] annotations) { annotationsArray = annotations; setupAnnotations(annotations); } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeInfoFactoryImpl.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeI0000644000175000017500000002634511033635321033402 0ustar twernertwerner/* * 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.reflect.plugins.javassist; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import javassist.ClassPool; import javassist.CtClass; import javassist.CtField; import javassist.CtMember; import javassist.CtMethod; import javassist.CtPrimitiveType; import javassist.NotFoundException; import org.jboss.reflect.plugins.AnnotationAttributeImpl; import org.jboss.reflect.plugins.AnnotationHelper; import org.jboss.reflect.plugins.AnnotationValueFactory; import org.jboss.reflect.plugins.AnnotationValueImpl; import org.jboss.reflect.plugins.EnumConstantInfoImpl; import org.jboss.reflect.spi.AnnotationInfo; import org.jboss.reflect.spi.AnnotationValue; import org.jboss.reflect.spi.NumberInfo; import org.jboss.reflect.spi.PrimitiveInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.reflect.spi.TypeInfoFactory; import org.jboss.util.JBossStringBuilder; import org.jboss.util.collection.WeakClassCache; /** * A javassist type factory. * * @author Adrian Brock */ public class JavassistTypeInfoFactoryImpl extends WeakClassCache implements TypeInfoFactory, AnnotationHelper { static final ClassPool pool = ClassPool.getDefault(); static final AnnotationValue[] NO_ANNOTATIONS = new AnnotationValue[0]; /** * Raise NoClassDefFoundError for javassist not found * * @param name the name * @param e the not found error * @return never * @throws NoClassDefFoundError always */ public static NoClassDefFoundError raiseClassNotFound(String name, NotFoundException e) throws NoClassDefFoundError { NoClassDefFoundError ex = new NoClassDefFoundError("Unable to find class " + name); if (e.getCause() != null) ex.initCause(e.getCause()); // Hide the javassist error throw ex; } /** * Raise NoClassDefFoundError for javassist not found * * @param name the name * @param e the not found error * @return never * @throws NoClassDefFoundError always */ public static NoClassDefFoundError raiseClassNotFound(String name, ClassNotFoundException e) throws NoClassDefFoundError { NoClassDefFoundError ex = new NoClassDefFoundError("Unable to find class " + name); ex.initCause(e); throw ex; } /** * Raise NoClassDefFoundError for javassist not found * * @param name the name * @param e the not found error * @return never * @throws NoClassDefFoundError always */ public static NoClassDefFoundError raiseMethodNotFound(String name, NotFoundException e) throws NoClassDefFoundError { NoSuchMethodError ex = new NoSuchMethodError("Unable to find method " + name); if (e.getCause() != null) ex.initCause(e.getCause()); // Hide the javassist error throw ex; } /** * Raise NoClassDefFoundError for javassist not found * * @param name the name * @param e the not found error * @return never * @throws NoClassDefFoundError always */ public static NoClassDefFoundError raiseFieldNotFound(String name, NotFoundException e) throws NoClassDefFoundError { NoSuchFieldError ex = new NoSuchFieldError("Unable to find field " + name); if (e.getCause() != null) ex.initCause(e.getCause()); // Hide the javassist error throw ex; } @SuppressWarnings("unchecked") protected Object instantiate(Class clazz) { try { CtClass ctClass = getCtClass(clazz.getName()); if (clazz.isArray()) { TypeInfo componentType = getTypeInfo(clazz.getComponentType()); return new JavassistArrayInfoImpl(this, ctClass, clazz, componentType); } if (ctClass.isAnnotation()) { JavassistAnnotationInfo result = new JavassistAnnotationInfo(this, ctClass, clazz); CtMethod[] methods = ctClass.getDeclaredMethods(); AnnotationAttributeImpl[] atttributes = new AnnotationAttributeImpl[methods.length]; for (int i = 0 ; i < methods.length ; i++) { atttributes[i] = new AnnotationAttributeImpl(methods[i].getName(), getTypeInfo(methods[i].getReturnType()), null); } result.setAttributes(atttributes); return result; } else if (ctClass.isEnum()) { JavassistEnumInfo enumInfo = new JavassistEnumInfo(this, ctClass, clazz); CtField[] fields = ctClass.getFields(); EnumConstantInfoImpl[] constants = new EnumConstantInfoImpl[fields.length]; int i = 0; for (CtField field : fields) { AnnotationValue[] annotations = getAnnotations(field); constants[i++] = new EnumConstantInfoImpl(field.getName(), enumInfo, annotations); } enumInfo.setEnumConstants(constants); return enumInfo; } return new JavassistTypeInfo(this, ctClass, clazz); } catch (NotFoundException e) { throw new RuntimeException(e); } } /** * Get the type info * * @param ctClass the ctClass * @return the typeinfo */ protected TypeInfo getTypeInfo(CtClass ctClass) { try { String name = convertName(ctClass); return getTypeInfo(name, null); } catch (ClassNotFoundException e) { throw raiseClassNotFound(ctClass.getName(), e); } } /** * Convert name * * @param clazz the class * @return the converted name */ protected String convertName(CtClass clazz) { CtClass temp = clazz; if (temp.isArray()) { JBossStringBuilder buffer = new JBossStringBuilder(); try { while (temp.isArray()) { buffer.append('['); temp = temp.getComponentType(); } if (temp.isPrimitive()) { CtPrimitiveType primitive = (CtPrimitiveType) temp; buffer.append(Character.toString(primitive.getDescriptor())); } else { buffer.append('L'); buffer.append(temp.getName()); buffer.append(';'); } return buffer.toString(); } catch (NotFoundException e) { throw raiseClassNotFound(clazz.getName(), e); } } return clazz.getName(); } /** * Get the CtClass * * @param name the name * @return the CtClass */ protected CtClass getCtClass(String name) { try { return pool.get(name); } catch (NotFoundException e) { throw raiseClassNotFound(name, e); } } @SuppressWarnings("unchecked") protected void generate(Class clazz, Object result) { // Everything is done lazily } public TypeInfo getTypeInfo(Class clazz) { if (clazz == null) throw new IllegalArgumentException("Null class"); TypeInfo primitive = PrimitiveInfo.valueOf(clazz.getName()); if (primitive != null) return primitive; NumberInfo number = NumberInfo.valueOf(clazz.getName()); if (number != null) { synchronized (number) { if (number.getPhase() != NumberInfo.Phase.INITIALIZING) { if (number.getPhase() != NumberInfo.Phase.COMPLETE) { number.initializing(); number.setDelegate((TypeInfo)get(clazz)); } return number; } } } return (TypeInfo) get(clazz); } public TypeInfo getTypeInfo(String name, ClassLoader cl) throws ClassNotFoundException { if (name == null) throw new IllegalArgumentException("Null class name"); if (cl == null) cl = Thread.currentThread().getContextClassLoader(); TypeInfo primitive = PrimitiveInfo.valueOf(name); if (primitive != null) return primitive; NumberInfo number = NumberInfo.valueOf(name); if (number != null) { synchronized (number) { if (number.getPhase() != NumberInfo.Phase.INITIALIZING) { if (number.getPhase() != NumberInfo.Phase.COMPLETE) { number.initializing(); number.setDelegate((TypeInfo)get(Class.forName(name, false, cl))); } return number; } } } Class clazz = Class.forName(name, false, cl); return getTypeInfo(clazz); } public TypeInfo getTypeInfo(Type type) { if (type instanceof Class) return getTypeInfo((Class) type); // TODO JBMICROCONT-129 getTypeInfo + NumberInfo throw new org.jboss.util.NotImplementedException("getTypeInfo"); } public AnnotationValue[] getAnnotations(Object obj) { try { Object[] annotations; if (obj instanceof CtMember) { annotations = ((CtMember)obj).getAvailableAnnotations(); } else if (obj instanceof CtClass) { annotations = ((CtClass)obj).getAvailableAnnotations(); } else { throw new RuntimeException("Attempt was made to read annotations from unsupported type " + obj.getClass().getName() + ": " + obj); } if (annotations.length == 0) { return NO_ANNOTATIONS; } AnnotationValue[] annotationValues = new AnnotationValueImpl[annotations.length]; for (int i = 0 ; i < annotations.length ; i++) { Class clazz = ((Annotation)annotations[i]).annotationType(); AnnotationInfo info = (AnnotationInfo)getTypeInfo(clazz); annotationValues[i] = AnnotationValueFactory.createAnnotationValue(this, this, info, annotations[i]); } return annotationValues; } // catch (ClassNotFoundException e) // { // throw new RuntimeException(e); // } catch (Throwable t) { throw new RuntimeException(t); } } public AnnotationValue createAnnotationValue(AnnotationInfo info, Object ann) { return AnnotationValueFactory.createAnnotationValue(this, this, info, ann); } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistFieldInfo.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistField0000644000175000017500000001073010711405721033363 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.reflect.plugins.javassist; import org.jboss.reflect.plugins.AnnotationHelper; import org.jboss.reflect.spi.AnnotationValue; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.FieldInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.util.JBossStringBuilder; import javassist.CtClass; import javassist.CtField; import javassist.Modifier; import javassist.NotFoundException; /** * JavassistFieldInfo. * * @author Adrian Brock * @version $Revision: 66537 $ */ public class JavassistFieldInfo extends JavassistAnnotatedInfo implements FieldInfo { /** The serialVersionUID */ private static final long serialVersionUID = -104555531831318930L; /** The reflection factory */ private static final JavassistReflectionFactory reflectionFactory = new JavassistReflectionFactory(true); /** The field */ private CtField ctField; /** The field implementation */ private transient JavassistField field; /** The type */ private transient TypeInfo fieldType; /** The type info */ protected JavassistTypeInfo typeInfo; /** * Create a new JavassistFieldInfo. * * @param annotationHelper the annotation helper * @param typeInfo the type info * @param ctField the field */ public JavassistFieldInfo(AnnotationHelper annotationHelper, JavassistTypeInfo typeInfo, CtField ctField) { super(annotationHelper); this.typeInfo = typeInfo; this.ctField = ctField; } public String getName() { return ctField.getName(); } public int getModifiers() { return ctField.getModifiers(); } public boolean isPublic() { return Modifier.isPublic(getModifiers()); } public boolean isStatic() { return Modifier.isStatic(getModifiers()); } public boolean isVolatile() { return Modifier.isVolatile(getModifiers()); } public ClassInfo getDeclaringClass() { return typeInfo; } public TypeInfo getType() { if (fieldType != null) return fieldType; try { CtClass clazz = ctField.getType(); fieldType = typeInfo.getFactory().getTypeInfo(clazz); return fieldType; } catch (NotFoundException e) { throw JavassistTypeInfoFactoryImpl.raiseFieldNotFound(getName(), e); } } public Object get(Object target) throws Throwable { if (field == null) field = reflectionFactory.createField(ctField); return field.get(target); } public Object set(Object target, Object value) throws Throwable { if (field == null) field = reflectionFactory.createField(ctField); field.set(target, value); return null; } protected int getHashCode() { return getName().hashCode(); } public boolean equals(Object obj) { if (obj == this) return true; if (obj == null || obj instanceof FieldInfo == false) return false; FieldInfo other = (FieldInfo) obj; if (getName().equals(other.getName()) == false) return false; return getDeclaringClass().equals(other.getDeclaringClass()); } public void toShortString(JBossStringBuilder buffer) { buffer.append(getName()); } protected void toString(JBossStringBuilder buffer) { buffer.append("name=").append(getName()); super.toString(buffer); } public AnnotationValue[] getAnnotations() { return getAnnotations(ctField); } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistConstructor.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistConst0000644000175000017500000000257610376314651033447 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.reflect.plugins.javassist; /** * JavassistConstructor. * * @author Adrian Brock * @version $Revision: 41318 $ */ public interface JavassistConstructor { /** * Invoke the constructor * * @param args the parameters * @return the result * @throws Throwable for any error */ Object newInstance(Object[] args) throws Throwable; } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistAnnotationInfo.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistAnnot0000644000175000017500000000603410446736533033436 0ustar twernertwerner/* * 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.reflect.plugins.javassist; import java.util.HashMap; import javassist.CtClass; import org.jboss.reflect.plugins.AnnotationAttributeImpl; import org.jboss.reflect.plugins.AnnotationInfoImpl; import org.jboss.reflect.spi.AnnotationAttribute; import org.jboss.reflect.spi.AnnotationInfo; /** * * @author Kabir Khan * @version $Revision: 45764 $ */ public class JavassistAnnotationInfo extends JavassistTypeInfo implements AnnotationInfo { /** serialVersionUID */ private static final long serialVersionUID = 3546645408219542832L; /** The attributes */ protected AnnotationAttribute[] attributes; /** Attribute Map */ protected HashMap attributeMap; public JavassistAnnotationInfo(JavassistTypeInfoFactoryImpl factory, CtClass ctClass, Class clazz) { super(factory, ctClass, clazz); } /** * Set the attributes * * @param attributes the attributes */ public void setAttributes(AnnotationAttributeImpl[] attributes) { this.attributes = attributes; if (attributes != null && attributes.length > 0) { this.attributes = attributes; attributeMap = new HashMap(); for (int i = 0; i < attributes.length; i++) { attributeMap.put(attributes[i].getName(), attributes[i]); } } } public AnnotationAttribute[] getAttributes() { return attributes; } public AnnotationAttribute getAttribute(String name) { if (attributeMap == null) return null; return attributeMap.get(name); } public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof AnnotationInfoImpl)) return false; final AnnotationInfoImpl annotationInfo = (AnnotationInfoImpl) o; if (!getName().equals(annotationInfo.getName())) return false; return true; } public int hashCode() { return getName().hashCode(); } } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistInheritableAnnotationHolder.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistInher0000644000175000017500000001172310560664062033417 0ustar twernertwerner/* * 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.reflect.plugins.javassist; import java.lang.annotation.Inherited; import java.util.HashMap; import java.util.Map; import javassist.CtClass; import org.jboss.reflect.plugins.AnnotationHelper; import org.jboss.reflect.spi.AnnotationValue; /** * * @author Kabir Khan * @version $Revision: 60200 $ */ public abstract class JavassistInheritableAnnotationHolder extends JavassistAnnotatedInfo { /** The classname of the @Inherited annotation, this needs retroing to work on JDK 1.4 */ private static final String INHERITED_NAME = Inherited.class.getName();//This /** All annotations Map */ protected Map allAnnotations; /** All annotations */ protected AnnotationValue[] allAnnotationsArray = NOT_CONFIGURED; protected CtClass ctClass; public JavassistInheritableAnnotationHolder(CtClass ctClass, AnnotationHelper annotationHelper) { super(annotationHelper); this.ctClass = ctClass; } public AnnotationValue[] getAnnotations() { if (allAnnotationsArray == NOT_CONFIGURED) setupAnnotations(annotationHelper.getAnnotations(ctClass)); return allAnnotationsArray; } protected AnnotationValue[] getAnnotations(Object obj) { synchronized (this) { if (allAnnotationsArray == NOT_CONFIGURED) { allAnnotationsArray = annotationHelper.getAnnotations(obj); setupAnnotations(allAnnotationsArray); } } return allAnnotationsArray; } public AnnotationValue getAnnotation(String name) { getAnnotations(); return allAnnotations.get(name); } public boolean isAnnotationPresent(String name) { getAnnotations(); return allAnnotations.containsKey(name); } /** * Set up the annotations * * @param annotations the annotations */ public void setupAnnotations(AnnotationValue[] annotations) { JavassistInheritableAnnotationHolder superHolder = getSuperHolder(); AnnotationValue[] superAllAnnotations = (superHolder != null) ? superHolder.getAnnotations() : null; if (annotations != null && annotations.length > 0) { annotationMap = new HashMap(); annotationsArray = annotations; for (int i = 0; i < annotations.length; i++) { annotationMap.put(annotations[i].getAnnotationType().getName(), annotations[i]); } allAnnotations = new HashMap(); if (superHolder != null && superAllAnnotations != null && superAllAnnotations.length != 0) { for (int i = 0; i < superAllAnnotations.length; i++) { AnnotationValue av = superAllAnnotations[i]; if (av.getAnnotationType().isAnnotationPresent(INHERITED_NAME)) { allAnnotations.put(av.getAnnotationType().getName(), av); } } } else allAnnotationsArray = annotationsArray; for (int i = 0; i < annotations.length; i++) allAnnotations.put(annotations[i].getAnnotationType().getName(), annotations[i]); allAnnotationsArray = allAnnotations.values().toArray(new AnnotationValue[allAnnotations.size()]); } else { if (superHolder != null) { allAnnotations = superHolder.getAllAnnotations(); allAnnotationsArray = superAllAnnotations; } else { allAnnotations = new HashMap(); } } } /** * Get all the annotations as a map * * @return the map */ protected Map getAllAnnotations() { if (allAnnotations == null) setupAnnotations(annotationHelper.getAnnotations(ctClass)); return allAnnotations; } public abstract JavassistInheritableAnnotationHolder getSuperHolder(); } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistAnnotatedParameterInfo.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistAnnot0000644000175000017500000000532610756326650033440 0ustar twernertwerner/* * 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.reflect.plugins.javassist; import java.lang.annotation.Annotation; import org.jboss.reflect.plugins.AnnotationHelper; import org.jboss.reflect.spi.AnnotationInfo; import org.jboss.reflect.spi.AnnotationValue; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.ParameterInfo; import org.jboss.reflect.spi.TypeInfo; /** * * @author Kabir Khan * @version $Revision: 69888 $ */ public abstract class JavassistAnnotatedParameterInfo extends JavassistAnnotatedInfo { /** The parameters */ protected transient ParameterInfo[] parameters; /** The parameter types */ protected transient TypeInfo[] parameterTypes; /** The exception types */ protected transient ClassInfo[] exceptionTypes; /** The type info */ protected JavassistTypeInfo typeInfo; public JavassistAnnotatedParameterInfo(AnnotationHelper annotationHelper) { super(annotationHelper); } protected void setupParameterAnnotations(Object[][] annotations) { for (int param = 0 ; param < annotations.length ; param++) { AnnotationValue[] annotationValues = new AnnotationValue[annotations[param].length]; for (int ann = 0 ; ann < annotationValues.length ; ann++) { Class clazz = ((Annotation)annotations[param][ann]).annotationType(); AnnotationInfo info = (AnnotationInfo)((JavassistTypeInfoFactoryImpl)annotationHelper).getTypeInfo(clazz); annotationValues[ann] = annotationHelper.createAnnotationValue(info, annotations[param][ann]); } ((JavassistParameterInfo)parameters[param]).setAnnotations(annotationValues); } } protected abstract void createParameterAnnotations(); } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeInfoFactory.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeI0000644000175000017500000000373010756326650033410 0ustar twernertwerner/* * 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.reflect.plugins.javassist; import java.lang.reflect.Type; import org.jboss.reflect.spi.TypeInfo; import org.jboss.reflect.spi.TypeInfoFactory; /** * An javassist type factory that uses a static delegate.

* * This avoids recalculating things everytime a factory is * constructed inside the same classloader * * @author Adrian Brock */ public class JavassistTypeInfoFactory implements TypeInfoFactory { /** The delegate */ protected static JavassistTypeInfoFactoryImpl delegate = new JavassistTypeInfoFactoryImpl(); static TypeInfoFactory getDelegate() { return delegate; } public TypeInfo getTypeInfo(Class clazz) { return delegate.getTypeInfo(clazz); } public TypeInfo getTypeInfo(String name, ClassLoader cl) throws ClassNotFoundException { return delegate.getTypeInfo(name, cl); } public TypeInfo getTypeInfo(Type type) { return delegate.getTypeInfo(type); } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistMethod.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistMetho0000644000175000017500000000263010376314651033424 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.reflect.plugins.javassist; /** * JavassistMethod. * * @author Adrian Brock * @version $Revision: 41318 $ */ public interface JavassistMethod { /** * Invoke the method * * @param target the target * @param args the parameters * @return the result * @throws Throwable for any error */ Object invoke(Object target, Object[] args) throws Throwable; } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistReflectionFactory.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/javassist/JavassistRefle0000644000175000017500000005324410756326650033420 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.reflect.plugins.javassist; import java.security.AccessController; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.concurrent.atomic.AtomicInteger; import javassist.ClassPool; import javassist.CtClass; import javassist.CtConstructor; import javassist.CtField; import javassist.CtMethod; import javassist.CtNewMethod; import javassist.Modifier; import javassist.NotFoundException; import org.jboss.util.JBossStringBuilder; import org.jboss.util.UnreachableStatementException; /** * JavassistReflectionFactory. * * TODO JBMICROCONT-122 proper classpool with pruning * TODO JBMICROCONT-121 non compiler based implementation * @author Adrian Brock * @version $Revision: 69888 $ */ public class JavassistReflectionFactory { /** The method class counter */ private static final AtomicInteger counter = new AtomicInteger(0); /** Whether to check arguments */ private final boolean check; /** * Create a new JavassistReflectionFactory. * * @param check whether to check arguments */ public JavassistReflectionFactory(boolean check) { this.check = check; } /** * Create a javassist method * * @param ctMethod the method * @return the method * @throws Throwable for any error */ public JavassistMethod createMethod(CtMethod ctMethod) throws Throwable { ClassPool pool = JavassistTypeInfoFactoryImpl.pool; final CtClass result = pool.makeClass(JavassistMethod.class.getName() + counter.incrementAndGet()); /* TODO JBMICROCONT-133 figure out how to do this on all JDKs try { CtClass magic = pool.get("sun.reflect.MagicAccessorImpl"); result.setSuperclass(magic); } catch (NotFoundException ignored) { }*/ result.addInterface(pool.get(JavassistMethod.class.getName())); CtConstructor constructor = new CtConstructor(null, result); constructor.setBody("super();"); result.addConstructor(constructor); CtClass object = pool.get(Object.class.getName()); JBossStringBuilder buffer = new JBossStringBuilder(); // Signature buffer.append("public Object invoke(Object target, Object[] args) throws Throwable {"); boolean isInstanceMethod = Modifier.isStatic(ctMethod.getModifiers()) == false; // Check for null target if (check && isInstanceMethod) { buffer.append("if (target == null) throw new IllegalArgumentException(\"Null target for "); buffer.append(ctMethod.getName()).append(ctMethod.getSignature()).append("\");"); } // Check the target CtClass declaring = ctMethod.getDeclaringClass(); boolean needsCast = isInstanceMethod && object.equals(declaring) == false; if (check && needsCast) { buffer.append("if (target instanceof ").append(declaring.getName()).append(" == false) "); buffer.append("throw new IllegalArgumentException(\"Target \" + target + \""); buffer.append(" is not an instance of ").append(declaring.getName()); buffer.append(" for ").append(ctMethod.getName()).append(ctMethod.getSignature()).append("\");"); } // Check the parameters CtClass[] params = ctMethod.getParameterTypes(); if (check) { // Wrong number of args? if (params.length != 0) { buffer.append("if (args == null || args.length != ").append(params.length).append(") "); buffer.append("throw new IllegalArgumentException(\"Expected ").append(params.length).append(" parameter(s)"); buffer.append(" for ").append(ctMethod.getName()).append(ctMethod.getSignature()).append("\");"); } else { // Didn't expect args buffer.append("if (args != null && args.length != 0)"); buffer.append("throw new IllegalArgumentException(\"Expected no parameters"); buffer.append(" for ").append(ctMethod.getName()).append(ctMethod.getSignature()).append("\");"); } for (int i = 0; i < params.length; ++i) { if (object.equals(params[i]) == false) { String paramType = getBoxedType(params[i]); // Primitives can't be null if (params[i].isPrimitive()) { buffer.append("if (args[").append(i).append("] == null) "); buffer.append("throw new IllegalArgumentException(\"Parameter ").append(i); buffer.append(" cannot be null for ").append(params[i].getName()); buffer.append(" for ").append(ctMethod.getName()).append(ctMethod.getSignature()).append("\");"); } // Check the parameter types buffer.append("if (args[").append(i).append("] != null && "); buffer.append("args[").append(i).append("] instanceof ").append(paramType).append(" == false) "); buffer.append("throw new IllegalArgumentException(\"Parameter ").append(i).append(" \" + args[").append(i).append("] + \""); buffer.append(" is not an instance of ").append(paramType); buffer.append(" for ").append(ctMethod.getName()).append(ctMethod.getSignature()).append("\");"); } } } // Add a return and box the return type if necessary CtClass returnType = ctMethod.getReturnType(); boolean isVoid = CtClass.voidType.equals(returnType); boolean isPrimitive = returnType.isPrimitive(); if (isVoid == false) { buffer.append("return "); if (isPrimitive) buffer.append("new ").append(getBoxedType(returnType)).append('('); } // Instance method if (isInstanceMethod) { buffer.append('('); if (needsCast) buffer.append("(").append(declaring.getName()).append(')'); buffer.append("target)."); } else { // Static method buffer.append(declaring.getName()).append('.'); } // Add the method name buffer.append(ctMethod.getName()).append('('); // Add the parameters for (int i = 0; i < params.length; ++i) { buffer.append('('); // Cast the parameters if (object.equals(params[i]) == false) buffer.append("(").append(getBoxedType(params[i])).append(')'); buffer.append("args[").append(i).append("])"); // Unbox primitive parameters if (params[i].isPrimitive()) unbox(buffer, params[i]); if (i < params.length - 1) buffer.append(", "); } buffer.append(')'); // Complete the boxing of the return value if (isVoid == false && isPrimitive) buffer.append(')'); buffer.append(';'); // Add a return null if there is no return value if (isVoid) buffer.append("return null;"); buffer.append('}'); // Compile it String code = buffer.toString(); try { CtMethod invoke = CtNewMethod.make(code, result); result.addMethod(invoke); } catch (Exception e) { throw new RuntimeException("Cannot compile " + code, e); } // Create it try { return AccessController.doPrivileged(new PrivilegedExceptionAction() { public JavassistMethod run() throws Exception { Class clazz = result.toClass(); return (JavassistMethod) clazz.newInstance(); } }); } catch (PrivilegedActionException e) { throw e.getCause(); } } /** * Create a javassist constructor * * @param ctConstructor the constructor * @return the constructor * @throws Throwable for any error */ public JavassistConstructor createConstructor(CtConstructor ctConstructor) throws Throwable { ClassPool pool = JavassistTypeInfoFactoryImpl.pool; final CtClass result = pool.makeClass(JavassistConstructor.class.getName() + counter.incrementAndGet()); try { CtClass magic = pool.get("sun.reflect.MagicAccessorImpl"); result.setSuperclass(magic); } catch (NotFoundException ignored) { } result.addInterface(pool.get(JavassistConstructor.class.getName())); CtConstructor constructor = new CtConstructor(null, result); constructor.setBody("super();"); result.addConstructor(constructor); CtClass object = pool.get(Object.class.getName()); JBossStringBuilder buffer = new JBossStringBuilder(); // Signature buffer.append("public Object newInstance(Object[] args) throws Throwable {"); String declaring = ctConstructor.getDeclaringClass().getName(); // Check the parameters CtClass[] params = ctConstructor.getParameterTypes(); if (check) { // Wrong number of args? if (params.length != 0) { buffer.append("if (args == null || args.length != ").append(params.length).append(") "); buffer.append("throw new IllegalArgumentException(\"Expected ").append(params.length).append(" parameter(s)"); buffer.append(" for ").append("new ").append(declaring).append(ctConstructor.getSignature()).append("\");"); } else { // Didn't expect args buffer.append("if (args != null && args.length != 0)"); buffer.append("throw new IllegalArgumentException(\"Expected no parameters"); buffer.append(" for ").append("new ").append(declaring).append(ctConstructor.getSignature()).append("\");"); } for (int i = 0; i < params.length; ++i) { if (object.equals(params[i]) == false) { String paramType = getBoxedType(params[i]); // Primitives can't be null if (params[i].isPrimitive()) { buffer.append("if (args[").append(i).append("] == null) "); buffer.append("throw new IllegalArgumentException(\"Parameter ").append(i); buffer.append(" cannot be null for ").append(params[i].getName()); buffer.append(" for ").append("new ").append(declaring).append(ctConstructor.getSignature()).append("\");"); } // Check the parameter types buffer.append("if (args[").append(i).append("] != null && "); buffer.append("args[").append(i).append("] instanceof ").append(paramType).append(" == false) "); buffer.append("throw new IllegalArgumentException(\"Parameter ").append(i).append(" \" + args[").append(i).append("] + \""); buffer.append(" is not an instance of ").append(paramType); buffer.append(" for ").append("new ").append(declaring).append(ctConstructor.getSignature()).append("\");"); } } } // Add the return new buffer.append("return new ").append(declaring).append('('); // Add the parameters for (int i = 0; i < params.length; ++i) { buffer.append('('); // Cast the parameters if (object.equals(params[i]) == false) buffer.append("(").append(getBoxedType(params[i])).append(')'); buffer.append("args[").append(i).append("])"); // Unbox primitive parameters if (params[i].isPrimitive()) unbox(buffer, params[i]); if (i < params.length - 1) buffer.append(", "); } buffer.append(");}"); // Compile it String code = buffer.toString(); try { CtMethod newInstance = CtNewMethod.make(code, result); result.addMethod(newInstance); } catch (Exception e) { throw new RuntimeException("Cannot compile " + code, e); } // Create it try { return AccessController.doPrivileged(new PrivilegedExceptionAction() { public JavassistConstructor run() throws Exception { Class clazz = result.toClass(); return (JavassistConstructor) clazz.newInstance(); } }); } catch (PrivilegedActionException e) { throw e.getCause(); } } /** * Create a javassist field * * @param ctField the field * @return the field * @throws Throwable for any error */ public JavassistField createField(CtField ctField) throws Throwable { ClassPool pool = JavassistTypeInfoFactoryImpl.pool; final CtClass result = pool.makeClass(JavassistField.class.getName() + counter.incrementAndGet()); try { CtClass magic = pool.get("sun.reflect.MagicAccessorImpl"); result.setSuperclass(magic); } catch (NotFoundException ignored) { } result.addInterface(pool.get(JavassistField.class.getName())); CtConstructor constructor = new CtConstructor(null, result); constructor.setBody("super();"); result.addConstructor(constructor); CtClass object = pool.get(Object.class.getName()); // GET JBossStringBuilder buffer = new JBossStringBuilder(); // Signature buffer.append("public Object get(Object target) throws Throwable {"); boolean isInstanceField= Modifier.isStatic(ctField.getModifiers()) == false; // Check for null target if (check && isInstanceField) { buffer.append("if (target == null) throw new IllegalArgumentException(\"Null target"); buffer.append(" for ").append(ctField.getName()).append("\");"); } // Check the target CtClass declaring = ctField.getDeclaringClass(); boolean needsCast = isInstanceField && object.equals(declaring) == false; if (check && needsCast) { buffer.append("if (target instanceof ").append(declaring.getName()).append(" == false) "); buffer.append("throw new IllegalArgumentException(\"Target \" + target + \""); buffer.append(" is not an instance of ").append(declaring.getName()); buffer.append(" for ").append(ctField.getName()).append("\");"); } // Add a return and box the return type if necessary CtClass type = ctField.getType(); boolean isPrimitive = type.isPrimitive(); buffer.append("return "); if (isPrimitive) buffer.append("new ").append(getBoxedType(type)).append('('); // Instance field if (isInstanceField) { buffer.append('('); if (needsCast) buffer.append("(").append(declaring.getName()).append(')'); buffer.append("target)."); } else { // Static field buffer.append(declaring.getName()).append('.'); } // Add the field name buffer.append(ctField.getName()); // Complete the boxing of the return value if (isPrimitive) buffer.append(')'); buffer.append(";}"); // Compile it String code = buffer.toString(); CtMethod get = CtNewMethod.make(code, result); try { result.addMethod(get); } catch (Exception e) { throw new RuntimeException("Cannot compile " + code, e); } // SET buffer = new JBossStringBuilder(); // Signature buffer.append("public void set(Object target, Object value) throws Throwable {"); // Check for null target if (check && isInstanceField) { buffer.append("if (target == null) throw new IllegalArgumentException(\"Null target"); buffer.append(" for ").append(ctField.getName()).append("\");"); } // Check the target if (check && needsCast) { buffer.append("if (target instanceof ").append(declaring.getName()).append(" == false) "); buffer.append("throw new IllegalArgumentException(\"Target \" + target + \""); buffer.append(" is not an instance of ").append(declaring.getName()); buffer.append(" for ").append(ctField.getName()).append("\");"); } // Check the parameter if (check) { if (object.equals(type) == false) { String paramType = getBoxedType(type); // Primitives can't be null if (type.isPrimitive()) { buffer.append("if (type == null) "); buffer.append("throw new IllegalArgumentException(\"Value "); buffer.append(" cannot be null for ").append(type.getName()); buffer.append(" for ").append(ctField.getName()).append("\");"); } // Check the parameter types buffer.append("if (value != null && "); buffer.append("value instanceof ").append(paramType).append(" == false) "); buffer.append("throw new IllegalArgumentException(\"Value \" + value + \""); buffer.append(" is not an instance of ").append(paramType); buffer.append(" for ").append(ctField.getName()).append("\");"); } } // Instance Field if (isInstanceField) { buffer.append('('); if (needsCast) buffer.append("(").append(declaring.getName()).append(')'); buffer.append("target)."); } else { // Static field buffer.append(declaring.getName()).append('.'); } // Add the field name buffer.append(ctField.getName()).append("="); // Add the value buffer.append('('); // Cast the value if (object.equals(type) == false) buffer.append("(").append(getBoxedType(type)).append(')'); buffer.append("value)"); // Unbox primitive parameters if (type.isPrimitive()) unbox(buffer, type); buffer.append(";}"); // Compile it code = buffer.toString(); try { CtMethod set = CtNewMethod.make(code, result); result.addMethod(set); } catch (Exception e) { throw new RuntimeException("Cannot compile " + code, e); } // Create it try { return AccessController.doPrivileged(new PrivilegedExceptionAction() { public JavassistField run() throws Exception { Class clazz = result.toClass(); return (JavassistField) clazz.newInstance(); } }); } catch (PrivilegedActionException e) { throw e.getCause(); } } /** * Unbox a primitive * * @param buffer the buffer * @param primitive the primitive */ protected void unbox(JBossStringBuilder buffer, CtClass primitive) { if (CtClass.booleanType.equals(primitive)) buffer.append(".booleanValue()"); else if (CtClass.byteType.equals(primitive)) buffer.append(".byteValue()"); else if (CtClass.charType.equals(primitive)) buffer.append(".charValue()"); else if (CtClass.doubleType.equals(primitive)) buffer.append(".doubleValue()"); else if (CtClass.floatType.equals(primitive)) buffer.append(".floatValue()"); else if (CtClass.intType.equals(primitive)) buffer.append(".intValue()"); else if (CtClass.longType.equals(primitive)) buffer.append(".longValue()"); else if (CtClass.shortType.equals(primitive)) buffer.append(".shortValue()"); else { throw new UnreachableStatementException(); } } /** * Get the boxed type * * TODO JBMICROCONT-119 integer progression? * @param type the type to box * @return the boxed type name */ protected String getBoxedType(CtClass type) { if (type.isPrimitive()) { if (CtClass.booleanType.equals(type)) return Boolean.class.getName(); else if (CtClass.byteType.equals(type)) return Byte.class.getName(); else if (CtClass.charType.equals(type)) return Character.class.getName(); else if (CtClass.doubleType.equals(type)) return Double.class.getName(); else if (CtClass.floatType.equals(type)) return Float.class.getName(); else if (CtClass.intType.equals(type)) return Integer.class.getName(); else if (CtClass.longType.equals(type)) return Long.class.getName(); else if (CtClass.shortType.equals(type)) return Short.class.getName(); throw new UnreachableStatementException(); } return type.getName(); } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/SimpleProgressionConvertor.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/SimpleProgressionConvert0000644000175000017500000000771110654102420033467 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.reflect.plugins; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; import java.math.BigInteger; import java.math.BigDecimal; import org.jboss.reflect.spi.ProgressionConvertor; /** * Simple progression code. * @see javax.management.monitor.GaugeMonitor * * @author Ales Justin */ public class SimpleProgressionConvertor implements ProgressionConvertor { public boolean canProgress(Class target, Class source) { // see progression comment if (target == null || source == null || BigInteger.class == target || BigDecimal.class == target) { return false; } // ipnbX = is primitive non boolean X boolean ipnbt = target.isPrimitive() && target != Boolean.TYPE && target != Character.TYPE; boolean ipnbs = source.isPrimitive() && source != Boolean.TYPE && source != Character.TYPE; boolean targetIsNumber = Number.class.isAssignableFrom(target); boolean sourceIsNumber = Number.class.isAssignableFrom(source); return (ipnbt || targetIsNumber) && (ipnbs || sourceIsNumber); } public Object doProgression(Class target, Object value) throws Throwable { if (value == null || target == value.getClass()) { return value; } if (canProgress(target, value.getClass()) == false) { throw new IllegalArgumentException("This convertor only handles Numbers: " + target + "/" + value); } Number source = (Number) value; // set the right value if (Byte.class == target || byte.class == target) { return source.byteValue(); } else if (Double.class == target || double.class == target) { return source.doubleValue(); } else if (Float.class == target || float.class == target) { return source.floatValue(); } else if (Integer.class == target || int.class == target) { return source.intValue(); } else if (Long.class == target || long.class == target) { return source.longValue(); } else if (Short.class == target || short.class == target) { return source.shortValue(); } else if (AtomicInteger.class == target) { return new AtomicInteger(source.intValue()); } else if (AtomicLong.class == target) { return new AtomicLong(source.longValue()); } /* // maybe leave this two off - with String constructor if (BigInteger.class == target) { return new BigInteger(source.intValue()); } else if (BigDecimal.class == target) { return new BigDecimal(source.doubleValue()); } */ throw new IllegalArgumentException("Unsupported Number subclass: " + target); } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/NullProgressionConvertor.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/NullProgressionConvertor0000644000175000017500000000306210552763433033522 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.reflect.plugins; import org.jboss.reflect.spi.ProgressionConvertor; /** * Null progression implementation - doesn't progress at all. * * @author Ales Justin */ public class NullProgressionConvertor implements ProgressionConvertor { public boolean canProgress(Class target, Class source) { return false; } public Object doProgression(Class target, Object value) throws Throwable { return value; } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/AnnotationHelper.java0000644000175000017500000000334010560664062032641 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.reflect.plugins; import org.jboss.reflect.spi.AnnotationInfo; import org.jboss.reflect.spi.AnnotationValue; /** * AnnotationHelper. * * @author Adrian Brock * @version $Revision: 60200 $ */ public interface AnnotationHelper { /** * Get the annotations for the annotated object * * @param object the annotated object * @return the annotations */ AnnotationValue[] getAnnotations(Object object); /** * Create an annotation from the underlying implementation and its info type * @param info the annotation info * @param ann the underlying annotation * @return the annotation value */ AnnotationValue createAnnotationValue(AnnotationInfo info, Object ann); } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/TypeInfoAttachments.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/TypeInfoAttachments.java0000644000175000017500000000707010756326650033331 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2007, 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.reflect.plugins; import java.util.HashMap; import java.util.Map; import java.util.concurrent.Future; /** * TypeInfoAttachments. * * TODO add some security on who can add attachments * @author Adrian Brock * @version $Revision: 1.1 $ */ public class TypeInfoAttachments { /** The attachments */ private transient Map attachments; /** * Set an attachment against the type. * This is useful for caching information against a type.

* * If you add a future object, subsequent gets will wait for the result

* * WARNING: Be careful about what you put in here. Don't create * references across classloaders, if you are not sure add a WeakReference * to the information. * * @param name the name * @param attachment the attachment, pass null to remove an attachment * @throws IllegalArgumentException for a null name */ public void addAttachment(String name, Object attachment) { if (name == null) throw new IllegalArgumentException("Null name"); if (attachment == null) return; synchronized (this) { if (attachments == null) attachments = new HashMap(); attachments.put(name, attachment); } } /** * Remove an attachment * * @param name the name * @throws IllegalArgumentException for a null name */ public void removeAttachment(String name) { if (name == null) throw new IllegalArgumentException("Null name"); synchronized (this) { if (attachments == null) return; attachments.remove(name); } } /** * Get an attachment from the type * * @param name the name * @return the attachment */ public Object getAttachment(String name) { if (name == null) throw new IllegalArgumentException("Null name"); Object result = null; synchronized (this) { if (attachments == null) return null; result = attachments.get(name); } if (result == null) return null; // Special case if the attachment is a future object if (result instanceof Future) { try { return ((Future) result).get(); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException("Error getting attachment from future " + result, e); } } return result; } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/package.html0000644000175000017500000000152010271236104030772 0ustar twernertwerner

Abstract extended reflection implementations.

Package Specification

Related Documentation

Package Status

  • ALPHA

Todo

  • ???
libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/ClassInfoImpl.java0000644000175000017500000004172711112776757032116 0ustar twernertwerner/* * 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.reflect.plugins; import java.lang.reflect.Array; import java.lang.reflect.Modifier; import java.util.Collection; import java.util.HashMap; import java.util.Map; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.ConstructorInfo; import org.jboss.reflect.spi.DelegateClassInfo; import org.jboss.reflect.spi.FieldInfo; import org.jboss.reflect.spi.InterfaceInfo; import org.jboss.reflect.spi.MethodInfo; import org.jboss.reflect.spi.PackageInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.reflect.spi.TypeInfoFactory; import org.jboss.util.JBossStringBuilder; /** * Class info * * TODO JBMICROCONT-118 fix the introspection assumption * @author Bill Burke * @author Adrian Brock */ public class ClassInfoImpl extends InheritableAnnotationHolder implements ClassInfo { /** serialVersionUID */ private static final long serialVersionUID = 3545798779904340792L; /** Marker for generation */ public static final ClassInfo UNKNOWN_CLASS = new DelegateClassInfo(null, true); /** Marker for generation */ public static final ClassInfo[] UNKNOWN_CLASSES = new ClassInfo[0]; /** Marker for generation */ public static final TypeInfo UNKNOWN_TYPE = UNKNOWN_CLASS; /** Marker for generation */ public static final TypeInfo[] UNKNOWN_TYPES = new TypeInfo[0]; /** Marker for generation */ public static final InterfaceInfo[] UNKNOWN_INTERFACES = new InterfaceInfo[0]; /** Marker for generation */ public static final ConstructorInfo[] UNKNOWN_CONSTRUCTORS = new ConstructorInfo[0]; /** Marker for generation */ public static final MethodInfo[] UNKNOWN_METHODS = new MethodInfo[0]; /** Marker for generation */ public static final FieldInfo[] UNKNOWN_FIELDS = new FieldInfo[0]; /** The class name */ protected String name; /** The class modifiers */ protected int modifiers; /** The interfaces */ protected InterfaceInfo[] interfaces = UNKNOWN_INTERFACES; /** The generic interfaces */ protected InterfaceInfo[] genericInterfaces = UNKNOWN_INTERFACES; /** The methods */ protected MethodInfo[] methods = UNKNOWN_METHODS; /** The fields */ protected FieldInfo[] fields = UNKNOWN_FIELDS; /** Field map Map */ protected HashMap fieldMap; /** The super class */ protected ClassInfo superclass = UNKNOWN_CLASS; /** The generic super class */ protected ClassInfo genericSuperclass = UNKNOWN_CLASS; /** The constructor info */ protected ConstructorInfo[] constructors = UNKNOWN_CONSTRUCTORS; /** The package info */ protected PackageInfo packageInfo; /** The component type */ private transient TypeInfo componentType = ClassInfoImpl.UNKNOWN_TYPE; /** The key type */ private transient TypeInfo keyType = ClassInfoImpl.UNKNOWN_TYPE; /** The key type */ private transient TypeInfo valueType = ClassInfoImpl.UNKNOWN_TYPE; /** The class info helper */ protected transient ClassInfoHelper classInfoHelper; /** The type info factory */ protected transient TypeInfoFactory typeInfoFactory; /** The attachments */ private transient TypeInfoAttachments attachments; /** * Create a new abstract ClassInfo. */ public ClassInfoImpl() { } /** * Create a new class info * * @param name the class name */ public ClassInfoImpl(String name) { this.name = name; } /** * Create a new abstract ClassInfo. * * @param name the class name * @param modifiers the class modifiers */ public ClassInfoImpl(String name, int modifiers) { this.name = name; this.modifiers = modifiers; } /** * Create a new abstract ClassInfo. * * @param name the class name * @param modifiers the class modifiers * @param interfaces the interfaces * @param superclass the super class */ public ClassInfoImpl(String name, int modifiers, InterfaceInfo[] interfaces, ClassInfoImpl superclass) { this.name = name; this.modifiers = modifiers; this.interfaces = interfaces; this.superclass = superclass; } public TypeInfoFactory getTypeInfoFactory() { return typeInfoFactory; } public void setTypeInfoFactory(TypeInfoFactory typeInfoFactory) { this.typeInfoFactory = typeInfoFactory; } public void setClassInfoHelper(ClassInfoHelper classInfoHelper) { this.classInfoHelper = classInfoHelper; } /** * Find a method * * @param methods the methods * @param name the name * @param parameters the parameters * @return the method info */ public static MethodInfo findMethod(MethodInfo[] methods, String name, TypeInfo[] parameters) { if (methods == null) return null; for (int i = 0; i < methods.length; i++) { if (methods[i].getName().equals(name)) { final int length = (parameters != null) ? parameters.length : 0; if (methods[i].getParameterTypes().length == length) { boolean ok = true; for (int j = 0; j < length; j++) { if (!parameters[j].equals(methods[i].getParameterTypes()[j])) { ok = false; break; } } if (ok) return methods[i]; } } } return null; } /** * Find a constructor * * @param constructors the constructors * @param parameters the parameters * @return the constructor info */ public static ConstructorInfo findConstructor(ConstructorInfo[] constructors, TypeInfo[] parameters) { if (constructors == null) return null; for (int i = 0; i < constructors.length; i++) { final int length = (parameters != null) ? parameters.length : 0; if (constructors[i].getParameterTypes().length == length) { boolean ok = true; for (int j = 0; j < length; j++) { if (!parameters[j].equals(constructors[i].getParameterTypes()[j])) { ok = false; break; } } if (ok) return constructors[i]; } } return null; } /** * Get an array class * * @param clazz the class * @return the array class */ public static Class getArrayClass(Class clazz) { return Array.newInstance(clazz, 0).getClass(); } /** * Set the type * * @param type the class */ public void setType(Class type) { setAnnotatedElement(type); if (type != null) modifiers = type.getModifiers(); } /** * Set the interfaces * * @param interfaces the interfaces */ public void setInterfaces(InterfaceInfo[] interfaces) { this.interfaces = interfaces; } /** * Set the generic interfaces * * @param interfaces the interfaces */ public void setGenericInterfaces(InterfaceInfo[] interfaces) { this.genericInterfaces = interfaces; } /** * Set the declared methods * * @param methods the methods */ public void setDeclaredMethods(MethodInfoImpl[] methods) { this.methods = methods; if (methods != null) { for (int i = 0; i < methods.length; i++) methods[i].declaringClass = this; } } /** * Set the declared fields * * @param fields the fields */ public void setDeclaredFields(FieldInfoImpl[] fields) { this.fields = fields; if (fields != null) { fieldMap = new HashMap(); for (int i = 0; i < fields.length; ++i) { fields[i].declaringClass = this; fieldMap.put(fields[i].getName(), fields[i]); } } } /** * Set the declared constructors * * @param constructors the constructors */ public void setDeclaredConstructors(ConstructorInfoImpl[] constructors) { this.constructors = constructors; if (constructors != null) { for (int i = 0; i < constructors.length; i++) constructors[i].declaringClass = this; } } /** * Set the super class * * @param superInfo the super class */ public void setSuperclass(ClassInfoImpl superInfo) { this.superclass = superInfo; } /** * Set the generic super class * * @param superInfo the super class */ public void setGenericSuperclass(ClassInfo superInfo) { this.genericSuperclass = superInfo; } public boolean isInterface() { return false; } public InterfaceInfo[] getInterfaces() { if (interfaces == UNKNOWN_INTERFACES) setInterfaces(classInfoHelper.getInterfaces(this)); return interfaces; } public InterfaceInfo[] getGenericInterfaces() { if (genericInterfaces == UNKNOWN_INTERFACES) setGenericInterfaces(classInfoHelper.getGenericInterfaces(this)); return genericInterfaces; } public MethodInfo getDeclaredMethod(String name, TypeInfo[] parameters) { if (methods == UNKNOWN_METHODS) setDeclaredMethods(classInfoHelper.getMethods(this)); return findMethod(methods, name, parameters); } public MethodInfo[] getDeclaredMethods() { if (methods == UNKNOWN_METHODS) setDeclaredMethods(classInfoHelper.getMethods(this)); return methods; } public FieldInfo getDeclaredField(String name) { if (fields == UNKNOWN_FIELDS) setDeclaredFields(classInfoHelper.getFields(this)); if (fieldMap == null) return null; return fieldMap.get(name); } public FieldInfo[] getDeclaredFields() { if (fields == UNKNOWN_FIELDS) setDeclaredFields(classInfoHelper.getFields(this)); return fields; } public ConstructorInfo getDeclaredConstructor(TypeInfo[] parameters) { if (methods == UNKNOWN_METHODS) setDeclaredConstructors(classInfoHelper.getConstructors(this)); return findConstructor(constructors, parameters); } public ConstructorInfo[] getDeclaredConstructors() { if (constructors == UNKNOWN_CONSTRUCTORS) setDeclaredConstructors(classInfoHelper.getConstructors(this)); return constructors; } public ClassInfo getSuperclass() { if (superclass == UNKNOWN_CLASS) setSuperclass(classInfoHelper.getSuperClass(this)); return superclass; } public ClassInfo getGenericSuperclass() { if (genericSuperclass == UNKNOWN_CLASS) setGenericSuperclass(classInfoHelper.getGenericSuperClass(this)); return genericSuperclass; } public int getModifiers() { return modifiers; } public boolean isStatic() { return Modifier.isStatic(modifiers); } public boolean isPublic() { return Modifier.isPublic(modifiers); } public boolean isVolatile() { return Modifier.isVolatile(modifiers); } public String getName() { return name; } public String getSimpleName() { return getType().getSimpleName(); } @Deprecated @SuppressWarnings("unchecked") public Class getType() { return (Class) annotatedElement; } public Object convertValue(Object value) throws Throwable { return ValueConvertor.convertValue(getType(), value); } public Object convertValue(Object value, boolean replaceProperties) throws Throwable { return ValueConvertor.convertValue(getType(), value, replaceProperties); } public Object convertValue(Object value, boolean replaceProperties, boolean trim) throws Throwable { return ValueConvertor.convertValue(getType(), value, replaceProperties, trim); } public boolean isArray() { return getType().isArray(); } public boolean isCollection() { return Collection.class.isAssignableFrom(getType()); } public boolean isMap() { return Map.class.isAssignableFrom(getType()); } public boolean isAnnotation() { return getType().isAnnotation(); } public boolean isEnum() { return getType().isEnum(); } public boolean isPrimitive() { return false; } public TypeInfo getArrayType() { Class arrayClass = getArrayClass(getType()); return classInfoHelper.getTypeInfo(arrayClass); } @SuppressWarnings("deprecation") public Object newArrayInstance(int size) throws Throwable { if (isArray() == false) throw new ClassCastException(this + " is not an array."); return Array.newInstance(getComponentType().getType(), size); } @SuppressWarnings("deprecation") public boolean isAssignableFrom(TypeInfo info) { if (info == null) throw new NullPointerException("Parameter info cannot be null!"); return getType().isAssignableFrom(info.getType()); } @SuppressWarnings("deprecation") public boolean isInstance(Object object) { return getType().isInstance(object); } public TypeInfo[] getActualTypeArguments() { return null; } public TypeInfo getOwnerType() { return null; } public ClassInfo getRawType() { return this; } public TypeInfo getComponentType() { if (componentType == UNKNOWN_TYPE) componentType = classInfoHelper.getComponentType(this); return componentType; } public TypeInfo getKeyType() { if (keyType == UNKNOWN_TYPE) keyType = classInfoHelper.getKeyType(this); return keyType; } public TypeInfo getValueType() { if (valueType == UNKNOWN_TYPE) valueType = classInfoHelper.getValueType(this); return valueType; } public PackageInfo getPackage() { if (packageInfo == null) packageInfo = classInfoHelper.getPackage(this); return packageInfo; } public void setAttachment(String name, Object attachment) { if (name == null) throw new IllegalArgumentException("Null name"); synchronized (this) { if (attachments == null) { if (attachment == null) return; attachments = new TypeInfoAttachments(); } } if (attachment == null) attachments.removeAttachment(name); else attachments.addAttachment(name, attachment); } public T getAttachment(Class expectedType) { if (expectedType == null) throw new IllegalArgumentException("Null expectedType"); Object result = getAttachment(expectedType.getName()); if (result == null) return null; return expectedType.cast(result); } public Object getAttachment(String name) { if (name == null) throw new IllegalArgumentException("Null name"); synchronized (this) { if (attachments == null) return null; } return attachments.getAttachment(name); } @Override protected InheritableAnnotationHolder getSuperHolder() { return (ClassInfoImpl) getSuperclass(); } @Override protected void toString(JBossStringBuilder buffer) { buffer.append("name=").append(getName()); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null || obj instanceof ClassInfo == false) return false; final ClassInfo other = (ClassInfo) obj; String name = getName(); if (name != null ? name.equals(other.getName()) == false : other.getName() != null) return false; return true; } @Override public int hashCode() { return (name != null ? name.hashCode() : 0); } Object readResolve() { TypeInfoFactory typeInfoFactory = SerializationHelper.getTypeInfoFactory(); return typeInfoFactory.getTypeInfo(getType()); } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/MethodInfoImpl.java0000644000175000017500000001526010711405721032242 0ustar twernertwerner/* * 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.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.ParameterInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.util.JBossStringBuilder; import org.jboss.util.NotImplementedException; /** * Method info * * @author Bill Burke * @author Adrian Brock */ public class MethodInfoImpl extends AnnotationHolder implements MethodInfo { /** serialVersionUID */ private static final long serialVersionUID = 3257007670035756341L; /** The method name */ protected String name; /** The declaring class */ protected ClassInfo declaringClass; /** The parameter types */ protected TypeInfo[] parameterTypes; /** The parameters */ protected ParameterInfo[] parameters; /** The exception types */ protected ClassInfo[] exceptionTypes; /** The modifiers */ protected int modifiers; /** The return type */ protected TypeInfo returnType; /** The hash code */ protected int hash; /** * Create a new method info */ public MethodInfoImpl() { } /** * Create a new MethodInfo. * * @param annotations the annotations * @param name the method name * @param returnType the return type * @param parameterTypes the parameter types * @param parameterAnnotations the parameter annotations * @param exceptionTypes the exception types * @param modifiers the modifiers * @param declaring the declaring class */ public MethodInfoImpl(AnnotationValue[] annotations, String name, TypeInfo returnType, TypeInfo[] parameterTypes, AnnotationValue[][] parameterAnnotations, ClassInfo[] exceptionTypes, int modifiers, ClassInfo declaring) { super(annotations); this.name = name; if (parameterTypes == null) { this.parameterTypes = MethodInfo.NO_PARAMS_TYPES; this.parameters = MethodInfo.NO_PARAMS; } else { this.parameterTypes = parameterTypes; this.parameters = new ParameterInfoImpl[parameterTypes.length]; for (int i = 0; i < parameterTypes.length; ++i) this.parameters[i] = new ParameterInfoImpl(parameterAnnotations[i], null, parameterTypes[i]); } if (exceptionTypes == null) this.exceptionTypes = MethodInfo.NO_EXCEPTIONS; else this.exceptionTypes = exceptionTypes; this.modifiers = modifiers; this.declaringClass = declaring; this.returnType = returnType; calculateHash(); } /** * Create a new MethodInfo. * * @param annotations the annotations * @param name the method name * @param returnType the return type * @param parameters the parameters * @param exceptionTypes the exception types * @param modifiers the modifiers * @param declaring the declaring class */ public MethodInfoImpl(AnnotationValue[] annotations, String name, TypeInfo returnType, ParameterInfo[] parameters, ClassInfo[] exceptionTypes, int modifiers, ClassInfo declaring) { super(annotations); this.name = name; if (parameters == null || parameters.length == 0) { this.parameterTypes = MethodInfo.NO_PARAMS_TYPES; this.parameters = MethodInfo.NO_PARAMS; } else { this.parameters = parameters; this.parameterTypes = new TypeInfo[parameters.length]; for (int i = 0; i < parameters.length; ++i) this.parameterTypes[i] = parameters[i].getParameterType(); } if (exceptionTypes == null || exceptionTypes.length == 0) this.exceptionTypes = MethodInfo.NO_EXCEPTIONS; else this.exceptionTypes = exceptionTypes; this.modifiers = modifiers; this.declaringClass = declaring; this.returnType = returnType; calculateHash(); } public String getName() { return name; } public ClassInfo getDeclaringClass() { return declaringClass; } public TypeInfo[] getParameterTypes() { return parameterTypes; } public ParameterInfo[] getParameters() { return parameters; } public ClassInfo[] getExceptionTypes() { return exceptionTypes; } public TypeInfo getReturnType() { return returnType; } public int getModifiers() { return modifiers; } public boolean isStatic() { return Modifier.isStatic(modifiers); } public boolean isPublic() { return Modifier.isPublic(modifiers); } public boolean isVolatile() { return Modifier.isVolatile(modifiers); } public Object invoke(Object target, Object[] args) throws Throwable { throw new NotImplementedException("invoke"); } protected void toString(JBossStringBuilder buffer) { buffer.append("name=").append(name); buffer.append(Arrays.asList(parameterTypes)); buffer.append(" return=").append(returnType); } public void toShortString(JBossStringBuilder buffer) { buffer.append(name); } public boolean equals(Object obj) { if (this == obj) return true; if (obj == null || obj instanceof MethodInfo == false) return false; final MethodInfo other = (MethodInfo) obj; if (name.equals(other.getName()) == false) return false; return Arrays.equals(parameterTypes, other.getParameterTypes()); } public int hashCode() { return hash; } /** * Calculate the hash code */ protected void calculateHash() { hash = name.hashCode(); } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/ConstructorInfoImpl.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/ConstructorInfoImpl.java0000644000175000017500000001436310711405721033352 0ustar twernertwerner/* * 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.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.ParameterInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.util.JBossStringBuilder; import org.jboss.util.NotImplementedException; /** * Constructor info * * @author Bill Burke * @author Adrian Brock */ public class ConstructorInfoImpl extends AnnotationHolder implements ConstructorInfo { /** serialVersionUID */ private static final long serialVersionUID = 3256727273163272758L; /** The declring class */ protected ClassInfo declaringClass; /** The parameter types */ protected TypeInfo[] parameterTypes; /** The parameters */ protected ParameterInfo[] parameters; /** The exception types */ protected ClassInfo[] exceptionTypes; /** The modifiers */ protected int modifiers; /** The hash code */ protected int hash; /** * Create a new ConstructorInfo. */ public ConstructorInfoImpl() { } /** * Create a new ConstructorInfo. * * @param annotations the annotations * @param parameterTypes the parameter types * @param parameterAnnotations the parameter annotations * @param exceptionTypes the exception types * @param modifiers the modifiers * @param declaring the declaring class */ public ConstructorInfoImpl(AnnotationValue[] annotations, TypeInfo[] parameterTypes, AnnotationValue[][] parameterAnnotations, ClassInfo[] exceptionTypes, int modifiers, ClassInfo declaring) { super(annotations); if (parameterTypes == null) { this.parameterTypes = MethodInfo.NO_PARAMS_TYPES; this.parameters = MethodInfo.NO_PARAMS; } else { this.parameterTypes = parameterTypes; this.parameters = new ParameterInfoImpl[parameterTypes.length]; for (int i = 0; i < parameterTypes.length; ++i) this.parameters[i] = new ParameterInfoImpl(parameterAnnotations[i], null, parameterTypes[i]); } if (exceptionTypes == null) this.exceptionTypes = MethodInfo.NO_EXCEPTIONS; else this.exceptionTypes = exceptionTypes; this.modifiers = modifiers; this.declaringClass = declaring; calculateHash(); } /** * Create a new ConstructorInfo. * * @param annotations the annotations * @param parameters the parameters * @param exceptionTypes the exception types * @param modifiers the modifiers * @param declaring the declaring class */ public ConstructorInfoImpl(AnnotationValue[] annotations, ParameterInfo[] parameters, ClassInfo[] exceptionTypes, int modifiers, ClassInfo declaring) { super(annotations); if (parameters == null || parameters.length == 0) { this.parameterTypes = MethodInfo.NO_PARAMS_TYPES; this.parameters = MethodInfo.NO_PARAMS; } else { this.parameters = parameters; this.parameterTypes = new TypeInfo[parameters.length]; for (int i = 0; i < parameters.length; ++i) this.parameterTypes[i] = parameters[i].getParameterType(); } if (exceptionTypes == null || exceptionTypes.length == 0) this.exceptionTypes = MethodInfo.NO_EXCEPTIONS; else this.exceptionTypes = exceptionTypes; this.modifiers = modifiers; this.declaringClass = declaring; calculateHash(); } public ClassInfo getDeclaringClass() { return declaringClass; } public TypeInfo[] getParameterTypes() { return parameterTypes; } public ParameterInfo[] getParameters() { return parameters; } public ClassInfo[] getExceptionTypes() { return exceptionTypes; } public int getModifiers() { return modifiers; } public boolean isStatic() { return Modifier.isStatic(modifiers); } public boolean isPublic() { return Modifier.isPublic(modifiers); } public boolean isVolatile() { return Modifier.isVolatile(modifiers); } public Object newInstance(Object[] args) throws Throwable { throw new NotImplementedException("newInstance"); } protected void toString(JBossStringBuilder buffer) { buffer.append(Arrays.asList(parameterTypes)); } public boolean equals(Object obj) { if (this == obj) return true; if (obj == null || obj instanceof ConstructorInfo == false) return false; final ConstructorInfo other = (ConstructorInfo) obj; if (declaringClass.equals(other.getDeclaringClass()) == false) return false; return (Arrays.equals(parameterTypes, other.getParameterTypes())); } public int hashCode() { return hash; } protected void calculateHash() { int result = declaringClass.hashCode(); if (parameterTypes != null) { for (int i = 0; i < parameterTypes.length; i++) { result = 29 * result + parameterTypes[i].hashCode(); } } hash = result; } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/EnumInfoImpl.java0000644000175000017500000000571210770506700031733 0ustar twernertwerner/* * 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.reflect.plugins; import java.util.HashMap; import org.jboss.reflect.spi.EnumConstantInfo; import org.jboss.reflect.spi.EnumInfo; /** * Enumeration info * * @author Bill Burke * @author Adrian Brock */ public class EnumInfoImpl extends ClassInfoImpl implements EnumInfo { /** serialVersionUID */ private static final long serialVersionUID = 3617851958849713457L; /** Enumeration constants */ protected EnumConstantInfoImpl[] enumConstants; /** The constants */ protected HashMap constants = new HashMap(); /** * Create a new EnumInfo. */ public EnumInfoImpl() { } /** * Create a new EnumInfo. * * @param name the enumeration name * @param modifiers the modifiers */ public EnumInfoImpl(String name, int modifiers) { super(name, modifiers); } /** * Set the enumeration constants * * @param enumConstants the enumeration constants */ public void setEnumConstants(EnumConstantInfoImpl[] enumConstants) { for (int i = 0; i < enumConstants.length; i++) constants.put(enumConstants[i].getName(), enumConstants[i]); this.enumConstants = enumConstants; } public EnumConstantInfo[] getEnumConstants() { return enumConstants; } public EnumConstantInfo getEnumConstant(String name) { return constants.get(name); } @SuppressWarnings({"unchecked", "deprecation"}) public Object getEnumValue(String name) { return Enum.valueOf((Class) getType(), name); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || !(o instanceof EnumInfo)) return false; if (!super.equals(o)) return false; final EnumInfo enumInfo = (EnumInfo) o; if (!getName().equals(enumInfo.getName())) return false; return true; } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/SerializationHelper.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/SerializationHelper.java0000644000175000017500000000362110645410013033333 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.reflect.plugins; import java.security.PrivilegedAction; import java.security.AccessController; import org.jboss.config.spi.Configuration; import org.jboss.config.plugins.property.PropertyConfiguration; import org.jboss.reflect.spi.TypeInfoFactory; /** * Provide type info factory for ClassInfoImpl. * * @author Ales Justin */ class SerializationHelper { /** The type info factory */ private static final TypeInfoFactory factory; static { Configuration configuration = AccessController.doPrivileged(new PrivilegedAction() { public Configuration run() { return new PropertyConfiguration(); } }); factory = configuration.getTypeInfoFactory(); } static TypeInfoFactory getTypeInfoFactory() { return factory; } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/ArrayInfoImpl.java0000644000175000017500000001006710763226747032120 0ustar twernertwerner/* * 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.reflect.plugins; import java.lang.reflect.UndeclaredThrowableException; import org.jboss.reflect.spi.AnnotationValue; import org.jboss.reflect.spi.ArrayInfo; import org.jboss.reflect.spi.PrimitiveInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.reflect.spi.TypeInfoFactory; /** * Array information * * @author Bill Burke * @author Adrian Brock */ public class ArrayInfoImpl extends ClassInfoImpl implements ArrayInfo { /** serialVersionUID */ private static final long serialVersionUID = 3905804162787980599L; /** The component type */ protected TypeInfo componentType; /** The hash code */ protected int hash = -1; /** * Create a new ArrayInfo. */ public ArrayInfoImpl() { } /** * Create a new ArrayInfo. * * @param componentType the component type */ public ArrayInfoImpl(TypeInfo componentType) { if (componentType == null) throw new IllegalArgumentException("Null component type."); this.componentType = componentType; StringBuilder builder = new StringBuilder(); builder.append("["); TypeInfo temp = componentType; while (temp.isArray()) { builder.append("["); temp = ((ArrayInfo) temp).getComponentType(); } if (PrimitiveInfo.class.equals(temp.getClass())) { String encodedName = PrimitiveInfo.getPrimativeArrayType(temp.getName()); builder.append(encodedName); } else { builder.append("L").append(temp.getName()).append(";"); } name = builder.toString(); calculateHash(); } @Deprecated @SuppressWarnings("unchecked") public Class getType() { if (annotatedElement == null) { try { TypeInfoFactory tif = SerializationHelper.getTypeInfoFactory(); annotatedElement = tif.getTypeInfo(name, componentType.getType().getClassLoader()).getType(); } catch (Throwable t) { throw new UndeclaredThrowableException(t); } } return (Class)annotatedElement; } public TypeInfo getComponentType() { return componentType; } public AnnotationValue getAnnotation(String name) { return null; } public AnnotationValue[] getAnnotations() { return UNKNOWN_ANNOTATIONS; } public boolean isAnnotationPresent(String name) { return false; } public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof ArrayInfo)) return false; if (!super.equals(o)) return false; final ArrayInfo arrayInfo = (ArrayInfo) o; if (!componentType.equals(arrayInfo.getComponentType())) return false; return true; } public int hashCode() { return hash; } /** * Calculate the hash code */ protected void calculateHash() { int result = super.hashCode(); result = 29 * result + componentType.hashCode(); hash = result; } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/ClassInfoHelper.java0000644000175000017500000000765610756326650032433 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.reflect.plugins; import org.jboss.reflect.plugins.introspection.ParameterizedClassInfo; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.InterfaceInfo; import org.jboss.reflect.spi.PackageInfo; import org.jboss.reflect.spi.TypeInfo; /** * ClassInfoHelper. * * @author Adrian Brock * @version $Revision: 69888 $ */ public interface ClassInfoHelper { /** * Get the super class * * @param classInfo the class info * @return the super class info */ ClassInfoImpl getSuperClass(ClassInfoImpl classInfo); /** * Get the generic super class * * @param classInfo the class info * @return the super class info */ ClassInfo getGenericSuperClass(ClassInfoImpl classInfo); /** * Get the interfaces * * @param classInfo the class info * @return the interface info */ InterfaceInfo[] getInterfaces(ClassInfoImpl classInfo); /** * Get the generic interfaces * * @param classInfo the class info * @return the interface info */ InterfaceInfo[] getGenericInterfaces(ClassInfoImpl classInfo); /** * Get the constructors * * @param classInfo the class info * @return the constructor info */ ConstructorInfoImpl[] getConstructors(ClassInfoImpl classInfo); /** * Get the fields * * @param classInfo the class info * @return the field info */ FieldInfoImpl[] getFields(ClassInfoImpl classInfo); /** * Get the methods * * @param classInfo the class info * @return the method info */ MethodInfoImpl[] getMethods(ClassInfoImpl classInfo); /** * Get a type info * * @param clazz the class * @return the type info */ TypeInfo getTypeInfo(Class clazz); /** * Get the actual type parameters * * @param classInfo the parameterized class info * @return the type parameters */ TypeInfo[] getActualTypeArguments(ParameterizedClassInfo classInfo); /** * Get the owner type * * @param classInfo the parameterized class info * @return the owner type */ TypeInfo getOwnerType(ParameterizedClassInfo classInfo); /** * Get the component type for a collection * * @param classInfo the class info * @return the component type or null if not a collection */ TypeInfo getComponentType(ClassInfo classInfo); /** * Get the key type for a map * * @param classInfo the class info * @return the key type or null if not a map */ TypeInfo getKeyType(ClassInfo classInfo); /** * Get the value type for a map * * @param classInfo the class info * @return the value type or null if not a map */ TypeInfo getValueType(ClassInfo classInfo); /** * Get the package for class * * @param classInfo the class info * @return the package */ PackageInfo getPackage(ClassInfoImpl classInfo); } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/AbstractAnnotatedInfo.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/AbstractAnnotatedInfo.ja0000644000175000017500000000522210560156111033245 0ustar twernertwerner/* * 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.reflect.plugins; import java.io.Serializable; import java.lang.annotation.Annotation; import org.jboss.reflect.spi.AnnotatedInfo; import org.jboss.reflect.spi.AnnotationValue; import org.jboss.util.JBossObject; /** * Abstract annotated info * * @author Adrian Brock */ public abstract class AbstractAnnotatedInfo extends JBossObject implements AnnotatedInfo, Serializable { /** serialVersionUID */ private static final long serialVersionUID = 3546645408219542832L; /** No annotations */ private static final Annotation[] NO_ANNOTATIONS = new Annotation[0]; /** * Create a new annotated info */ public AbstractAnnotatedInfo() { } public T getUnderlyingAnnotation(Class annotationType) { if (annotationType == null) throw new IllegalArgumentException("Null annotationType"); AnnotationValue value = getAnnotation(annotationType.getName()); if (value == null) return null; return value.getUnderlyingAnnotation(annotationType); } public Annotation[] getUnderlyingAnnotations() { AnnotationValue[] values = getAnnotations(); if (values == null) return NO_ANNOTATIONS; Annotation[] result = new Annotation[values.length]; for (int i = 0; i < values.length; ++i) result[i] = values[i].getUnderlyingAnnotation(); return result; } public boolean isAnnotationPresent(Class annotationType) { if (annotationType == null) throw new IllegalArgumentException("Null annotationType"); return isAnnotationPresent(annotationType.getName()); } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/ClassValueImpl.java0000644000175000017500000000527510560156111032253 0ustar twernertwerner/* * 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.reflect.plugins; import org.jboss.reflect.spi.AbstractValue; import org.jboss.reflect.spi.ClassValue; import org.jboss.reflect.spi.TypeInfo; /** * Class value * * @author Bill Burke * @author Adrian Brock */ public class ClassValueImpl extends AbstractValue implements ClassValue { /** serialVersionUID */ private static final long serialVersionUID = 3256721801307566649L; /** The value */ protected String value; /** The type */ protected TypeInfo type; /** The hash code */ protected int hash = -1; /** * Create a new class value */ public ClassValueImpl() { } /** * Create a new ClassValue. * * @param value the value * @param type the type */ public ClassValueImpl(String value, TypeInfo type) { this.value = value; this.type = type; calculateHash(); } @Override public boolean isArray() { return true; } public String getValue() { return value; } public TypeInfo getType() { return type; } public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof ClassValueImpl)) return false; final ClassValueImpl classValue = (ClassValueImpl) o; if (!type.equals(classValue.type)) return false; if (!value.equals(classValue.value)) return false; return true; } public int hashCode() { return hash; } /** * Calculate the hash code */ protected void calculateHash() { int result; result = (value != null) ? value.hashCode() : 0; result = 29 * result + type.hashCode(); hash = result; } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/FieldInfoImpl.java0000644000175000017500000000756210711405721032053 0ustar twernertwerner/* * 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.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.TypeInfo; import org.jboss.util.JBossStringBuilder; import org.jboss.util.NotImplementedException; /** * A field info * * @author Bill Burke * @author Adrian Brock */ public class FieldInfoImpl extends AnnotationHolder implements FieldInfo { /** serialVersionUID */ private static final long serialVersionUID = 3546084661584539959L; /** The field name */ protected String name; /** The field type */ protected TypeInfo type; /** The field modifier */ protected int modifiers; /** The declaring class */ protected ClassInfo declaringClass; /** The hash code */ protected int hash = -1; /** * Create a new field info */ public FieldInfoImpl() { } /** * Create a new FieldInfo. * * @param annotations the annotations * @param name the name * @param type the field type * @param modifiers the field modifiers * @param declaring the declaring class */ public FieldInfoImpl(AnnotationValue[] annotations, String name, TypeInfo type, int modifiers, ClassInfo declaring) { super(annotations); this.name = name; this.type = type; this.modifiers = modifiers; this.declaringClass = declaring; calculateHash(); } public String getName() { return name; } public TypeInfo getType() { return type; } public ClassInfo getDeclaringClass() { return declaringClass; } public int getModifiers() { return modifiers; } public boolean isStatic() { return Modifier.isStatic(modifiers); } public boolean isPublic() { return Modifier.isPublic(modifiers); } public boolean isVolatile() { return Modifier.isVolatile(modifiers); } public Object get(Object target) throws Throwable { throw new NotImplementedException("get"); } public Object set(Object target, Object value) throws Throwable { throw new NotImplementedException("set"); } protected void toString(JBossStringBuilder buffer) { buffer.append("name=").append(name); } public boolean equals(Object obj) { if (this == obj) return true; if (obj == null || obj instanceof FieldInfo == false) return false; final FieldInfo other = (FieldInfo) obj; if (name.equals(other.getName()) == false) return false; return declaringClass.equals(other.getDeclaringClass()); } public int hashCode() { return hash; } /** * Calculate the hash code */ protected void calculateHash() { hash = name.hashCode(); } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/plugins/AnnotationHolder.java0000644000175000017500000000553410560156111032635 0ustar twernertwerner/* * 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.reflect.plugins; import java.util.HashMap; import org.jboss.reflect.spi.AnnotationInfo; import org.jboss.reflect.spi.AnnotationValue; /** * An annotation holder * * @author Bill Burke * @author Adrian Brock */ public class AnnotationHolder extends AbstractAnnotatedInfo { /** serialVersionUID */ private static final long serialVersionUID = 3546645408219542832L; /** The annotations */ protected AnnotationValue[] annotationsArray; /** Annotations map Map */ protected HashMap annotationMap; /** * Create a new annotation holder */ public AnnotationHolder() { } /** * Create a new AnnotationHolder. * * @param annotations the annotations */ public AnnotationHolder(AnnotationValue[] annotations) { setupAnnotations(annotations); } public AnnotationValue[] getAnnotations() { return annotationsArray; } public AnnotationValue getAnnotation(String name) { if (annotationMap == null) return null; return annotationMap.get(name); } public boolean isAnnotationPresent(String name) { if (annotationMap == null) return false; return annotationMap.containsKey(name); } /** * Set up the annotations * * @param annotations the annotations */ protected void setupAnnotations(AnnotationValue[] annotations) { if (annotations != null && annotations.length > 0) { this.annotationsArray = annotations; annotationMap = new HashMap(); for (int i = 0; i < annotations.length; i++) { AnnotationInfo type = annotations[i].getAnnotationType(); annotationMap.put(type.getName(), annotations[i]); } } } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/0000755000175000017500000000000011620314126025625 5ustar twernertwernerlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/EnumValue.java0000644000175000017500000000244110374121703030374 0ustar twernertwerner/* * 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.reflect.spi; /** * An enumeration value * * @author Bill Burke * @author Adrian Brock */ public interface EnumValue extends Value { /** * Get the value * * @return the value */ String getValue(); } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/ParameterInfo.java0000644000175000017500000000265510374121703031236 0ustar twernertwerner/* * 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.reflect.spi; /** * Parameter info * * @author Bill Burke * @author Adrian Brock */ public interface ParameterInfo extends AnnotatedInfo { /** * Get the parameter name * * @return the parameter name */ String getName(); /** * Get the parameter type * * @return the parameter types */ TypeInfo getParameterType(); } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/AnnotationInfo.java0000644000175000017500000000312210374121703031416 0ustar twernertwerner/* * 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.reflect.spi; /** * Annotation Info * * @author Bill Burke * @author Adrian Brock */ public interface AnnotationInfo extends InterfaceInfo, ModifierInfo { /** * Get the name * * @return the name */ String getName(); /** * Get the attributes * * @return the attributes */ AnnotationAttribute[] getAttributes(); /** * Get an attribute * * @param name the name of the attribute * @return the attribute */ AnnotationAttribute getAttribute(String name); } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/ClassInfo.java0000644000175000017500000000716410653451352030371 0ustar twernertwerner/* * 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.reflect.spi; /** * Class info * * @author Bill Burke * @author Adrian Brock */ public interface ClassInfo extends AnnotatedInfo, ModifierInfo, TypeInfo { /** * Get the class name * * @return the name */ String getName(); /** * Whether it is an interface * * @return true when an interface */ boolean isInterface(); /** * Get the interfaces * * @return the interfaces */ InterfaceInfo[] getInterfaces(); /** * Get the generic interfaces * * @return the generic interfaces */ InterfaceInfo[] getGenericInterfaces(); /** * Get the declared method * * @param name the method name * @param parameters the parameters * @return the method info */ MethodInfo getDeclaredMethod(String name, TypeInfo[] parameters); /** * Get the declared methods * * @return the methods */ MethodInfo[] getDeclaredMethods(); /** * Get the declared field * * @param name the field name * @return the field */ FieldInfo getDeclaredField(String name); /** * Get the declared fields * * @return the fields */ FieldInfo[] getDeclaredFields(); /** * Get the declared constructors * * @return the constructors */ ConstructorInfo[] getDeclaredConstructors(); /** * Get a declared constructor * * @param parameters the parameters * @return the constructor */ ConstructorInfo getDeclaredConstructor(TypeInfo[] parameters); /** * Get the super class * * @return the super class */ ClassInfo getSuperclass(); /** * Get the generic super class * * @return the super class */ ClassInfo getGenericSuperclass(); /** * Get the actual type parameters * * @return the type parameters */ TypeInfo[] getActualTypeArguments(); /** * Get the raw type * * @return the raw type */ ClassInfo getRawType(); /** * Get the owner type * * @return the owner type */ TypeInfo getOwnerType(); /** * Get the component type if it is a collection or an array * * @return the component type */ TypeInfo getComponentType(); /** * Get the key type if it is a map * * @return the key type */ TypeInfo getKeyType(); /** * Get the value type if it is a map * * @return the value type */ TypeInfo getValueType(); /** * Get the package * * @return the package */ PackageInfo getPackage(); } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/ClassValue.java0000644000175000017500000000243110374121703030534 0ustar twernertwerner/* * 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.reflect.spi; /** * Class value * * @author Bill Burke * @author Adrian Brock */ public interface ClassValue extends Value { /** * Get the value * * @return the value */ String getValue(); } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/MethodInfo.java0000644000175000017500000000437710533536206030546 0ustar twernertwerner/* * 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.reflect.spi; /** * Method info * * @author Bill Burke * @author Adrian Brock */ public interface MethodInfo extends AnnotatedInfo, MemberInfo { /** No parameters */ public static final TypeInfo[] NO_PARAMS_TYPES = {}; /** No parameters */ public static final ParameterInfo[] NO_PARAMS = {}; /** No Exceptions */ public static final ClassInfo[] NO_EXCEPTIONS = {}; /** * Get the method name * * @return the method name */ String getName(); /** * Get the parameter types * * @return the parameter types */ TypeInfo[] getParameterTypes(); /** * Get the parameters * * @return the parameters */ ParameterInfo[] getParameters(); /** * Get the exception types * * @return the exception types */ ClassInfo[] getExceptionTypes(); /** * Get the return type * * @return the return type */ TypeInfo getReturnType(); /** * Invoke the method * * @param target the target * @param args the arguments * @return the result of the invocation * @throws Throwable for any error */ Object invoke(Object target, Object[] args) throws Throwable; } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/MethodInfoHashing.java0000644000175000017500000000654510331006762032042 0ustar twernertwerner/* * 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.reflect.spi; import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.security.DigestOutputStream; import java.security.MessageDigest; /** * Create a unique hash for MethodInfo * * @author Bill Burke * @version $Revision: 37459 $ */ public class MethodInfoHashing { public static long methodHash(MethodInfo method) throws Exception { TypeInfo[] parameterTypes = method.getParameterTypes(); String methodDesc = method.getName() + "("; for (int j = 0; j < parameterTypes.length; j++) { methodDesc += getTypeString(parameterTypes[j]); } methodDesc += ")" + getTypeString(method.getReturnType()); return createHash(methodDesc); } public static long createHash(String methodDesc) throws Exception { long hash = 0; ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream(512); MessageDigest messagedigest = MessageDigest.getInstance("SHA"); DataOutputStream dataoutputstream = new DataOutputStream(new DigestOutputStream(bytearrayoutputstream, messagedigest)); dataoutputstream.writeUTF(methodDesc); dataoutputstream.flush(); byte abyte0[] = messagedigest.digest(); for (int j = 0; j < Math.min(8, abyte0.length); j++) hash += (long) (abyte0[j] & 0xff) << j * 8; return hash; } static String getTypeString(TypeInfo cl) { if (cl == PrimitiveInfo.BYTE) { return "B"; } else if (cl == PrimitiveInfo.CHAR) { return "C"; } else if (cl == PrimitiveInfo.DOUBLE) { return "D"; } else if (cl == PrimitiveInfo.FLOAT) { return "F"; } else if (cl == PrimitiveInfo.INT) { return "I"; } else if (cl == PrimitiveInfo.LONG) { return "J"; } else if (cl == PrimitiveInfo.SHORT) { return "S"; } else if (cl == PrimitiveInfo.BOOLEAN) { return "Z"; } else if (cl == PrimitiveInfo.VOID) { return "V"; } else if (cl instanceof ArrayInfo) { ArrayInfo ai = (ArrayInfo) cl; return "[" + getTypeString(ai.getComponentType()); } else { return "L" + cl.getName().replace('.', '/') + ";"; } } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/DelegateClassInfo.java0000644000175000017500000002141611112776757032032 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.reflect.spi; import java.lang.annotation.Annotation; import org.jboss.util.JBossStringBuilder; /** * Delegate ClassInfo * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class DelegateClassInfo extends AbstractTypeInfo implements ClassInfo, InterfaceInfo { /** The serialVersionUID */ private static final long serialVersionUID = 6830276668550581673L; /** The delegate */ protected ClassInfo delegate; /** * Create delegate class info * * @param delegate the raw array info * @throws IllegalArgumentException for a null delegate */ public DelegateClassInfo(ClassInfo delegate) { this(delegate, false); } /** * Create delegate class info * * @param delegate the raw array info * @param allowNull whether to allow a null delegate */ public DelegateClassInfo(ClassInfo delegate, boolean allowNull) { if (delegate == null && allowNull == false) throw new IllegalArgumentException("Null delegate"); this.delegate = delegate; } /** * Whether the delegate is initialized * * @return true when there is a delegate */ public boolean isInitialized() { return (delegate != null); } /** * Set the delegate * * @param delegate the delegate * @throws IllegalArgumentException for a null delegate or it is not a ClassInfo */ public void setDelegate(TypeInfo delegate) { if (delegate == null) throw new IllegalArgumentException("Null delegate"); if (delegate instanceof ClassInfo == false) throw new IllegalArgumentException("Delegate is not a ClassInfo " + delegate.getClass().getName()); this.delegate = (ClassInfo) delegate; } /** * Set the delegate * * @param delegate the delegate * @throws IllegalArgumentException for a null delegate */ public void setDelegate(ClassInfo delegate) { if (delegate == null) throw new IllegalArgumentException("Null delegate"); this.delegate = delegate; } public TypeInfoFactory getTypeInfoFactory() { return delegate.getTypeInfoFactory(); } public ConstructorInfo getDeclaredConstructor(TypeInfo[] parameters) { return delegate.getDeclaredConstructor(parameters); } public ConstructorInfo[] getDeclaredConstructors() { return delegate.getDeclaredConstructors(); } public FieldInfo getDeclaredField(String name) { return delegate.getDeclaredField(name); } public FieldInfo[] getDeclaredFields() { return delegate.getDeclaredFields(); } public MethodInfo getDeclaredMethod(String name, TypeInfo[] parameters) { return delegate.getDeclaredMethod(name, parameters); } public MethodInfo[] getDeclaredMethods() { return delegate.getDeclaredMethods(); } public InterfaceInfo[] getGenericInterfaces() { return delegate.getGenericInterfaces(); } public ClassInfo getGenericSuperclass() { return delegate.getGenericSuperclass(); } public InterfaceInfo[] getInterfaces() { return delegate.getInterfaces(); } public String getName() { return delegate.getName(); } public String getSimpleName() { return delegate.getSimpleName(); } public ClassInfo getSuperclass() { return delegate.getSuperclass(); } public boolean isInterface() { return delegate.isInterface(); } public AnnotationValue getAnnotation(String name) { return delegate.getAnnotation(name); } public AnnotationValue[] getAnnotations() { return delegate.getAnnotations(); } public boolean isAnnotationPresent(String name) { return delegate.isAnnotationPresent(name); } public T getUnderlyingAnnotation(Class annotationType) { return delegate.getUnderlyingAnnotation(annotationType); } public Annotation[] getUnderlyingAnnotations() { return delegate.getUnderlyingAnnotations(); } public boolean isAnnotationPresent(Class annotationType) { return delegate.isAnnotationPresent(annotationType); } public int getModifiers() { return delegate.getModifiers(); } public boolean isPublic() { return delegate.isPublic(); } public boolean isStatic() { return delegate.isStatic(); } public boolean isVolatile() { return delegate.isVolatile(); } public Object convertValue(Object value) throws Throwable { return delegate.convertValue(value); } public Object convertValue(Object value, boolean replaceProperties) throws Throwable { return delegate.convertValue(value, replaceProperties); } public Object convertValue(Object value, boolean replaceProperties, boolean trim) throws Throwable { return delegate.convertValue(value, replaceProperties, trim); } public TypeInfo getArrayType() { return delegate.getArrayType(); } @Deprecated public Class getType() { return delegate.getType(); } public boolean isAnnotation() { return delegate.isAnnotation(); } public boolean isCollection() { return delegate.isCollection(); } public boolean isMap() { return delegate.isMap(); } @Override public boolean isArray() { return delegate.isArray(); } @Override public boolean isEnum() { return delegate.isEnum(); } @Override public boolean isPrimitive() { return delegate.isPrimitive(); } public Object newArrayInstance(int size) throws Throwable { return delegate.newArrayInstance(size); } public boolean isAssignableFrom(TypeInfo info) { return delegate.isAssignableFrom(info); } public boolean isInstance(Object object) { return delegate.isInstance(object); } public TypeInfo[] getActualTypeArguments() { return delegate.getActualTypeArguments(); } public TypeInfo getOwnerType() { return delegate.getOwnerType(); } public ClassInfo getRawType() { return delegate.getRawType(); } public TypeInfo getComponentType() { return delegate.getComponentType(); } public TypeInfo getKeyType() { return delegate.getKeyType(); } public TypeInfo getValueType() { return delegate.getValueType(); } public PackageInfo getPackage() { return delegate.getPackage(); } @Override protected int getHashCode() { return delegate.hashCode(); } @Override public boolean equals(Object obj) { if (obj == this) return true; if (obj == null || obj instanceof ClassInfo == false) return false; ClassInfo other = (ClassInfo) obj; ClassInfo otherDelegate = other; if (other instanceof DelegateClassInfo) otherDelegate = ((DelegateClassInfo) other).delegate; if (delegate.equals(otherDelegate) == false) return false; // We are equal to the raw type (seems hacky?) if (other instanceof DelegateClassInfo == false) return true; TypeInfo[] typeArguments = getActualTypeArguments(); TypeInfo[] otherTypeArguments = other.getActualTypeArguments(); if (typeArguments.length != otherTypeArguments.length) return false; for (int i = 0; i < typeArguments.length; ++i) { if (typeArguments[i].equals(otherTypeArguments[i]) == false) return false; } return true; } @Override public void toShortString(JBossStringBuilder buffer) { delegate.toShortString(buffer); } @Override protected void toString(JBossStringBuilder buffer) { delegate.toShortString(buffer); } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/AnnotationAttribute.java0000644000175000017500000000301210374121703032464 0ustar twernertwerner/* * 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.reflect.spi; /** * An annotation attribute * * @author Bill Burke * @author Adrian Brock */ public interface AnnotationAttribute { /** * Get the attribute name * * @return the attribute name */ String getName(); /** * Get the attribute type * * @return the attribute type */ TypeInfo getType(); /** * Get the default value * * @return the default value */ Value getDefaultValue(); } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/StringValue.java0000644000175000017500000000243510374121703030741 0ustar twernertwerner/* * 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.reflect.spi; /** * A string value * * @author Bill Burke * @author Adrian Brock */ public interface StringValue extends Value { /** * Get the value * * @return the value */ String getValue(); } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/package.html0000644000175000017500000000147310271236104030113 0ustar twernertwerner

Extended Reflection API.

Package Specification

Related Documentation

Package Status

  • ALPHA

Todo

  • ???
libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/ArrayValue.java0000644000175000017500000000243610374121703030552 0ustar twernertwerner/* * 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.reflect.spi; /** * Array value * * @author Bill Burke * @author Adrian Brock */ public interface ArrayValue extends Value { /** * Get the values * * @return the values */ Value[] getValues(); } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/PackageInfo.java0000644000175000017500000000241110560664062030646 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2007, 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.reflect.spi; /** * Package info * * @author Adrian Brock */ public interface PackageInfo extends AnnotatedInfo { /** * Get the package name * * @return the name */ String getName(); // TODO other stuff } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/AnnotationValue.java0000644000175000017500000000402710560156111031602 0ustar twernertwerner/* * 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.reflect.spi; import java.lang.annotation.Annotation; import java.util.Map; /** * An annotation value * * @author Bill Burke * @author Adrian Brock */ public interface AnnotationValue extends Value { /** * Get the annotation type * * @return the annotation type */ AnnotationInfo getAnnotationType(); /** * Get an attribute value * * @param attributeName the attribute name * @return the value */ Value getValue(String attributeName); /** * Get the values * * @return the values */ Map getValues(); /** * Get the underlying annotation * * @return the annotation */ Annotation getUnderlyingAnnotation(); /** * Get the underlying annotation * * @param the annotation type * @param annotationType the annotationType * @return the annotation */ T getUnderlyingAnnotation(Class annotationType); } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/ProgressionConvertor.java0000644000175000017500000000360110633522720032710 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.reflect.spi; /** * JBMICROCONT-119 issue * Support integer progression, e.g. float -> int or Float -> Integer and vice versa * * @author Ales Justin */ public interface ProgressionConvertor { /** * Check if progression is supported. * * @param target target's class * @param source source's class * @return true, if we can progress source's value class type to target class */ boolean canProgress(Class target, Class source); /** * Do the actual progression. * * @param target class type * @param value to progress * @return progressed value - it's class type now equals to target * @throws Throwable for any error */ Object doProgression(Class target, Object value) throws Throwable; } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/MemberInfo.java0000644000175000017500000000250110374121703030513 0ustar twernertwerner/* * 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.reflect.spi; /** * Member info * * @author Bill Burke * @author Adrian Brock */ public interface MemberInfo extends ModifierInfo { /** * Get the declaring class * * @return the declaring class */ ClassInfo getDeclaringClass(); } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/PrimitiveInfo.java0000644000175000017500000002374211112776757031306 0ustar twernertwerner/* * 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.reflect.spi; import java.io.ObjectStreamException; import java.util.HashMap; import org.jboss.reflect.plugins.ClassInfoImpl; import org.jboss.reflect.plugins.ValueConvertor; import org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactory; /** * Primitive info * * TODO JBMICROCONT-118 fix the introspection assumption * @author Bill Burke * @author Adrian Brock */ public class PrimitiveInfo extends AbstractTypeInfo { /** serialVersionUID */ private static final long serialVersionUID = 3256718498443835449L; /** The boolean info */ public static final PrimitiveInfo BOOLEAN = new PrimitiveInfo("boolean", 0, Boolean.TYPE); /** The byte info */ public static final PrimitiveInfo BYTE = new PrimitiveInfo("byte", 1, Byte.TYPE); /** The char info */ public static final PrimitiveInfo CHAR = new PrimitiveInfo("char", 2, Character.TYPE); /** The double info */ public static final PrimitiveInfo DOUBLE = new PrimitiveInfo("double", 3, Double.TYPE); /** The float info */ public static final PrimitiveInfo FLOAT = new PrimitiveInfo("float", 4, Float.TYPE); /** The int info */ public static final PrimitiveInfo INT = new PrimitiveInfo("int", 5, Integer.TYPE); /** The long info */ public static final PrimitiveInfo LONG = new PrimitiveInfo("long", 6, Long.TYPE); /** The short info */ public static final PrimitiveInfo SHORT = new PrimitiveInfo("short", 7, Short.TYPE); /** The void info */ public static final PrimitiveInfo VOID = new PrimitiveInfo("void", 8, Void.TYPE); /** The primitives */ private static final PrimitiveInfo[] values = {BOOLEAN, BYTE, CHAR, DOUBLE, FLOAT, INT, LONG, SHORT, VOID}; /** The type info factory */ protected static final TypeInfoFactory typeInfoFactory = new IntrospectionTypeInfoFactory(); /** The name */ protected final transient String name; /** The ordinal */ protected final int ordinal; /** The type */ protected final transient Class type; /** The primitive types indexed by name */ private static final HashMap> primitiveTypes = new HashMap>(); /** The primitive array types indexed by name */ private static final HashMap primitiveArrayTypes = new HashMap(); /** The primitive array classes indexed by name */ private static final HashMap> primitiveArrayTypesClassMap = new HashMap>(); /** The primitives */ private static final HashMap map = new HashMap(); static { map.put("boolean", BOOLEAN); map.put("byte", BYTE); map.put("char", CHAR); map.put("double", DOUBLE); map.put("float", FLOAT); map.put("int", INT); map.put("long", LONG); map.put("short", SHORT); map.put("void", VOID); primitiveTypes.put(Byte.TYPE.getName(), Byte.TYPE); primitiveTypes.put(Boolean.TYPE.getName(), Boolean.TYPE); primitiveTypes.put(Character.TYPE.getName(), Character.TYPE); primitiveTypes.put(Double.TYPE.getName(), Double.TYPE); primitiveTypes.put(Float.TYPE.getName(), Float.TYPE); primitiveTypes.put(Integer.TYPE.getName(), Integer.TYPE); primitiveTypes.put(Long.TYPE.getName(), Long.TYPE); primitiveTypes.put(Short.TYPE.getName(), Short.TYPE); primitiveArrayTypes.put(Byte.TYPE.getName(), "B"); primitiveArrayTypes.put(Boolean.TYPE.getName(), "Z"); primitiveArrayTypes.put(Character.TYPE.getName(), "C"); primitiveArrayTypes.put(Double.TYPE.getName(), "D"); primitiveArrayTypes.put(Float.TYPE.getName(), "F"); primitiveArrayTypes.put(Integer.TYPE.getName(), "I"); primitiveArrayTypes.put(Long.TYPE.getName(), "J"); primitiveArrayTypes.put(Short.TYPE.getName(), "S"); primitiveArrayTypesClassMap.put("B", Byte.TYPE); primitiveArrayTypesClassMap.put("Z", Boolean.TYPE); primitiveArrayTypesClassMap.put("C", Character.TYPE); primitiveArrayTypesClassMap.put("D", Double.TYPE); primitiveArrayTypesClassMap.put("F", Float.TYPE); primitiveArrayTypesClassMap.put("I", Integer.TYPE); primitiveArrayTypesClassMap.put("J", Long.TYPE); primitiveArrayTypesClassMap.put("S", Short.TYPE); } /** * Get the primitive info for a type * * @param name the name * @return the info */ public static PrimitiveInfo valueOf(String name) { return map.get(name); } /** * Get a primtive array type * * @param name the primtive type name * @return the array type or null if not found */ public static String getPrimativeArrayType(String name) { return primitiveArrayTypes.get(name); } /** * Get the primtive type for a name * * @param name the primtive type name * @return the primitive type */ public static Class getPrimativeType(String name) { return primitiveTypes.get(name); } /** * Get the primtive array type class map for a name * * @param name the array type name * @return the component type */ public static Class getPrimativeArrayComponentType(String name) { return primitiveArrayTypesClassMap.get(name); } /** * Create a new primitive info * * @param name the name * @param ordinal the oridinal * @param type the class */ protected PrimitiveInfo(String name, int ordinal, Class type) { this.name = name; this.ordinal = ordinal; this.type = type; } /** * Get the ordinal * * @return the oridinal */ public int ordinal() { return ordinal; } public String getName() { return name; } public String getSimpleName() { return type.getSimpleName(); } @Deprecated public Class getType() { return type; } public Object convertValue(Object value) throws Throwable { Object progressResult = ValueConvertor.progressValue(type, value); if (progressResult != null) { return progressResult; } return ValueConvertor.convertValue(type, value); } public Object convertValue(Object value, boolean replaceProperties) throws Throwable { Object progressResult = ValueConvertor.progressValue(type, value); if (progressResult != null) { return progressResult; } return ValueConvertor.convertValue(type, value, replaceProperties); } public Object convertValue(Object value, boolean replaceProperties, boolean trim) throws Throwable { Object progressResult = ValueConvertor.progressValue(type, value); if (progressResult != null) { return progressResult; } return ValueConvertor.convertValue(type, value, replaceProperties, trim); } @Override public boolean isPrimitive() { return true; } public TypeInfo getArrayType() { Class arrayClass = ClassInfoImpl.getArrayClass(getType()); return typeInfoFactory.getTypeInfo(arrayClass); } public Object newArrayInstance(int size) throws Throwable { throw new UnsupportedOperationException("Not an array " + name); } @SuppressWarnings({"unchecked", "deprecation"}) public boolean isAssignableFrom(TypeInfo info) { if (info == null) throw new NullPointerException("Parameter info cannot be null!"); if (info == this) return true; return canProgress(info.getType()); } @SuppressWarnings("deprecation") public boolean isInstance(Object object) { return object != null && canProgress(object.getClass()); } /** * Can we progress class param to this type info. * * @param clazz the class to progress * @return true if we can progress, false otherwise */ protected boolean canProgress(Class clazz) { try { ProgressionConvertor pc = ProgressionConvertorFactory.getInstance().getConvertor(); return pc.canProgress(getType(), clazz); } catch (Throwable throwable) { return false; } } public TypeInfoFactory getTypeInfoFactory() { // FIXME - fix this once you fix the top TODO return typeInfoFactory; } @Override public String toString() { return name; } @Override public String toShortString() { return name; } @Override public boolean equals(Object obj) { if (obj == this) return true; if (obj == null) return false; if (!(obj instanceof PrimitiveInfo)) return false; if (!obj.getClass().equals(this.getClass())) return false; PrimitiveInfo other = (PrimitiveInfo) obj; return other.ordinal == this.ordinal; } @Override public int hashCode() { return name.hashCode(); } Object readResolve() throws ObjectStreamException { return values[ordinal]; } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/InterfaceInfo.java0000644000175000017500000000231410374121703031206 0ustar twernertwerner/* * 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.reflect.spi; /** * Interface info * * @author Bill Burke * @author Adrian Brock */ public interface InterfaceInfo extends ClassInfo { } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/NumberInfo.java0000644000175000017500000002111011112776757030551 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.reflect.spi; import java.io.ObjectStreamException; import java.lang.annotation.Annotation; import java.util.HashMap; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; import org.jboss.util.JBossStringBuilder; /** * Number info * * @author Ales Justin */ public class NumberInfo extends PrimitiveInfo implements ClassInfo { /** * The phase enum */ public enum Phase { INSTANTIATED, INITIALIZING, COMPLETE } /** serialVersionUID */ private static final long serialVersionUID = 1L; /** The byte info */ public static final NumberInfo BYTE_OBJECT = new NumberInfo(0, Byte.class); /** The double info */ public static final NumberInfo DOUBLE_OBJECT = new NumberInfo(1, Double.class); /** The float info */ public static final NumberInfo FLOAT_OBJECT = new NumberInfo(2, Float.class); /** The int info */ public static final NumberInfo INT_OBJECT = new NumberInfo(3, Integer.class); /** The long info */ public static final NumberInfo LONG_OBJECT = new NumberInfo(4, Long.class); /** The short info */ public static final NumberInfo SHORT_OBJECT = new NumberInfo(5, Short.class); /** The atomic int info */ public static final NumberInfo ATOMIC_INT = new NumberInfo(6, AtomicInteger.class); /** The atomic long info */ public static final NumberInfo ATOMIC_LONG = new NumberInfo(7, AtomicLong.class); /** The primitives */ private static final NumberInfo[] values = { BYTE_OBJECT, DOUBLE_OBJECT, FLOAT_OBJECT, INT_OBJECT, LONG_OBJECT, SHORT_OBJECT, ATOMIC_INT, ATOMIC_LONG }; /** The primitives */ private static final HashMap map = new HashMap(); static { map.put(Byte.class.getName(), NumberInfo.BYTE_OBJECT); map.put(Double.class.getName(), NumberInfo.DOUBLE_OBJECT); map.put(Float.class.getName(), NumberInfo.FLOAT_OBJECT); map.put(Integer.class.getName(), NumberInfo.INT_OBJECT); map.put(Long.class.getName(), NumberInfo.LONG_OBJECT); map.put(Short.class.getName(), NumberInfo.SHORT_OBJECT); map.put(AtomicInteger.class.getName(), NumberInfo.ATOMIC_INT); map.put(AtomicLong.class.getName(), NumberInfo.ATOMIC_LONG); } private transient ClassInfo delegate; private transient Phase phase; /** * Get the primitive info for a type * * @param name the name * @return the info */ public static NumberInfo valueOf(String name) { return map.get(name); } /** * Create a new number info * * @param ordinal the oridinal * @param type the class */ protected NumberInfo(int ordinal, Class type) { super(type.getName(), ordinal, type); phase = Phase.INSTANTIATED; } /** * Set the delegate * * @param info the delegate info * @throws IllegalArgumentException if the delegate is null or not a class info */ public void setDelegate(TypeInfo info) { if (info == null) throw new IllegalArgumentException("Null info"); if (info instanceof ClassInfo == false) throw new IllegalArgumentException("Should be of ClassInfo instance: " + info.getClass().getName()); if (info instanceof NumberInfo) throw new IllegalArgumentException("Cannot be delegate to itself: " + info); delegate = (ClassInfo) info; phase = Phase.COMPLETE; } /** * Get the phase. * * @return the current phase */ public Phase getPhase() { return phase; } /** * Are we currently initializing delegate. */ public void initializing() { phase = Phase.INITIALIZING; } @Override public boolean equals(Object obj) { if (obj == this) return true; if (obj == null) return false; if (!(obj instanceof NumberInfo)) return false; NumberInfo other = (NumberInfo) obj; return other.ordinal == this.ordinal; } Object readResolve() throws ObjectStreamException { return values[ordinal]; } // --- delegate public ConstructorInfo getDeclaredConstructor(TypeInfo[] parameters) { return delegate.getDeclaredConstructor(parameters); } public ConstructorInfo[] getDeclaredConstructors() { return delegate.getDeclaredConstructors(); } public FieldInfo getDeclaredField(String name) { return delegate.getDeclaredField(name); } public FieldInfo[] getDeclaredFields() { return delegate.getDeclaredFields(); } public MethodInfo getDeclaredMethod(String name, TypeInfo[] parameters) { return delegate.getDeclaredMethod(name, parameters); } public MethodInfo[] getDeclaredMethods() { return delegate.getDeclaredMethods(); } public InterfaceInfo[] getGenericInterfaces() { return delegate.getGenericInterfaces(); } public ClassInfo getGenericSuperclass() { return delegate.getGenericSuperclass(); } public InterfaceInfo[] getInterfaces() { return delegate.getInterfaces(); } public ClassInfo getSuperclass() { return delegate.getSuperclass(); } public boolean isInterface() { return delegate.isInterface(); } public AnnotationValue getAnnotation(String name) { return delegate.getAnnotation(name); } public AnnotationValue[] getAnnotations() { return delegate.getAnnotations(); } public boolean isAnnotationPresent(String name) { return delegate.isAnnotationPresent(name); } public T getUnderlyingAnnotation(Class annotationType) { return delegate.getUnderlyingAnnotation(annotationType); } public Annotation[] getUnderlyingAnnotations() { return delegate.getUnderlyingAnnotations(); } public boolean isAnnotationPresent(Class annotationType) { return delegate.isAnnotationPresent(annotationType); } public int getModifiers() { return delegate.getModifiers(); } public boolean isPublic() { return delegate.isPublic(); } public boolean isStatic() { return delegate.isStatic(); } public boolean isVolatile() { return delegate.isVolatile(); } public boolean isPrimitive() { return delegate.isPrimitive(); } public TypeInfo[] getActualTypeArguments() { return delegate.getActualTypeArguments(); } public TypeInfo getOwnerType() { return delegate.getOwnerType(); } public ClassInfo getRawType() { return delegate; } public TypeInfo getComponentType() { return delegate.getComponentType(); } public TypeInfo getKeyType() { return delegate.getKeyType(); } public TypeInfo getValueType() { return delegate.getValueType(); } public PackageInfo getPackage() { return delegate.getPackage(); } @Override public Object clone() { return this; } public void toShortString(JBossStringBuilder buffer) { buffer.append(name); } @Override protected void toString(JBossStringBuilder buffer) { buffer.append(name); } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/ProgressionConvertorFactory.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/ProgressionConvertorFactory.0000644000175000017500000000611010617675431033406 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.reflect.spi; import java.security.AccessController; import java.security.PrivilegedExceptionAction; import org.jboss.reflect.plugins.SimpleProgressionConvertor; import org.jboss.reflect.plugins.introspection.ReflectionUtils; /** * Singleton progression instance factory. * We can change the progression convertor with system property * or setting the convertor class name at the singleton factory instance. * This way we can still change the convertor at runtime before actual usage - * in MC beans definition or other IoC - via XML. * * @author Ales Justin */ public class ProgressionConvertorFactory { private static ProgressionConvertorFactory instance = new ProgressionConvertorFactory(); private String convertorClassName = SimpleProgressionConvertor.class.getName(); private ProgressionConvertor convertor; public static ProgressionConvertorFactory getInstance() { return instance; } public ProgressionConvertor getConvertor() throws Throwable { // TODO - some more config options; by deployment, app, server, cluster, ... if (convertor == null) { ConvertorLookup lookup = new ConvertorLookup(); convertor = AccessController.doPrivileged(lookup); } return convertor; } public void setConvertorClassName(String convertorClassName) { this.convertorClassName = convertorClassName; } private class ConvertorLookup implements PrivilegedExceptionAction { public ProgressionConvertor run() throws Exception { try { String convertorClass = System.getProperty("org.jboss.reflect.plugins.progressionConvertor", convertorClassName); Object result = ReflectionUtils.newInstance(convertorClass); return ProgressionConvertor.class.cast(result); } catch (Throwable t) { throw new Exception("Exception while creating convertor instance.", t); } } } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/PrimitiveValue.java0000644000175000017500000000473010560156111031441 0ustar twernertwerner/* * 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.reflect.spi; /** * A primitive value * * @author Bill Burke * @author Adrian Brock */ public class PrimitiveValue extends AbstractValue { /** serialVersionUID */ private static final long serialVersionUID = 3907214866304741945L; /** The value */ protected String value; /** The type */ protected PrimitiveInfo type; /** * Create a primitive value */ public PrimitiveValue() { } /** * Create a primitive value * * @param value the value * @param type the type */ public PrimitiveValue(String value, PrimitiveInfo type) { this.value = value; this.type = type; } @Override public boolean isPrimitive() { return true; } /** * Get the value * * @return the value */ public String getValue() { return value; } public TypeInfo getType() { return type; } public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof PrimitiveValue)) return false; final PrimitiveValue primitiveValue = (PrimitiveValue) o; if (!type.equals(primitiveValue.type)) return false; if (!value.equals(primitiveValue.value)) return false; return true; } public int hashCode() { int result; result = (value != null) ? value.hashCode() : 0; result = 29 * result + type.hashCode(); return result; } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/ArrayInfo.java0000644000175000017500000000247610374121703030375 0ustar twernertwerner/* * 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.reflect.spi; /** * Array information * * @author Bill Burke * @author Adrian Brock */ public interface ArrayInfo extends ClassInfo { /** * Get the component type * * @return the component type */ TypeInfo getComponentType(); } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/ModifierInfo.java0000644000175000017500000000614510711405721031052 0ustar twernertwerner/* * 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.reflect.spi; import java.lang.reflect.Modifier; /** * Modifier info * * @author Adrian Brock */ public interface ModifierInfo { /** Final */ public static final int FINAL = Modifier.FINAL; /** Static */ public static final int STATIC = Modifier.STATIC; /** Abstract */ public static final int ABSTRACT = Modifier.ABSTRACT; /** Public */ public static final int PUBLIC = Modifier.PUBLIC; /** Protected */ public static final int PROTECTED = Modifier.PROTECTED; /** Package */ public static final int PACKAGE = 0; /** Private */ public static final int PRIVATE = Modifier.PRIVATE; /** A constant */ public static final int CONSTANT = STATIC + FINAL; /** A public constant */ public static final int PUBLIC_CONSTANT = PUBLIC + CONSTANT; /** A protected constant */ public static final int PROTECTED_CONSTANT = PROTECTED + CONSTANT; /** A package constant */ public static final int PACKAGE_CONSTANT = CONSTANT; /** A private constant */ public static final int PRIVATE_CONSTANT = PRIVATE + CONSTANT; /** Public Static */ public static final int PUBLIC_STATIC = PUBLIC + STATIC; /** Protected Static */ public static final int PROTECTED_STATIC = PROTECTED + STATIC; /** Package Static */ public static final int PACKAGE_STATIC = STATIC; /** Private Static */ public static final int PRIVATE_STATIC = PRIVATE + STATIC; /** Public Abstract */ public static final int PUBLIC_ABSTRACT = PUBLIC + ABSTRACT; /** Protected Abstract */ public static final int PROTECTED_ABSTRACT = PROTECTED + ABSTRACT; /** Package Abstract */ public static final int PACKAGE_ABSTRACT = ABSTRACT; /** * Get the modifiers * * @return the modifiers */ int getModifiers(); /** * Whether it is public * * @return true when public */ boolean isPublic(); /** * Whether it is static * * @return true when static */ boolean isStatic(); /** * Whether it is volatile * * @return true if volatile */ boolean isVolatile(); } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/AbstractTypeInfo.java0000644000175000017500000000545410560404111031715 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2007, 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.reflect.spi; import org.jboss.reflect.plugins.TypeInfoAttachments; import org.jboss.util.JBossObject; /** * AbstractTypeInfo. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public abstract class AbstractTypeInfo extends JBossObject implements TypeInfo { /** The attachments */ private transient TypeInfoAttachments attachments; public boolean isArray() { return false; } public boolean isCollection() { return false; } public boolean isMap() { return false; } public boolean isAnnotation() { return false; } public boolean isEnum() { return false; } public boolean isPrimitive() { return false; } public void setAttachment(String name, Object attachment) { if (name == null) throw new IllegalArgumentException("Null name"); synchronized (this) { if (attachments == null) { if (attachment == null) return; attachments = new TypeInfoAttachments();; } } if (attachment == null) attachments.removeAttachment(name); else attachments.addAttachment(name, attachment); } public T getAttachment(Class expectedType) { if (expectedType == null) throw new IllegalArgumentException("Null expectedType"); Object result = getAttachment(expectedType.getName()); if (result == null) return null; return expectedType.cast(result); } public Object getAttachment(String name) { if (name == null) throw new IllegalArgumentException("Null name"); synchronized (this) { if (attachments == null) return null; } return attachments.getAttachment(name); } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/EnumInfo.java0000644000175000017500000000314510560664062030224 0ustar twernertwerner/* * 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.reflect.spi; /** * Enumeration info * * @author Bill Burke * @author Adrian Brock */ public interface EnumInfo extends ClassInfo { /** * Get the constants * * @return the constants */ EnumConstantInfo[] getEnumConstants(); /** * Get a constant * * @param name the name * @return the constant */ EnumConstantInfo getEnumConstant(String name); /** * Get the enum value for a constant * * @param name the name * @return the value */ Object getEnumValue(String name); } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/EnumConstantInfo.java0000644000175000017500000000277410560664062031745 0ustar twernertwerner/* * 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.reflect.spi; /** * An enumeration constant * * @author Bill Burke * @author Adrian Brock */ public interface EnumConstantInfo extends AnnotatedInfo { /** * Get the name * * @return the name */ String getName(); /** * Get the value * * @return the value */ Object getValue(); /** * Get the declaring enumeration * * @return the enumeration */ EnumInfo getDeclaring(); } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/FieldInfo.java0000644000175000017500000000351610533536206030343 0ustar twernertwerner/* * 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.reflect.spi; /** * A field info * * @author Bill Burke * @author Adrian Brock */ public interface FieldInfo extends AnnotatedInfo, MemberInfo { /** * Get the name * * @return the field name */ String getName(); /** * Get the field type * * @return the field type */ TypeInfo getType(); /** * Get the value of the field * * @param target the target * @return the field value * @throws Throwable for any error */ Object get(Object target) throws Throwable; /** * Set the value of the field * * @param target the target * @param value the value * @return null * @throws Throwable for any error */ Object set(Object target, Object value) throws Throwable; } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/TypeInfoFactory.java0000644000175000017500000000333210756326650031574 0ustar twernertwerner/* * 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.reflect.spi; import java.lang.reflect.Type; /** * A type info factory. * * @author Adrian Brock */ public interface TypeInfoFactory { /** * Get a type info * * @param name the class name * @param cl the classloader * @return the type info * @throws ClassNotFoundException when there is no such class */ TypeInfo getTypeInfo(String name, ClassLoader cl) throws ClassNotFoundException; /** * Get a type info * * @param clazz the class * @return the type info */ TypeInfo getTypeInfo(Class clazz); /** * Get a type info * * @param type the type * @return the type info */ TypeInfo getTypeInfo(Type type); } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/AbstractValue.java0000644000175000017500000000516110560156111031233 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.reflect.spi; import java.io.Serializable; import org.jboss.util.JBossObject; /** * AbstractValue. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public abstract class AbstractValue extends JBossObject implements Value, Serializable { public AnnotationValue asAnnotation() { if (isAnnotation() == false) throw new IllegalStateException("Not an annotation"); return (AnnotationValue) this; } public ArrayValue asArray() { if (isArray() == false) throw new IllegalStateException("Not an array"); return (ArrayValue) this; } public ClassValue asClass() { if (isClass() == false) throw new IllegalStateException("Not a class"); return (ClassValue) this; } public EnumValue asEnum() { if (isEnum() == false) throw new IllegalStateException("Not an enum"); return (EnumValue) this; } public PrimitiveValue asPrimitive() { if (isPrimitive() == false) throw new IllegalStateException("Not a primitive"); return (PrimitiveValue) this; } public StringValue asString() { if (isString() == false) throw new IllegalStateException("Not a string"); return (StringValue) this; } public boolean isAnnotation() { return false; } public boolean isArray() { return false; } public boolean isClass() { return false; } public boolean isEnum() { return false; } public boolean isPrimitive() { return false; } public boolean isString() { return false; } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/TypeInfo.java0000644000175000017500000001257611112776757030262 0ustar twernertwerner/* * 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.reflect.spi; import java.io.Serializable; /** * A type info * * @author Bill Burke * @author Adrian Brock */ public interface TypeInfo extends Serializable { /** * Get the type name * * @return the name */ String getName(); /** * Get the simple name * * @return the simple name */ String getSimpleName(); /** * Get the class * * @deprecated I'm not sure this should be here? * @return the class */ Class getType(); /** * Convert a value * * @param value the original value * @return the converted value * @throws Throwable for any error */ Object convertValue(Object value) throws Throwable; /** * Convert a value * * @param value the original value * @param replaceProperties whether to replace properties * @return the converted value * @throws Throwable for any error */ Object convertValue(Object value, boolean replaceProperties) throws Throwable; /** * Convert a value * * @param value the original value * @param replaceProperties whether to replace properties * @param trim do we trim before conversion * @return the converted value * @throws Throwable for any error */ Object convertValue(Object value, boolean replaceProperties, boolean trim) throws Throwable; /** * Whether this type is an array * * @return true when an array */ boolean isArray(); /** * Whether this type is a collection * * @return true when a collection */ boolean isCollection(); /** * Whether this type is a map * * @return true when a map */ boolean isMap(); /** * Whether this type is an annotation * * @return true when an annotation */ boolean isAnnotation(); /** * Whether this type is an enum * * @return true when an enum */ boolean isEnum(); /** * Whether this type is a primitive * * @return true when a primtive */ boolean isPrimitive(); /** * Get an array type * * @return the array type */ TypeInfo getArrayType(); /** * Create a new array * * @param size the size * @return the converted value * @throws Throwable for any error */ Object newArrayInstance(int size) throws Throwable; /** * Mostly using * @see java.lang.Class#isAssignableFrom * PrimitiveInfo tests for progression * * @param info type info * @return the boolean value indicating whether objects of the * TypeInfo info can be assigned to objects of this TypeInfo * @exception NullPointerException if the specified TypeInfo parameter is * null. */ boolean isAssignableFrom(TypeInfo info); /** * Is object instance of this type info. * @see Class#isInstance(Object) * PrimitiveInfo tests for progression * * @param object the object to check * @return true if object is an instance of this class */ boolean isInstance(Object object); /** * Get the TypeInfoFactory that created this type info * * @return type info factory */ TypeInfoFactory getTypeInfoFactory(); /** * Get an attachment from the type * * @param name the name * @return the attachment */ Object getAttachment(String name); /** * Get an attachment from the type, * uses the expected type as both the name * and to cast the resulting object. * * @param the expected type * @param expectedType the expected type * @return the attachment * @throws ClassCastException when the object is not of the expected type */ T getAttachment(Class expectedType); /** * Set an attachment against the type. * This is useful for caching information against a type.

* * If you add a future object, subsequent gets will wait for the result

* * WARNING: Be careful about what you put in here. Don't create * references across classloaders, if you are not sure add a WeakReference * to the information. * * @param name the name * @param attachment the attachment, pass null to remove an attachment * @throws IllegalArgumentException for a null name */ void setAttachment(String name, Object attachment); } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/Value.java0000644000175000017500000000556410560156111027556 0ustar twernertwerner/* * 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.reflect.spi; /** * A value * * @author Bill Burke */ public interface Value { /** * Get the type of the value * * @return the type */ TypeInfo getType(); /** * Is this value a primitive * * @return true when a primitive */ boolean isPrimitive(); /** * Get the value as a primitive * * @return the value * @throws IllegalStateException when not a primitive value */ PrimitiveValue asPrimitive(); /** * Is this value a class * * @return true when a class */ boolean isClass(); /** * Get the value as a class * * @return the value * @throws IllegalStateException when not a class value */ ClassValue asClass(); /** * Is this value a string * * @return true when a string */ boolean isString(); /** * Get the value as a string * * @return the value * @throws IllegalStateException when not a string value */ StringValue asString(); /** * Is this value an enum * * @return true when an enum */ boolean isEnum(); /** * Get the value as an enum * * @return the value * @throws IllegalStateException when not an enum */ EnumValue asEnum(); /** * Is this value an annotation * * @return true when an annotation */ boolean isAnnotation(); /** * Get the value as an annotation * * @return the value * @throws IllegalStateException when not an annotation value */ AnnotationValue asAnnotation(); /** * Is this value an array * * @return true when an array */ boolean isArray(); /** * Get the value as an annotation * * @return the value * @throws IllegalStateException when not an array value */ ArrayValue asArray(); } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/AnnotatedInfo.java0000644000175000017500000000451210560156111031223 0ustar twernertwerner/* * 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.reflect.spi; import java.lang.annotation.Annotation; import org.jboss.util.JBossInterface; /** * Annotated info * * @author Bill Burke * @author Adrian Brock */ public interface AnnotatedInfo extends JBossInterface { /** * Get the annotations * * @return the annotations */ AnnotationValue[] getAnnotations(); /** * Get an annotation * * @param name the name * @return the annotation */ AnnotationValue getAnnotation(String name); /** * Test whether an annotation is present * * @param name the name * @return true when the annotation is present */ boolean isAnnotationPresent(String name); /** * Get the underlying annotations * * @return the annotations */ Annotation[] getUnderlyingAnnotations(); /** * Get an underlying annotation * * @param the annotation type * @param annotationType the annotationType * @return the annotation */ T getUnderlyingAnnotation(Class annotationType); /** * Test whether an annotation is present * * @param annotationType * @return true when the annotation is present */ boolean isAnnotationPresent(Class annotationType); } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/reflect/spi/ConstructorInfo.java0000644000175000017500000000342010533536206031637 0ustar twernertwerner/* * 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.reflect.spi; /** * Constructor info * * @author Bill Burke * @author Adrian Brock */ public interface ConstructorInfo extends AnnotatedInfo, MemberInfo { /** * Get the parameter types * * @return the parameters types */ TypeInfo[] getParameterTypes(); /** * Get the parameters * * @return the parameters */ ParameterInfo[] getParameters(); /** * Get the exception types * * @return the exception types */ ClassInfo[] getExceptionTypes(); /** * Create a new instance * * @param args the arguments * @return the instance * @throws Throwable for any error */ Object newInstance(Object[] args) throws Throwable; } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/0000755000175000017500000000000011620314126024476 5ustar twernertwernerlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/0000755000175000017500000000000011620314126025431 5ustar twernertwernerlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/plugins/0000755000175000017500000000000011620314126027112 5ustar twernertwerner././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/plugins/DefaultPropertyInfo.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/plugins/DefaultPropertyInfo.j0000644000175000017500000001126410767032015033243 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beans.info.plugins; import org.jboss.reflect.spi.AnnotationValue; import org.jboss.reflect.spi.MethodInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.util.JBossStringBuilder; /** * Default property info. * * @author Ales Justin */ public class DefaultPropertyInfo extends AbstractPropertyInfo { /** The serialVersionUID */ private static final long serialVersionUID = 1; /** The getter */ private MethodInfo getter; /** The setter */ private MethodInfo setter; /** * Create a new property info */ public DefaultPropertyInfo() { this(null, null, null, null, null); } /** * Create a new property info * * @param name the name */ public DefaultPropertyInfo(String name) { this(name, name, null, null, null); } /** * Create a new property info * * @param name the name * @param upperName the upper case version of the name * @param type the type * @param getter the getter * @param setter the setter */ public DefaultPropertyInfo(String name, String upperName, TypeInfo type, MethodInfo getter, MethodInfo setter) { super(name, upperName, type); this.getter = getter; this.setter = setter; } /** * Create a new property info * * @param name the name * @param upperName the upper case version of the name * @param type the type * @param getter the getter * @param setter the setter * @param annotations the annotations */ public DefaultPropertyInfo(String name, String upperName, TypeInfo type, MethodInfo getter, MethodInfo setter, AnnotationValue[] annotations) { super(name, upperName, type, annotations); this.getter = getter; this.setter = setter; } public MethodInfo getGetter() { return getter; } public void setGetter(MethodInfo getter) { this.getter = getter; } public MethodInfo getSetter() { return setter; } public void setSetter(MethodInfo setter) { this.setter = setter; } public boolean isReadable() { return getGetter() != null; } public boolean isWritable() { return getSetter() != null; } public Object get(Object bean) throws Throwable { if (bean == null) throw new IllegalArgumentException("Null bean"); if (getter == null) throw new IllegalArgumentException("Property is not readable: " + getName() + " for " + getBeanInfo().getName()); return getter.invoke(bean, null); } public void set(Object bean, Object value) throws Throwable { if (bean == null) throw new IllegalArgumentException("Null bean"); if (setter == null) throw new IllegalArgumentException("Property is not writable: " + getName() + " for " + getBeanInfo().getName()); setter.invoke(bean, new Object[] { value }); } @Override public boolean equals(Object object) { if (super.equals(object) == false) return false; if (object == null || object instanceof DefaultPropertyInfo == false) return false; DefaultPropertyInfo other = (DefaultPropertyInfo) object; if (notEqual(getter, other.getter)) return false; else if (notEqual(setter, other.setter)) return false; return true; } @Override public void toString(JBossStringBuilder buffer) { super.toString(buffer); buffer.append(" getter=").append(getter); buffer.append(" setter=").append(setter); } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/plugins/FieldBeanInfo.java0000644000175000017500000001166210767035447032431 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beans.info.plugins; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.Collections; import org.jboss.beans.info.spi.BeanInfoFactory; import org.jboss.beans.info.spi.EventInfo; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.classadapter.spi.ClassAdapter; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.ConstructorInfo; import org.jboss.reflect.spi.FieldInfo; import org.jboss.reflect.spi.MethodInfo; /** * Field bean info. * @see org.jboss.beans.info.spi.BeanAccessMode#FIELDS * * @author Ales Justin */ public class FieldBeanInfo extends AbstractBeanInfo { /** The fields */ protected Map fieldsByName; public FieldBeanInfo( BeanInfoFactory beanInfoFactory, ClassAdapter classAdapter, Set properties, Set constructors, Set methods, Set events) { super(beanInfoFactory, classAdapter, properties, constructors, methods, events); } public void setProperties(Set properties) { setFields(getFields(classAdapter.getClassInfo(), getFieldFilter())); super.setProperties(properties); for(FieldInfo field : fieldsByName.values()) { PropertyInfo previous = findPropertyInfo(field.getName()); // expecting that property type is less exact if (previous == null || previous.getType().isAssignableFrom(field.getType()) == false) addProperty(new FieldPropertyInfo(field)); } } protected PropertyInfo replaceProperty(PropertyInfo original) { String name = original.getName(); if (original.isReadable() == false) { FieldInfo field = getField(name); if (field != null && original.getType().isAssignableFrom(field.getType())) return new SetterAndFieldPropertyInfo(original, field); } else if (original.isWritable() == false) { FieldInfo field = getField(name); if (field != null && original.getType().isAssignableFrom(field.getType())) return new GetterAndFieldPropertyInfo(original, field); } return original; } /** * Set fields * * @param fields the fields */ protected void setFields(Set fields) { if (fields != null && fields.isEmpty() == false) { fieldsByName = new HashMap(fields.size()); for (FieldInfo field : fields) { fieldsByName.put(field.getName(), field); } } else { fieldsByName = Collections.emptyMap(); } } /** * Get a property * * @param name the property name * @return the property * @throws IllegalArgumentException if there is no such property */ protected FieldInfo getField(String name) { return fieldsByName.get(name); } /** * Get the fields * * @param classInfo the class info * @param filter the field filter * @return the fields */ protected static Set getFields(ClassInfo classInfo, FieldFilter filter) { HashSet fields = new HashSet(); while (classInfo != null) { FieldInfo[] finfos = classInfo.getDeclaredFields(); if (finfos != null && finfos.length > 0) { for (FieldInfo field : finfos) if (filter.useField(field)) fields.add(field); } classInfo = classInfo.getSuperclass(); } return fields; } /** * Get the field filter. * * @return the field filter */ protected FieldFilter getFieldFilter() { return FieldFilter.PUBLIC; } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/plugins/AllBeanInfo.java0000644000175000017500000000373610767032015032105 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beans.info.plugins; import java.util.Set; import org.jboss.beans.info.spi.BeanInfoFactory; import org.jboss.beans.info.spi.EventInfo; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.classadapter.spi.ClassAdapter; import org.jboss.reflect.spi.ConstructorInfo; import org.jboss.reflect.spi.MethodInfo; /** * All bean info. * @see org.jboss.beans.info.spi.BeanAccessMode#ALL * * @author Ales Justin */ public class AllBeanInfo extends FieldBeanInfo { public AllBeanInfo( BeanInfoFactory beanInfoFactory, ClassAdapter classAdapter, Set properties, Set constructors, Set methods, Set events) { super(beanInfoFactory, classAdapter, properties, constructors, methods, events); } protected FieldFilter getFieldFilter() { return FieldFilter.ALL; } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/plugins/BeanInfoUtil.java0000644000175000017500000001556210727346727032330 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beans.info.plugins; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Arrays; import org.jboss.config.spi.Configuration; import org.jboss.config.plugins.property.PropertyConfiguration; import org.jboss.util.propertyeditor.PropertyEditors; import org.jboss.beans.info.spi.BeanInfo; import org.jboss.beans.info.spi.PropertyInfo; /** * Bean info helper. * Handles nested property names. * * @author Ales Justin */ public class BeanInfoUtil { /** The bean configurator */ private static Configuration configuration; static { configuration = AccessController.doPrivileged(new PrivilegedAction() { public Configuration run() { return new PropertyConfiguration(System.getProperties()); } }); PropertyEditors.init(); } /** * Get the value from target. * * @param beanInfo the bean info * @param target the target * @param propertys the property names * @return getter value * @throws Throwable for any error */ protected static Object getNestedTarget(BeanInfo beanInfo, Object target, String[] propertys) throws Throwable { if (propertys == null) throw new IllegalArgumentException("Null propertys."); for(int i = 0; i < propertys.length; i++) { if (beanInfo == null) throw new IllegalArgumentException("Null bean info"); PropertyInfo propertyInfo = beanInfo.getProperty(propertys[i]); Object result = propertyInfo.get(target); if (i < propertys.length - 1) { if (result == null) throw new IllegalArgumentException("Null target in nested property (" + Arrays.asList(propertys) + "): " + target + "." + propertys[i]); beanInfo = configuration.getBeanInfo(result.getClass()); } target = result; } return target; } /** * Get the nested property info from target. * * @param beanInfo the bean info * @param target the target * @param propertys the property names * @return nested property info * @throws Throwable for any error */ protected static PropertyInfo getNestedPropertyInfo(BeanInfo beanInfo, Object target, String[] propertys) throws Throwable { if (propertys == null || propertys.length == 0) throw new IllegalArgumentException("Illegal propertys: " + Arrays.asList(propertys) + ", " + target); PropertyInfo propertyInfo = null; for(int i = 0; i < propertys.length; i++) { if (beanInfo == null) throw new IllegalArgumentException("Null bean info"); propertyInfo = beanInfo.getProperty(propertys[i]); // we're not done yet if (i < propertys.length - 1) { Object result = propertyInfo.get(target); if (result == null) throw new IllegalArgumentException("Null target in nested property (" + Arrays.asList(propertys) + "): " + target + "." + propertys[i]); beanInfo = configuration.getBeanInfo(result.getClass()); target = result; } } return propertyInfo; } /** * Get the value from target. * * @param beanInfo the bean info * @param target the target * @param name the property name, can be nested * @return getter value * @throws Throwable for any error */ public static Object get(BeanInfo beanInfo, Object target, String name) throws Throwable { if (target == null) throw new IllegalArgumentException("Null target"); if (name == null) throw new IllegalArgumentException("Null property name"); String[] propertys = name.split("\\."); return getNestedTarget(beanInfo, target, propertys); } /** * Set the value on target. * * @param beanInfo the bean info * @param target the target * @param name the property name, can be nested * @param value the value * @throws Throwable for any error */ public static void set(BeanInfo beanInfo, Object target, String name, Object value) throws Throwable { if (target == null) throw new IllegalArgumentException("Null target"); if (name == null) throw new IllegalArgumentException("Null property name"); String[] propertys = name.split("\\."); int size = propertys.length - 1; if (size > 0) { String[] allButLast = new String[size]; System.arraycopy(propertys, 0, allButLast, 0, size); Object result = getNestedTarget(beanInfo, target, allButLast); if (result == null) throw new IllegalArgumentException("Cannot set value on null target: " + target + "." + name); target = result; beanInfo = configuration.getBeanInfo(target.getClass()); } else if (beanInfo == null) throw new IllegalArgumentException("Null bean info."); PropertyInfo propertyInfo = beanInfo.getProperty(propertys[size]); propertyInfo.set(target, value); } /** * Get nested property info. * * @param beanInfo the bean info * @param target the target * @param name the nested property name * @return nested property * @throws Throwable for any error */ public static PropertyInfo getPropertyInfo(BeanInfo beanInfo, Object target, String name) throws Throwable { if (target == null) throw new IllegalArgumentException("Null target"); if (name == null) throw new IllegalArgumentException("Null property name"); String[] propertys = name.split("\\."); return getNestedPropertyInfo(beanInfo, target, propertys); } }././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/plugins/SetterAndFieldPropertyInfo.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/plugins/SetterAndFieldPropert0000644000175000017500000000426410767035447033275 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beans.info.plugins; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.reflect.spi.FieldInfo; import org.jboss.reflect.spi.MethodInfo; import static org.jboss.beans.info.plugins.AbstractBeanInfoFactory.mergeAnnotations; /** * Combined setter and field property info. * * @author Ales Justin */ public class SetterAndFieldPropertyInfo extends FieldPropertyInfo { private static final long serialVersionUID = 1L; /** Previous property info */ private PropertyInfo previous; public SetterAndFieldPropertyInfo(PropertyInfo previous, FieldInfo field) { super(field, false); if (previous == null) throw new IllegalArgumentException("Null previous"); this.previous = previous; setupAnnotations(mergeAnnotations(field.getAnnotations(), previous.getAnnotations())); } public void set(Object bean, Object value) throws Throwable { previous.set(bean, value); } public MethodInfo getSetter() { return previous.getSetter(); } public void setSetter(MethodInfo setter) { previous.setSetter(setter); } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/plugins/NestedPropertyInfo.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/plugins/NestedPropertyInfo.ja0000644000175000017500000001511411113336451033235 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beans.info.plugins; import java.io.Serializable; import java.lang.annotation.Annotation; import java.util.ArrayList; import java.util.List; import org.jboss.beans.info.spi.BeanInfo; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.reflect.spi.AnnotationValue; import org.jboss.reflect.spi.MethodInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.reflect.spi.FieldInfo; import org.jboss.util.JBossObject; import org.jboss.util.JBossStringBuilder; import org.jboss.util.NotImplementedException; /** * When bean has more than one property with the same name * we try to use this impl to look over all possible setters * in order to set the value. * * But for most of other methods there is insufficent information * to invoke the right method - e.g. just property name and parent bean. * * @author Ales Justin */ public class NestedPropertyInfo extends JBossObject implements PropertyInfo, Serializable { /** The serialVersionUID */ private static final long serialVersionUID = 1L; private String name; private String upperName; private BeanInfo beanInfo; private List propertys = new ArrayList(); @Deprecated public NestedPropertyInfo(String name, BeanInfo beanInfo) { this(name, name, beanInfo); } public NestedPropertyInfo(String name, String upperName, BeanInfo beanInfo) { this.name = name; this.upperName = upperName; this.beanInfo = beanInfo; } void addPropertyInfo(PropertyInfo propertyInfo) { propertys.add(propertyInfo); } // can be used public BeanInfo getBeanInfo() { return beanInfo; } public String getName() { return name; } public String getUpperName() { return upperName; } /** * In this case it is better to return null * then to throw an exception, since we might still have * enough information to use this class to set the value. * * @return null */ public TypeInfo getType() { return null; } public void set(Object bean, Object value) throws Throwable { if (value != null) { for (PropertyInfo pi : propertys) { TypeInfo info = pi.getType(); if (info != null && info.isInstance(value)) { pi.set(bean, info.convertValue(value)); return; } } } throw new IllegalArgumentException("Unable to determine setter on " + bean + " for property " + name + " with value " + value); } @Override public boolean equals(Object object) { if (object == null || object instanceof NestedPropertyInfo == false) return false; NestedPropertyInfo other = (NestedPropertyInfo) object; if (notEqual(name, other.name)) return false; if (notEqual(beanInfo, other.beanInfo)) return false; else if (notEqual(propertys.size(), other.propertys.size())) return false; return true; } @Override public void toString(JBossStringBuilder buffer) { buffer.append("name=").append(name); } @Override public void toShortString(JBossStringBuilder buffer) { buffer.append(name); } @Override public int getHashCode() { return name.hashCode(); } // ---- undeterminable public Object get(Object bean) throws Throwable { throw new IllegalArgumentException("Unable to determine getter on " + bean + " for property " + name); } public MethodInfo getGetter() { throw new IllegalArgumentException("Unable to determine right PropertyInfo on " + beanInfo + " by name: " + name); } public void setGetter(MethodInfo getter) { throw new NotImplementedException("setGetter"); } public MethodInfo getSetter() { throw new IllegalArgumentException("Unable to determine right PropertyInfo on " + beanInfo + " by name: " + name); } public void setSetter(MethodInfo setter) { throw new NotImplementedException("setSetter"); } public boolean isReadable() { return false; } public boolean isWritable() { return false; } public FieldInfo getFieldInfo() { return null; } public AnnotationValue[] getAnnotations() { throw new IllegalArgumentException("Unable to determine right PropertyInfo on " + beanInfo + " by name: " + name); } public AnnotationValue getAnnotation(String name) { throw new IllegalArgumentException("Unable to determine right PropertyInfo on " + beanInfo + " by name: " + this.name); } public boolean isAnnotationPresent(String name) { throw new IllegalArgumentException("Unable to determine right PropertyInfo on " + beanInfo + " by name: " + this.name); } public Annotation[] getUnderlyingAnnotations() { throw new IllegalArgumentException("Unable to determine right PropertyInfo on " + beanInfo + " by name: " + name); } public T getUnderlyingAnnotation(Class annotationType) { throw new IllegalArgumentException("Unable to determine right PropertyInfo on " + beanInfo + " by name: " + name); } public boolean isAnnotationPresent(Class annotationType) { throw new IllegalArgumentException("Unable to determine right PropertyInfo on " + beanInfo + " by name: " + name); } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/plugins/AbstractEventInfo.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/plugins/AbstractEventInfo.jav0000644000175000017500000000255110375052605033207 0ustar twernertwerner/* * 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.beans.info.plugins; import org.jboss.beans.info.spi.EventInfo; import org.jboss.util.JBossObject; /** * Event info. * * @author Adrian Brock * @version $Revision: 41223 $ */ public class AbstractEventInfo extends JBossObject implements EventInfo { /** * Create a new event info */ public AbstractEventInfo() { } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/plugins/package.html0000644000175000017500000000153610375052605031407 0ustar twernertwerner

Classes used to describe beans, an abstract implementation.

Package Specification

Related Documentation

Package Status

  • ALPHA

Todo

  • ???
././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/plugins/AbstractPropertyInfo.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/plugins/AbstractPropertyInfo.0000644000175000017500000001036610767505004033255 0ustar twernertwerner/* * 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.beans.info.plugins; import java.io.Serializable; import org.jboss.beans.info.spi.BeanInfo; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.reflect.plugins.AnnotationHolder; import org.jboss.reflect.spi.AnnotationValue; import org.jboss.reflect.spi.TypeInfo; import org.jboss.reflect.spi.FieldInfo; import org.jboss.util.JBossStringBuilder; /** * Property info. * * @author Ales Justin * @author Adrian Brock * @version $Revision: 70913 $ */ public abstract class AbstractPropertyInfo extends AnnotationHolder implements PropertyInfo, Serializable { /** The serialVersionUID */ private static final long serialVersionUID = 2; /** The bean info */ private transient BeanInfo beanInfo; /** The property name */ private String name; /** The upper property name */ private String upperName; /** The type */ private TypeInfo type; /** * Create a new property info */ public AbstractPropertyInfo() { this(null, null, null); } /** * Create a new property info * * @param name the name */ public AbstractPropertyInfo(String name) { this(name, name, null); } /** * Create a new property info * * @param name the name * @param upperName the upper case version of the name * @param type the type */ public AbstractPropertyInfo(String name, String upperName, TypeInfo type) { init(name, upperName, type); } /** * Create a new property info * * @param name the name * @param upperName the upper case version of the name * @param type the type * @param annotations the annotations */ public AbstractPropertyInfo(String name, String upperName, TypeInfo type, AnnotationValue[] annotations) { super(annotations); init(name, upperName, type); } /** * Initialize fields. * * @param name the name * @param upperName the upper name * @param type the type */ protected void init(String name, String upperName, TypeInfo type) { this.name = name; this.upperName = upperName; this.type = type; } public BeanInfo getBeanInfo() { return beanInfo; } void setBeanInfo(BeanInfo beanInfo) { this.beanInfo = beanInfo; } public String getName() { return name; } public String getUpperName() { return upperName; } public TypeInfo getType() { return type; } public void setType(TypeInfo type) { this.type = type; } public FieldInfo getFieldInfo() { return null; } @Override public boolean equals(Object object) { if (object == null || object instanceof AbstractPropertyInfo == false) return false; AbstractPropertyInfo other = (AbstractPropertyInfo) object; if (notEqual(name, other.name)) return false; return true; } @Override public void toString(JBossStringBuilder buffer) { buffer.append("name=").append(name); } @Override public void toShortString(JBossStringBuilder buffer) { buffer.append(name); } @Override public int getHashCode() { return name.hashCode(); } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/plugins/AbstractBeanInfo.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/plugins/AbstractBeanInfo.java0000644000175000017500000003020211137563143033127 0ustar twernertwerner/* * 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.beans.info.plugins; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import org.jboss.beans.info.spi.BeanInfo; import org.jboss.beans.info.spi.BeanInfoFactory; import org.jboss.beans.info.spi.EventInfo; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.classadapter.spi.ClassAdapter; import org.jboss.joinpoint.plugins.Config; import org.jboss.joinpoint.spi.ConstructorJoinpoint; import org.jboss.joinpoint.spi.JoinpointFactory; import org.jboss.joinpoint.spi.MethodJoinpoint; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.ConstructorInfo; import org.jboss.reflect.spi.MethodInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.util.JBossObject; import org.jboss.util.JBossStringBuilder; import org.jboss.util.collection.CollectionsFactory; /** * BeanInfo. * * @author Ales Justin * @author Adrian Brock * @version $Revision: 83459 $ */ public class AbstractBeanInfo extends JBossObject implements BeanInfo { /** The class name */ private String name; /** The class adapter */ protected ClassAdapter classAdapter; /** The properties */ private Set properties = CollectionsFactory.createLazySet(); /** The properties by name */ private transient Map propertiesByName = CollectionsFactory.createLazyMap(); /** The constructors */ private Set constructors; /** The methods */ private Set methods; /** The events */ private Set events; /** The BeanInfoFactory */ private BeanInfoFactory beanInfoFactory; /** * Create a new bean info * * @param beanInfoFactory the bean info factory * @param classAdapter the class adapter * @param properties the properties * @param constructors the constructors * @param methods the methods * @param events the events */ public AbstractBeanInfo( BeanInfoFactory beanInfoFactory, ClassAdapter classAdapter, Set properties, Set constructors, Set methods, Set events) { this.beanInfoFactory = beanInfoFactory; if (classAdapter == null) throw new IllegalArgumentException("Null class adapter."); this.name = classAdapter.getClassInfo().getName(); this.classAdapter = classAdapter; setProperties(properties); this.constructors = constructors; this.methods = methods; this.events = events; } public String getName() { return name; } public Set getProperties() { return properties; } public void setProperties(Set properties) { if (properties != null && properties.isEmpty() == false) { this.properties = new HashSet(properties.size()); this.propertiesByName = new HashMap(properties.size()); for (PropertyInfo property : properties) { replaceAndAddProperty(property); } } } /** * Get a property * * @param name the property name * @return the property * @throws IllegalArgumentException if there is no such property */ public PropertyInfo getProperty(String name) { if (name == null) throw new IllegalArgumentException("Null name"); PropertyInfo property = findPropertyInfo(name); if (property == null) throw new IllegalArgumentException("No such property " + name + " for bean " + getName() + " available " + propertiesByName.keySet()); return property; } /** * Find property * * @param name the property name * @return the property or null if no such property */ protected PropertyInfo findPropertyInfo(String name) { return propertiesByName.get(name); } /** * Replace and add property. * * @param property the property to add */ protected void replaceAndAddProperty(PropertyInfo property) { property = replaceProperty(property); addProperty(property); } /** * Add property. * * @param property the property to add */ protected void addProperty(PropertyInfo property) { properties.add(property); PropertyInfo previous = propertiesByName.put(property.getName(), property); if (previous != null) { NestedPropertyInfo nestedPropertyInfo; if (previous instanceof NestedPropertyInfo) { nestedPropertyInfo = (NestedPropertyInfo)previous; } else { nestedPropertyInfo = new NestedPropertyInfo(previous.getName(), previous.getUpperName(), this); nestedPropertyInfo.addPropertyInfo(previous); propertiesByName.put(previous.getName(), nestedPropertyInfo); } nestedPropertyInfo.addPropertyInfo(property); } if (property instanceof AbstractPropertyInfo) { AbstractPropertyInfo ainfo = (AbstractPropertyInfo) property; ainfo.setBeanInfo(this); } } /** * Do we need to replace property due to access mode. * By default we don't do anything, returning original. * * @param original the original property * @return replaced property or original if no replacement neccessary */ protected PropertyInfo replaceProperty(PropertyInfo original) { return original; } public ClassInfo getClassInfo() { return classAdapter.getClassInfo(); } public JoinpointFactory getJoinpointFactory() { return classAdapter.getJoinpointFactory(); } public Set getConstructors() { return constructors; } public void setConstructors(Set constructors) { this.constructors = constructors; } public Set getEvents() { return events; } public void setEvents(Set events) { this.events = events; } public Set getMethods() { return methods; } public void setMethods(Set methods) { this.methods = methods; } public BeanInfoFactory getBeanInfoFactory() { return beanInfoFactory; } public Object newInstance() throws Throwable { return newInstance((String[]) null, null); } public Object newInstance(String[] paramTypes, Object[] params) throws Throwable { ConstructorJoinpoint joinpoint = Config.getConstructorJoinpoint(getJoinpointFactory(), paramTypes, params); return joinpoint.dispatch(); } public Object newInstance(Class[] paramTypes, Object[] params) throws Throwable { return newInstance(classesToStrings(paramTypes), params); } public Object newInstance(TypeInfo[] paramTypes, Object[] params) throws Throwable { return newInstance(typeInfosToStrings(paramTypes), params); } public Object getProperty(Object bean, String name) throws Throwable { return BeanInfoUtil.get(this, bean, name); } public void setProperty(Object bean, String name, Object value) throws Throwable { BeanInfoUtil.set(this, bean, name, value); } public Object invoke(Object bean, String name) throws Throwable { return invoke(bean, name, (String[]) null, null); } public Object invoke(Object bean, String name, String[] paramTypes, Object[] params) throws Throwable { MethodJoinpoint joinpoint = Config.getMethodJoinpoint(bean, getJoinpointFactory(), name, paramTypes, params); return joinpoint.dispatch(); } public Object invoke(Object bean, String name, Class[] paramTypes, Object[] params) throws Throwable { return invoke(bean, name, classesToStrings(paramTypes), params); } public Object invoke(Object bean, String name, TypeInfo[] paramTypes, Object[] params) throws Throwable { return invoke(bean, name, typeInfosToStrings(paramTypes), params); } public Object invokeStatic(String name) throws Throwable { return invokeStatic(name, (String[]) null, null); } public Object invokeStatic(String name, String[] paramTypes, Object[] params) throws Throwable { MethodJoinpoint joinpoint = Config.getStaticMethodJoinpoint(getJoinpointFactory(), name, paramTypes, params); return joinpoint.dispatch(); } public Object invokeStatic(String name, Class[] paramTypes, Object[] params) throws Throwable { return invokeStatic(name, classesToStrings(paramTypes), params); } public Object invokeStatic(String name, TypeInfo[] paramTypes, Object[] params) throws Throwable { return invokeStatic(name, typeInfosToStrings(paramTypes), params); } public boolean equals(Object object) { if (object == null || object instanceof AbstractBeanInfo == false) return false; AbstractBeanInfo other = (AbstractBeanInfo) object; if (notEqual(name, other.name)) return false; else if (notEqual(classAdapter, other.classAdapter)) return false; else if (notEqual(properties, other.properties)) return false; else if (notEqual(methods, other.methods)) return false; else if (notEqual(constructors, other.constructors)) return false; else if (notEqual(events, other.events)) return false; return true; } public void toString(JBossStringBuilder buffer) { buffer.append("name=").append(name); buffer.append(" classInfo="); classAdapter.toShortString(buffer); buffer.append(" properties="); list(buffer, properties); buffer.append(" methods="); list(buffer, methods); buffer.append(" constructors="); list(buffer, constructors); buffer.append(" events="); list(buffer, events); } public void toShortString(JBossStringBuilder buffer) { buffer.append(name); } public int getHashCode() { return name.hashCode(); } /** * Convert classes to strings * * @param classes the classes * @return the strings */ private static String[] classesToStrings(Class[] classes) { if (classes == null || classes.length == 0) return null; String[] result = new String[classes.length]; for (int i = 0; i < classes.length; ++i) { if (classes[i] == null) throw new IllegalArgumentException("Null class in parameter types: " + Arrays.asList(classes)); result[i] = classes[i].getName(); } return result; } /** * Convert typeInfos to strings * * @param typeInfos the typeInfos * @return the strings */ private static String[] typeInfosToStrings(TypeInfo[] typeInfos) { if (typeInfos == null || typeInfos.length == 0) return null; String[] result = new String[typeInfos.length]; for (int i = 0; i < typeInfos.length; ++i) { if (typeInfos[i] == null) throw new IllegalArgumentException("Null class in parameter types: " + Arrays.asList(typeInfos)); result[i] = typeInfos[i].getName(); } return result; } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/plugins/FieldFilter.java0000644000175000017500000000362410767032015032160 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beans.info.plugins; import org.jboss.reflect.spi.FieldInfo; /** * Simple field filter. * * @author Ales Justin */ interface FieldFilter { static final FieldFilter PUBLIC = new IsPublicFieldFilter(); static final FieldFilter ALL = new AllFieldFilter(); /** * Should we use the field. * * @param field the field info * @return true if field should be used */ boolean useField(FieldInfo field); /** * All field filter. */ class AllFieldFilter implements FieldFilter { public boolean useField(FieldInfo field) { return true; } } /** * Just public field filter. */ class IsPublicFieldFilter implements FieldFilter { public boolean useField(FieldInfo field) { return field.isPublic(); } } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/plugins/GetterAndFieldPropertyInfo.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/plugins/GetterAndFieldPropert0000644000175000017500000000425010767035447033254 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beans.info.plugins; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.reflect.spi.FieldInfo; import org.jboss.reflect.spi.MethodInfo; import static org.jboss.beans.info.plugins.AbstractBeanInfoFactory.mergeAnnotations; /** * Combined getter and field property info. * * @author Ales Justin */ public class GetterAndFieldPropertyInfo extends FieldPropertyInfo { private static final long serialVersionUID = 1L; /** Previous property info */ private PropertyInfo previous; public GetterAndFieldPropertyInfo(PropertyInfo previous, FieldInfo field) { super(field, false); if (previous == null) throw new IllegalArgumentException("Null previous"); this.previous = previous; setupAnnotations(mergeAnnotations(field.getAnnotations(), previous.getAnnotations())); } public Object get(Object bean) throws Throwable { return previous.get(bean); } public MethodInfo getGetter() { return previous.getGetter(); } public void setGetter(MethodInfo getter) { previous.setGetter(getter); } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/plugins/AbstractBeanInfoFactory.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/plugins/AbstractBeanInfoFacto0000644000175000017500000003312211112776757033202 0ustar twernertwerner/* * 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.beans.info.plugins; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.WeakHashMap; import org.jboss.beans.info.spi.BeanAccessMode; import org.jboss.beans.info.spi.BeanInfo; import org.jboss.beans.info.spi.BeanInfoFactory; import org.jboss.beans.info.spi.EventInfo; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.classadapter.spi.ClassAdapter; 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.PrimitiveInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.util.JBossStringBuilder; import org.jboss.util.collection.WeakValueHashMap; /** * A bean info factory. * * @author Adrian Brock * @author Ales Justin * @version $Revision: 81545 $ */ public class AbstractBeanInfoFactory implements BeanInfoFactory { /** The cache */ protected Map>> cache = new WeakHashMap>>(); protected static boolean isGetter(MethodInfo minfo) { String name = minfo.getName(); TypeInfo returnType = minfo.getReturnType(); TypeInfo[] parameters = minfo.getParameterTypes(); if ((name.length() > 3 && name.startsWith("get")) || (name.length() > 2 && name.startsWith("is"))) { // isBoolean() is not a getter for java.lang.Boolean if (name.startsWith("is") && PrimitiveInfo.BOOLEAN.equals(returnType) == false) return false; if (parameters.length == 0 && PrimitiveInfo.VOID.equals(returnType) == false) return true; } return false; } protected static boolean isSetter(MethodInfo minfo) { String name = minfo.getName(); TypeInfo returnType = minfo.getReturnType(); TypeInfo[] parameters = minfo.getParameterTypes(); if ((name.length() > 3 && name.startsWith("set"))) { if (parameters.length == 1 && PrimitiveInfo.VOID.equals(returnType)) return true; } return false; } protected static String getUpperPropertyName(String name) { int start = 3; if (name.startsWith("is")) start = 2; return name.substring(start); } protected static String getLowerPropertyName(String name) { // If the second character is upper case then we don't make // the first character lower case if (name.length() > 1) { if (Character.isUpperCase(name.charAt(1))) return name; } JBossStringBuilder buffer = new JBossStringBuilder(name.length()); buffer.append(Character.toLowerCase(name.charAt(0))); if (name.length() > 1) buffer.append(name.substring(1)); return buffer.toString(); } /** * Create a new bean info factory */ public AbstractBeanInfoFactory() { } public BeanInfo getBeanInfo(ClassAdapter classAdapter) { return getBeanInfo(classAdapter, BeanAccessMode.STANDARD); } public BeanInfo getBeanInfo(ClassAdapter classAdapter, BeanAccessMode accessMode) { if (classAdapter == null) throw new IllegalArgumentException("Null class adapter."); if (accessMode == null) accessMode = BeanAccessMode.STANDARD; synchronized (cache) { ClassLoader cl = classAdapter.getClassLoader(); ClassInfo classInfo = classAdapter.getClassInfo(); Map> classInfoMap = cache.get(cl); Map modeMap = null; if (classInfoMap != null) { modeMap = classInfoMap.get(classInfo); if (modeMap != null) { BeanInfo info = modeMap.get(accessMode); if (info != null) return info; } } Set constructors = getConstructors(classInfo); Set methods = getMethods(classInfo); Set properties; if (classInfo.isAnnotation()) properties = getAnnotationProperties(methods); else properties = getBeanProperties(methods); Set events = getEvents(classInfo); BeanInfo result = createBeanInfo(classAdapter, accessMode, properties, constructors, methods, events); if (classInfoMap == null) { classInfoMap = new WeakHashMap>(); cache.put(cl, classInfoMap); } if (modeMap == null) { modeMap = new WeakValueHashMap(); classInfoMap.put(classInfo, modeMap); } modeMap.put(accessMode, result); return result; } } /** * Create the bean info * * @param classAdapter the class adapter * @param accessMode the access mode * @param properties the properties * @param constructors the constructors * @param methods the methods * @param events the events * @return the bean info */ protected BeanInfo createBeanInfo( ClassAdapter classAdapter, BeanAccessMode accessMode, Set properties, Set constructors, Set methods, Set events) { return accessMode.create(this, classAdapter, properties, constructors, methods, events); } /** * Get the constructors * * @param classInfo the class info * @return the constructors */ protected Set getConstructors(ClassInfo classInfo) { ConstructorInfo[] cinfos = classInfo.getDeclaredConstructors(); if (cinfos == null || cinfos.length == 0) return null; HashSet result = new HashSet(); for (int i = 0; i < cinfos.length; ++i) { if (cinfos[i].isPublic() && cinfos[i].isStatic() == false) result.add(cinfos[i]); } return result; } /** * Get the methods * * @param classInfo the class info * @return the methods */ protected Set getMethods(ClassInfo classInfo) { HashSet result = new HashSet(); while (classInfo != null) { MethodInfo[] minfos = classInfo.getDeclaredMethods(); if (minfos != null && minfos.length > 0) { for (int i = 0; i < minfos.length; ++i) { if (result.contains(minfos[i]) == false && minfos[i].isPublic() && minfos[i].isStatic() == false && minfos[i].isVolatile() == false) result.add(minfos[i]); } } classInfo = classInfo.getSuperclass(); } return result; } /** * Get the properties for a bean * * @param methods the methods * @return the properties */ protected Set getBeanProperties(Set methods) { HashMap getters = new HashMap(); HashMap> setters = new HashMap>(); if (methods.isEmpty() == false) { for (MethodInfo methodInfo : methods) { String name = methodInfo.getName(); if (isGetter(methodInfo)) { String upperName = getUpperPropertyName(name); getters.put(upperName, methodInfo); } else if (isSetter(methodInfo)) { String upperName = getUpperPropertyName(name); List list = setters.get(upperName); if (list == null) { list = new ArrayList(); setters.put(upperName, list); } list.add(methodInfo); } } } HashSet properties = new HashSet(); if (getters.isEmpty() == false) { for (Iterator> i = getters.entrySet().iterator(); i.hasNext();) { Map.Entry entry = i.next(); String name = entry.getKey(); MethodInfo getter = entry.getValue(); MethodInfo setter = null; List setterList = setters.remove(name); if (setterList != null && setterList.size() != 0) { for (int j = 0; j < setterList.size(); ++j) { MethodInfo thisSetter = setterList.get(j); TypeInfo pinfo = thisSetter.getParameterTypes()[0]; if (getter.getReturnType().equals(pinfo) == true) { setter = thisSetter; break; } } } String lowerName = getLowerPropertyName(name); // Merge the annotations between the getters and setters AnnotationValue[] annotations = getter.getAnnotations(); AnnotationValue[] setterAnnotations = null; if (setter != null) setterAnnotations = setter.getAnnotations(); annotations = mergeAnnotations(annotations, setterAnnotations); TypeInfo type = getPropertyType(getter, setter); properties.add(new DefaultPropertyInfo(lowerName, name, type, getter, setter, annotations)); } } if (setters.isEmpty() == false) { for (Iterator>> i = setters.entrySet().iterator(); i.hasNext();) { Map.Entry> entry = i.next(); String name = entry.getKey(); List setterList = entry.getValue(); for(MethodInfo setter : setterList) { TypeInfo pinfo = setter.getParameterTypes()[0]; String lowerName = getLowerPropertyName(name); AnnotationValue[] annotations = setter.getAnnotations(); properties.add(new DefaultPropertyInfo(lowerName, name, pinfo, null, setter, annotations)); } } } return properties; } /** * Merge annotations. * * @param first first array of annotations * @param second second array of annotations * @return merged annotations */ static AnnotationValue[] mergeAnnotations(AnnotationValue[] first, AnnotationValue[] second) { if (first == null || first.length == 0) first = second; else if (second != null && second.length > 0) { HashSet merged = new HashSet(); for (AnnotationValue annotation : first) merged.add(annotation); for (AnnotationValue annotation : second) merged.add(annotation); first = merged.toArray(new AnnotationValue[merged.size()]); } return first; } /** * Determine the type of PropertyInfo. * * @param getter the getter * @param setter the setter * @return property type */ protected TypeInfo getPropertyType(MethodInfo getter, MethodInfo setter) { if (getter == null) throw new IllegalArgumentException("Getter should not be null!"); if (setter == null) return getter.getReturnType(); // TODO - determine more restrictive type among getter and setter return getter.getReturnType(); } /** * Get the properties for an annotation * * @param methods the methods * @return the properties */ protected Set getAnnotationProperties(Set methods) { HashSet properties = new HashSet(); if (methods != null && methods.isEmpty() == false) { for (MethodInfo method : methods) { TypeInfo returnType = method.getReturnType(); TypeInfo[] parameters = method.getParameterTypes(); if (parameters.length == 0 && PrimitiveInfo.VOID.equals(returnType) == false) { String name = method.getName(); properties.add(new DefaultPropertyInfo(name, name, returnType, method, null, method.getAnnotations())); } } } return properties; } /** * Get the events * * @param classInfo the class info * @return the events */ protected Set getEvents(ClassInfo classInfo) { return null; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/plugins/FieldPropertyInfo.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/plugins/FieldPropertyInfo.jav0000644000175000017500000000636610767505004033243 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beans.info.plugins; import org.jboss.reflect.spi.FieldInfo; import org.jboss.reflect.spi.MethodInfo; import org.jboss.util.JBossStringBuilder; /** * Field property info. * * @author Ales Justin */ public class FieldPropertyInfo extends AbstractPropertyInfo { private static final long serialVersionUID = 1L; /** The field info */ private FieldInfo field; public FieldPropertyInfo(FieldInfo field) { this(field, true); } protected FieldPropertyInfo(FieldInfo field, boolean setAnnotations) { if (field == null) throw new IllegalArgumentException("Null field"); this.field = field; init(field.getName(), field.getName(), field.getType()); if (setAnnotations) setupAnnotations(field.getAnnotations()); } public MethodInfo getGetter() { return null; } public void setGetter(MethodInfo getter) { throw new UnsupportedOperationException("Cannot set getter on field property info."); } public MethodInfo getSetter() { return null; } public void setSetter(MethodInfo setter) { throw new UnsupportedOperationException("Cannot set getter on field property info."); } public boolean isReadable() { return true; } public boolean isWritable() { return true; } public Object get(Object bean) throws Throwable { if (bean == null) throw new IllegalArgumentException("Null bean"); return field.get(bean); } public void set(Object bean, Object value) throws Throwable { if (bean == null) throw new IllegalArgumentException("Null bean"); field.set(bean, value); } public FieldInfo getFieldInfo() { return field; } @Override public boolean equals(Object object) { if (object == null || object instanceof FieldPropertyInfo == false) return false; FieldPropertyInfo other = (FieldPropertyInfo) object; return field.equals(other.field); } @Override public void toString(JBossStringBuilder buffer) { buffer.append(" field=").append(field); } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/spi/0000755000175000017500000000000011620314127026225 5ustar twernertwernerlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/spi/BeanAccessMode.java0000644000175000017500000000462610767032015031700 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beans.info.spi; import java.util.Set; import org.jboss.classadapter.spi.ClassAdapter; import org.jboss.reflect.spi.ConstructorInfo; import org.jboss.reflect.spi.MethodInfo; /** * Bean access mode. * * @author Ales Justin */ public enum BeanAccessMode { STANDARD(BeanInfoCreator.STANDARD), // Getters and Setters FIELDS(BeanInfoCreator.FIELDS), // Getters/Setters and fields without getters and setters ALL(BeanInfoCreator.ALL); // As above but with non public fields included /** The bean info creator */ private BeanInfoCreator creator; BeanAccessMode(BeanInfoCreator creator) { this.creator = creator; } /** * Create the bean info * * @param beanInfoFactory the bean info factory * @param classAdapter the class adapter * @param properties the properties * @param constructors the constructors * @param methods the methods * @param events the events * @return the bean info */ public BeanInfo create( BeanInfoFactory beanInfoFactory, ClassAdapter classAdapter, Set properties, Set constructors, Set methods, Set events) { return creator.create(beanInfoFactory, classAdapter, properties, constructors, methods, events); } }libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/spi/BeanInfo.java0000644000175000017500000001616510763231257030573 0ustar twernertwerner/* * 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.beans.info.spi; import java.util.Set; import org.jboss.joinpoint.spi.JoinpointFactory; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.ConstructorInfo; import org.jboss.reflect.spi.MethodInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.util.JBossInterface; /** * Description of a bean. * * @author Adrian Brock * @version $Revision: 70359 $ */ public interface BeanInfo extends JBossInterface { /** * Get the bean name * * @return the name */ String getName(); /** * Get the class information * * @return the class information */ ClassInfo getClassInfo(); /** * Get the joinpoint factory * * @return the joinpoint factory */ JoinpointFactory getJoinpointFactory(); /** * Get the property information. * * @return a Set */ Set getProperties(); /** * Set the property information. * * @param properties a Set */ void setProperties(Set properties); /** * Get a property * * @param name the property name * @return the property * @throws IllegalArgumentException for a null name or if there is no such property */ PropertyInfo getProperty(String name); /** * Get the constructor info. * * @return a Set */ Set getConstructors(); /** * Set the constructor info. * * @param constructors a Set */ void setConstructors(Set constructors); /** * Get the method information. * * @return a Set */ Set getMethods(); /** * Set the method information. * * @param methods a Set */ void setMethods(Set methods); /** * Get the event information. * * @return a Set */ Set getEvents(); /** * set the event information. * * @param events a Set */ void setEvents(Set events); /** * Get the bean info factory * * @return the factory */ BeanInfoFactory getBeanInfoFactory(); /** * Create a new instance * * @return the new instance * @throws Throwable for any error */ Object newInstance() throws Throwable; /** * Create a new instance * * @param paramTypes the parameter types * @param params the parameters * @return the new instance * @throws Throwable for any error */ Object newInstance(String[] paramTypes, Object[] params) throws Throwable; /** * Create a new instance * * @param paramTypes the parameter types * @param params the parameters * @return the new instance * @throws Throwable for any error */ Object newInstance(Class[] paramTypes, Object[] params) throws Throwable; /** * Create a new instance * * @param paramTypes the parameter types * @param params the parameters * @return the new instance * @throws Throwable for any error */ Object newInstance(TypeInfo[] paramTypes, Object[] params) throws Throwable; /** * Get a property * * @param bean the bean * @param name the property name * @return the property value * @throws Throwable for any error */ Object getProperty(Object bean, String name) throws Throwable; /** * Get a property * * @param bean the bean * @param name the property name * @param value the property value * @throws Throwable for any error */ void setProperty(Object bean, String name, Object value) throws Throwable; /** * Invoke a method with no parameters * * @param bean the bean * @param name the method name * @return the result * @throws Throwable for any error */ Object invoke(Object bean, String name) throws Throwable; /** * Invoke a method * * @param bean the bean * @param name the method name * @param paramTypes the parameter types * @param params the parameters * @return the result * @throws Throwable for any error */ Object invoke(Object bean, String name, String[] paramTypes, Object[] params) throws Throwable; /** * Invoke a method * * @param bean the bean * @param name the method name * @param paramTypes the parameter types * @param params the parameters * @return the result * @throws Throwable for any error */ Object invoke(Object bean, String name, Class[] paramTypes, Object[] params) throws Throwable; /** * Invoke a method * * @param bean the bean * @param name the method name * @param paramTypes the parameter types * @param params the parameters * @return the result * @throws Throwable for any error */ Object invoke(Object bean, String name, TypeInfo[] paramTypes, Object[] params) throws Throwable; /** * Invoke a static method with no parameters * * @param name the method name * @return the result * @throws Throwable for any error */ Object invokeStatic(String name) throws Throwable; /** * Invoke a static method * * @param name the method name * @param paramTypes the parameter types * @param params the parameters * @return the result * @throws Throwable for any error */ Object invokeStatic(String name, String[] paramTypes, Object[] params) throws Throwable; /** * Invoke a static method * * @param name the method name * @param paramTypes the parameter types * @param params the parameters * @return the result * @throws Throwable for any error */ Object invokeStatic(String name, Class[] paramTypes, Object[] params) throws Throwable; /** * Invoke a static method * * @param name the method name * @param paramTypes the parameter types * @param params the parameters * @return the result * @throws Throwable for any error */ Object invokeStatic(String name, TypeInfo[] paramTypes, Object[] params) throws Throwable; } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/spi/BeanInfoCreator.java0000644000175000017500000000730210767032015032077 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beans.info.spi; import java.util.Set; import org.jboss.beans.info.plugins.AbstractBeanInfo; import org.jboss.beans.info.plugins.AllBeanInfo; import org.jboss.beans.info.plugins.FieldBeanInfo; import org.jboss.classadapter.spi.ClassAdapter; import org.jboss.reflect.spi.ConstructorInfo; import org.jboss.reflect.spi.MethodInfo; /** * Create the bean info from bean access mode. * * @author Ales Justin */ interface BeanInfoCreator { static final BeanInfoCreator STANDARD = new StandardBeanInfoCreator(); static final BeanInfoCreator FIELDS = new FieldBeanInfoCreator(); static final BeanInfoCreator ALL = new AllBeanInfoCreator(); /** * Create the bean info * * @param beanInfoFactory the bean info factory * @param classAdapter the class adapter * @param properties the properties * @param constructors the constructors * @param methods the methods * @param events the events * @return the bean info */ BeanInfo create( BeanInfoFactory beanInfoFactory, ClassAdapter classAdapter, Set properties, Set constructors, Set methods, Set events); class StandardBeanInfoCreator implements BeanInfoCreator { public BeanInfo create( BeanInfoFactory beanInfoFactory, ClassAdapter classAdapter, Set properties, Set constructors, Set methods, Set events) { return new AbstractBeanInfo(beanInfoFactory, classAdapter, properties, constructors, methods, events); } } class FieldBeanInfoCreator implements BeanInfoCreator { public BeanInfo create( BeanInfoFactory beanInfoFactory, ClassAdapter classAdapter, Set properties, Set constructors, Set methods, Set events) { return new FieldBeanInfo(beanInfoFactory, classAdapter, properties, constructors, methods, events); } } class AllBeanInfoCreator implements BeanInfoCreator { public BeanInfo create( BeanInfoFactory beanInfoFactory, ClassAdapter classAdapter, Set properties, Set constructors, Set methods, Set events) { return new AllBeanInfo(beanInfoFactory, classAdapter, properties, constructors, methods, events); } } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/spi/EventInfo.java0000644000175000017500000000234310375052605030775 0ustar twernertwerner/* * 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.beans.info.spi; import org.jboss.util.JBossInterface; /** * Information about an Event. * * @author Adrian Brock * @version $Revision: 41223 $ */ public interface EventInfo extends JBossInterface { } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/spi/package.html0000644000175000017500000000150210375052605030512 0ustar twernertwerner

Classes used to describe beans.

Package Specification

Related Documentation

Package Status

  • ALPHA

Todo

  • ???
libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/spi/BeanInfoFactory.java0000644000175000017500000000330510767032015032106 0ustar twernertwerner/* * 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.beans.info.spi; import org.jboss.classadapter.spi.ClassAdapter; /** * BeanInfo Factory. * * @author Ales Justin * @author Adrian Brock * @version $Revision: 70886 $ */ public interface BeanInfoFactory { /** * Retrieve the bean information * * @param classAdapter the classAdapter * @return the bean information */ BeanInfo getBeanInfo(ClassAdapter classAdapter); /** * Retrieve the bean information * * @param classAdapter the classAdapter * @param accessMode the access mode * @return the bean information */ BeanInfo getBeanInfo(ClassAdapter classAdapter, BeanAccessMode accessMode); } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/spi/helpers/0000755000175000017500000000000011620314126027666 5ustar twernertwerner././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/spi/helpers/UnmodifiableBeanInfo.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/spi/helpers/UnmodifiableBeanI0000644000175000017500000001316610763231257033127 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.beans.info.spi.helpers; import java.util.Set; import org.jboss.beans.info.spi.BeanInfo; import org.jboss.beans.info.spi.BeanInfoFactory; import org.jboss.beans.info.spi.EventInfo; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.joinpoint.spi.JoinpointFactory; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.ConstructorInfo; import org.jboss.reflect.spi.MethodInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.util.JBossObject; import org.jboss.util.JBossStringBuilder; /** * An unmodifiable view of the specified bean info instance. * * @author Ales Justin */ public class UnmodifiableBeanInfo extends JBossObject implements BeanInfo { private BeanInfo delegate; public UnmodifiableBeanInfo(BeanInfo delegate) { if (delegate == null) throw new IllegalArgumentException("Null bean info."); this.delegate = delegate; } public String getName() { return delegate.getName(); } public ClassInfo getClassInfo() { return delegate.getClassInfo(); } public JoinpointFactory getJoinpointFactory() { return delegate.getJoinpointFactory(); } public Set getProperties() { return delegate.getProperties(); } public void setProperties(Set properties) { throw new UnsupportedOperationException(); } public PropertyInfo getProperty(String name) { return delegate.getProperty(name); } public Set getConstructors() { return delegate.getConstructors(); } public void setConstructors(Set constructors) { throw new UnsupportedOperationException(); } public Set getMethods() { return delegate.getMethods(); } public void setMethods(Set methods) { throw new UnsupportedOperationException(); } public Set getEvents() { return delegate.getEvents(); } public void setEvents(Set events) { throw new UnsupportedOperationException(); } public BeanInfoFactory getBeanInfoFactory() { return delegate.getBeanInfoFactory(); } public Object newInstance() throws Throwable { return delegate.newInstance(); } public Object newInstance(String[] paramTypes, Object[] params) throws Throwable { return delegate.newInstance(paramTypes, params); } public Object newInstance(Class[] paramTypes, Object[] params) throws Throwable { return delegate.newInstance(paramTypes, params); } public Object newInstance(TypeInfo[] paramTypes, Object[] params) throws Throwable { return delegate.newInstance(paramTypes, params); } public Object getProperty(Object bean, String name) throws Throwable { return delegate.getProperty(bean, name); } public void setProperty(Object bean, String name, Object value) throws Throwable { delegate.setProperty(bean, name, value); } public Object invoke(Object bean, String name) throws Throwable { return delegate.invoke(bean, name); } public Object invoke(Object bean, String name, String[] paramTypes, Object[] params) throws Throwable { return delegate.invoke(bean, name, paramTypes, params); } public Object invoke(Object bean, String name, Class[] paramTypes, Object[] params) throws Throwable { return delegate.invoke(bean, name, paramTypes, params); } public Object invoke(Object bean, String name, TypeInfo[] paramTypes, Object[] params) throws Throwable { return delegate.invoke(bean, name, paramTypes, params); } public Object invokeStatic(String name) throws Throwable { return delegate.invokeStatic(name); } public Object invokeStatic(String name, String[] paramTypes, Object[] params) throws Throwable { return delegate.invokeStatic(name, paramTypes, params); } public Object invokeStatic(String name, Class[] paramTypes, Object[] params) throws Throwable { return delegate.invokeStatic(name, paramTypes, params); } public Object invokeStatic(String name, TypeInfo[] paramTypes, Object[] params) throws Throwable { return delegate.invokeStatic(name, paramTypes, params); } public String toShortString() { return delegate.toShortString(); } public void toShortString(JBossStringBuilder buffer) { delegate.toShortString(buffer); } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/beans/info/spi/PropertyInfo.java0000644000175000017500000000574710770475034031557 0ustar twernertwerner/* * 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.beans.info.spi; import org.jboss.reflect.spi.AnnotatedInfo; import org.jboss.reflect.spi.MethodInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.reflect.spi.FieldInfo; /** * Description of a property. * * @author Adrian Brock * @version $Revision: 71064 $ */ public interface PropertyInfo extends AnnotatedInfo { /** * Get the BeanInfo * * @return the bean info */ BeanInfo getBeanInfo(); /** * Get the property name * * @return the name */ String getName(); /** * Get the uppercase version of the property name * * @return the name */ String getUpperName(); /** * Get the type * * @return the type */ TypeInfo getType(); /** * Get the getter * * @return the getter */ MethodInfo getGetter(); /** * Set the getter * * @param getter the getter */ void setGetter(MethodInfo getter); /** * Get the setter * * @return the setter */ MethodInfo getSetter(); /** * Set the setter * * @param setter the setter */ void setSetter(MethodInfo setter); /** * Is property readable. * * @return true if the property is readable */ boolean isReadable(); /** * Is property writable. * * @return true if the property is writable */ boolean isWritable(); /** * Get the property value * * @param bean the bean * @return the property value * @throws Throwable for any error */ Object get(Object bean) throws Throwable; /** * Set the property value * * @param bean the bean * @param value the property value * @throws Throwable for any error */ void set(Object bean, Object value) throws Throwable; /** * Get the field info * in case impl uses field to * handle property ops. * * @return the field info or null if no such info available */ FieldInfo getFieldInfo(); } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/joinpoint/0000755000175000017500000000000011620314127025420 5ustar twernertwernerlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/joinpoint/plugins/0000755000175000017500000000000011620314127027101 5ustar twernertwerner././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/joinpoint/plugins/BasicJoinpointFactory.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/joinpoint/plugins/BasicJoinpointFactory.0000644000175000017500000000565211042322360033351 0ustar twernertwerner/* * 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.joinpoint.plugins; import org.jboss.joinpoint.spi.ConstructorJoinpoint; import org.jboss.joinpoint.spi.FieldGetJoinpoint; import org.jboss.joinpoint.spi.FieldSetJoinpoint; import org.jboss.joinpoint.spi.JoinpointException; import org.jboss.joinpoint.spi.JoinpointFactory; import org.jboss.joinpoint.spi.MethodJoinpoint; 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.util.JBossObject; import org.jboss.util.JBossStringBuilder; /** * A basic join point factory * * @author Adrian Brock */ public class BasicJoinpointFactory extends JBossObject implements JoinpointFactory { /** The class info */ protected ClassInfo classInfo; public BasicJoinpointFactory(ClassInfo classInfo) { this.classInfo = classInfo; } public ClassInfo getClassInfo() { return classInfo; } public ConstructorJoinpoint getConstructorJoinpoint(ConstructorInfo constructorInfo) throws JoinpointException { return new BasicConstructorJoinPoint(constructorInfo); } public ConstructorJoinpoint getConstructorJoinpoint(ConstructorInfo constructorInfo, Object metaData) throws JoinpointException { return getConstructorJoinpoint(constructorInfo); } public FieldGetJoinpoint getFieldGetJoinpoint(FieldInfo fieldInfo) throws JoinpointException { return new BasicFieldGetJoinPoint(fieldInfo); } public FieldSetJoinpoint getFieldSetJoinpoint(FieldInfo fieldInfo) throws JoinpointException { return new BasicFieldSetJoinPoint(fieldInfo); } public MethodJoinpoint getMethodJoinpoint(MethodInfo methodInfo) throws JoinpointException { return new BasicMethodJoinPoint(methodInfo); } public void toString(JBossStringBuilder buffer) { buffer.append("classInfo=").append(classInfo.getName()); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/joinpoint/plugins/BasicConstructorJoinPoint.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/joinpoint/plugins/BasicConstructorJoinPo0000644000175000017500000000452210405527603033442 0ustar twernertwerner/* * 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.joinpoint.plugins; import org.jboss.joinpoint.spi.ConstructorJoinpoint; import org.jboss.reflect.spi.ConstructorInfo; import org.jboss.util.UnreachableStatementException; /** * A constructor joinpoint * * @author Adrian Brock */ public class BasicConstructorJoinPoint implements ConstructorJoinpoint { /** The constructor info */ protected ConstructorInfo constructorInfo; /** The arguments */ protected Object[] arguments; /** * Create a new constructor join point * * @param constructorInfo the constructor info */ public BasicConstructorJoinPoint(ConstructorInfo constructorInfo) { this.constructorInfo = constructorInfo; } public ConstructorInfo getConstructorInfo() { return constructorInfo; } public Object[] getArguments() { return arguments; } public void setArguments(Object[] args) { this.arguments = args; } public Object clone() { try { return super.clone(); } catch (CloneNotSupportedException e) { throw new UnreachableStatementException(); } } public Object dispatch() throws Throwable { return constructorInfo.newInstance(arguments); } public String toHumanReadableString() { return constructorInfo.toString(); } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/joinpoint/plugins/BasicJoinpointFactoryBuilder.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/joinpoint/plugins/BasicJoinpointFactoryB0000644000175000017500000000276210540110763033400 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.joinpoint.plugins; import org.jboss.joinpoint.spi.JoinpointFactory; import org.jboss.joinpoint.spi.JoinpointFactoryBuilder; import org.jboss.reflect.spi.ClassInfo; /** * BasicJoinpointFactoryBuilder. * * @author Adrian Brock * @version $Revision: 59020 $ */ public class BasicJoinpointFactoryBuilder implements JoinpointFactoryBuilder { public JoinpointFactory createJoinpointFactory(ClassInfo classInfo) { return new BasicJoinpointFactory(classInfo); } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/joinpoint/plugins/package.html0000644000175000017500000000146510405527603031375 0ustar twernertwerner

Basic Join Points.

Package Specification

Related Documentation

Package Status

  • ALPHA

Todo

  • ???
././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/joinpoint/plugins/BasicFieldSetJoinPoint.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/joinpoint/plugins/BasicFieldSetJoinPoint0000644000175000017500000000406110405527603033325 0ustar twernertwerner/* * 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.joinpoint.plugins; import org.jboss.joinpoint.spi.FieldSetJoinpoint; import org.jboss.reflect.spi.FieldInfo; /** * A field set joinpoint * * @author Adrian Brock */ public class BasicFieldSetJoinPoint extends BasicTargettedJoinPoint implements FieldSetJoinpoint { /** The field info */ protected FieldInfo fieldInfo; /** The value */ protected Object value; /** * Create a new field set join point * * @param fieldInfo the field info */ public BasicFieldSetJoinPoint(FieldInfo fieldInfo) { this.fieldInfo = fieldInfo; } public FieldInfo getFieldInfo() { return fieldInfo; } /** * Get the value * * @return the value */ public Object getValue() { return value; } public void setValue(Object value) { this.value = value; } public Object dispatch() throws Throwable { return fieldInfo.set(target, value); } public String toHumanReadableString() { return "SET " + fieldInfo.toString(); } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/joinpoint/plugins/BasicFieldGetJoinPoint.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/joinpoint/plugins/BasicFieldGetJoinPoint0000644000175000017500000000346310405527603033316 0ustar twernertwerner/* * 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.joinpoint.plugins; import org.jboss.joinpoint.spi.FieldGetJoinpoint; import org.jboss.reflect.spi.FieldInfo; /** * A field get joinpoint * * @author Adrian Brock */ public class BasicFieldGetJoinPoint extends BasicTargettedJoinPoint implements FieldGetJoinpoint { /** The field info */ protected FieldInfo fieldInfo; /** * Create a new field get join point * * @param fieldInfo the field info */ public BasicFieldGetJoinPoint(FieldInfo fieldInfo) { this.fieldInfo = fieldInfo; } public FieldInfo getFieldInfo() { return fieldInfo; } public Object dispatch() throws Throwable { return fieldInfo.get(target); } public String toHumanReadableString() { return "GET " + fieldInfo.toString(); } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/joinpoint/plugins/Config.java0000644000175000017500000003717411111504100031150 0ustar twernertwerner/* * 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.joinpoint.plugins; import java.util.Arrays; import org.jboss.joinpoint.spi.ConstructorJoinpoint; import org.jboss.joinpoint.spi.FieldGetJoinpoint; import org.jboss.joinpoint.spi.FieldSetJoinpoint; import org.jboss.joinpoint.spi.JoinpointException; import org.jboss.joinpoint.spi.JoinpointFactory; import org.jboss.joinpoint.spi.MethodJoinpoint; import org.jboss.logging.Logger; 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.TypeInfo; /** * Config utilities. * * @author Adrian Brock * @author Ales Justin * @version $Revision: 81413 $ */ public class Config { /** The log */ protected static final Logger log = Logger.getLogger(Config.class); /** No parameter types */ private static final String[] NO_PARAMS_TYPES = new String[0]; /** No parameters */ private static final Object[] NO_PARAMS = new Object[0]; /** * Instantiate an object * * @param jpf the join point factory * @param paramTypes the parameter types * @param params the parameters * @return the instantiated object * @throws Throwable for any error */ public static Object instantiate(JoinpointFactory jpf, String[] paramTypes, Object[] params) throws Throwable { ConstructorJoinpoint joinpoint = getConstructorJoinpoint(jpf, paramTypes, params); return joinpoint.dispatch(); } /** * Configure a field * * @param object the object to configure * @param jpf the join point factory * @param name the name of the field * @param value the value * @throws Throwable for any error */ public static void configure(Object object, JoinpointFactory jpf, String name, Object value) throws Throwable { FieldSetJoinpoint joinpoint = getFieldSetJoinpoint(object, jpf, name, value); joinpoint.dispatch(); } /** * Unconfigure a field * * @param object the object to unconfigure * @param jpf the join point factory * @param name the name of the field * @throws Throwable for any error */ public static void unconfigure(Object object, JoinpointFactory jpf, String name) throws Throwable { FieldSetJoinpoint joinpoint = getFieldSetJoinpoint(object, jpf, name, null); joinpoint.dispatch(); } /** * Invoke a method * * @param object the object to invoke * @param jpf the join point factory * @param name the name of the method * @param paramTypes the parameter types * @param params the parameters * @return the result of the invocation * @throws Throwable for any error */ public static Object invoke(Object object, JoinpointFactory jpf, String name, String[] paramTypes, Object[] params) throws Throwable { MethodJoinpoint joinpoint = getMethodJoinpoint(object, jpf, name, paramTypes, params); return joinpoint.dispatch(); } /** * Get a constructor Joinpoint * * @param jpf the join point factory * @return the Joinpoint * @throws Throwable for any error */ public static ConstructorJoinpoint getConstructorJoinpoint(JoinpointFactory jpf) throws Throwable { return getConstructorJoinpoint(jpf, null, null); } /** * Get a constructor Joinpoint * * @param jpf the join point factory * @param paramTypes the parameter types * @param params the parameters * @return the Joinpoint * @throws Throwable for any error */ public static ConstructorJoinpoint getConstructorJoinpoint(JoinpointFactory jpf, String[] paramTypes, Object[] params) throws Throwable { if (paramTypes == null) paramTypes = NO_PARAMS_TYPES; if (params == null) params = NO_PARAMS; boolean trace = log.isTraceEnabled(); if (trace) log.trace("Get constructor Joinpoint jpf=" + jpf + " paramTypes=" + Arrays.asList(paramTypes) + " params=" + Arrays.asList(params)); ConstructorInfo constructorInfo = findConstructorInfo(jpf.getClassInfo(), paramTypes); ConstructorJoinpoint joinpoint = jpf.getConstructorJoinpoint(constructorInfo); joinpoint.setArguments(params); return joinpoint; } /** * Get a field get joinpoint * * @param object the object to configure * @param jpf the join point factory * @param name the name of the field * @return the Joinpoint * @throws Throwable for any error */ public static FieldGetJoinpoint getFieldGetJoinpoint(Object object, JoinpointFactory jpf, String name) throws Throwable { boolean trace = log.isTraceEnabled(); if (trace) log.trace("Get field get Joinpoint jpf=" + jpf + " target=" + object + " name=" + name); FieldInfo fieldInfo = findFieldInfo(jpf.getClassInfo(), name); FieldGetJoinpoint joinpoint = jpf.getFieldGetJoinpoint(fieldInfo); joinpoint.setTarget(object); return joinpoint; } /** * Get a field set joinpoint * * @param object the object to configure * @param jpf the join point factory * @param name the name of the field * @param value the value * @return the Joinpoint * @throws Throwable for any error */ public static FieldSetJoinpoint getFieldSetJoinpoint(Object object, JoinpointFactory jpf, String name, Object value) throws Throwable { boolean trace = log.isTraceEnabled(); if (trace) log.trace("Get field set Joinpoint jpf=" + jpf + " target=" + object + " name=" + name + " value=" + value); FieldInfo fieldInfo = findFieldInfo(jpf.getClassInfo(), name); FieldSetJoinpoint joinpoint = jpf.getFieldSetJoinpoint(fieldInfo); joinpoint.setTarget(object); joinpoint.setValue(value); return joinpoint; } /** * Get a method joinpoint * * @param object the object to invoke * @param jpf the join point factory * @param name the name of the method * @param paramTypes the parameter types * @param params the parameters * @return the join point * @throws Throwable for any error */ public static MethodJoinpoint getMethodJoinpoint(Object object, JoinpointFactory jpf, String name, String[] paramTypes, Object[] params) throws Throwable { boolean trace = log.isTraceEnabled(); if (trace) { if (paramTypes != null) log.trace("Get method Joinpoint jpf=" + jpf + " target=" + object + " name=" + name + " paramTypes=" + Arrays.asList(paramTypes)); else log.trace("Get method Joinpoint jpf=" + jpf + " target=" + object + " name=" + name + " paramTypes=()"); } MethodInfo methodInfo = findMethodInfo(jpf.getClassInfo(), name, paramTypes); MethodJoinpoint joinpoint = jpf.getMethodJoinpoint(methodInfo); joinpoint.setTarget(object); joinpoint.setArguments(params); return joinpoint; } /** * Get a static method joinpoint * * @param jpf the join point factory * @param name the name of the method * @param paramTypes the parameter types * @param params the parameters * @return the join point * @throws Throwable for any error */ public static MethodJoinpoint getStaticMethodJoinpoint(JoinpointFactory jpf, String name, String[] paramTypes, Object[] params) throws Throwable { boolean trace = log.isTraceEnabled(); if (trace) { if (paramTypes != null) log.trace("Get method Joinpoint jpf=" + jpf + " name=" + name + " paramTypes=" + Arrays.asList(paramTypes)); else log.trace("Get method Joinpoint jpf=" + jpf + " name=" + name + " paramTypes=()"); } MethodInfo methodInfo = findMethodInfo(jpf.getClassInfo(), name, paramTypes, true, true); MethodJoinpoint joinpoint = jpf.getMethodJoinpoint(methodInfo); joinpoint.setArguments(params); return joinpoint; } /** * Find constructor info * * @param classInfo the class info * @param paramTypes the parameter types * @return the constructor info * @throws JoinpointException when no such constructor */ public static ConstructorInfo findConstructorInfo(ClassInfo classInfo, String[] paramTypes) throws JoinpointException { ConstructorInfo[] constructors = classInfo.getDeclaredConstructors(); if (constructors != null) { for (ConstructorInfo constructor : constructors) { if (equals(paramTypes, constructor.getParameterTypes())) return constructor; } throw new JoinpointException("Constructor not found " + classInfo.getName() + Arrays.asList(paramTypes) + " in " + Arrays.asList(constructors)); } throw new JoinpointException("Constructor not found " + classInfo.getName() + Arrays.asList(paramTypes) + " no constructors"); } /** * Find field info * * @param classInfo the class info * @param name the field name * @return the field info * @throws JoinpointException when no such field */ public static FieldInfo findFieldInfo(ClassInfo classInfo, String name) throws JoinpointException { if (classInfo == null) throw new IllegalArgumentException("ClassInfo cannot be null!"); ClassInfo current = classInfo; while (current != null) { FieldInfo result = locateFieldInfo(current, name); if (result != null) return result; current = current.getSuperclass(); } throw new JoinpointException("Field not found '" + name + "' for class " + classInfo.getName()); } /** * Find field info * * @param classInfo the class info * @param name the field name * @return the field info or null if not found */ private static FieldInfo locateFieldInfo(ClassInfo classInfo, String name) { FieldInfo[] fields = classInfo.getDeclaredFields(); if (fields != null) { for (FieldInfo field : fields) { if (name.equals(field.getName())) return field; } } return null; } /** * Find method info * * @param classInfo the class info * @param name the method name * @param paramTypes the parameter types * @return the method info * @throws JoinpointException when no such method */ public static MethodInfo findMethodInfo(ClassInfo classInfo, String name, String[] paramTypes) throws JoinpointException { return findMethodInfo(classInfo, name, paramTypes, false, true); } /** * Find method info * * @param classInfo the class info * @param name the method name * @param paramTypes the parameter types * @param strict is strict about method modifiers * @return the method info * @throws JoinpointException when no such method */ public static MethodInfo findMethodInfo(ClassInfo classInfo, String name, String[] paramTypes, boolean strict) throws JoinpointException { return findMethodInfo(classInfo, name, paramTypes, false, true, strict); } /** * Find method info * * @param classInfo the class info * @param name the method name * @param paramTypes the parameter types * @param isStatic must the method be static * @param isPublic must the method be public * @return the method info * @throws JoinpointException when no such method */ public static MethodInfo findMethodInfo(ClassInfo classInfo, String name, String[] paramTypes, boolean isStatic, boolean isPublic) throws JoinpointException { return findMethodInfo(classInfo, name, paramTypes, isStatic, isPublic, true); } /** * Find method info * * @param classInfo the class info * @param name the method name * @param paramTypes the parameter types * @param isStatic must the method be static * @param isPublic must the method be public * @param strict is strict about method modifiers * @return the method info * @throws JoinpointException when no such method */ public static MethodInfo findMethodInfo(ClassInfo classInfo, String name, String[] paramTypes, boolean isStatic, boolean isPublic, boolean strict) throws JoinpointException { if (name == null) throw new IllegalArgumentException("Null name"); if (classInfo == null) throw new IllegalArgumentException("ClassInfo cannot be null!"); if (paramTypes == null) paramTypes = NO_PARAMS_TYPES; ClassInfo current = classInfo; while (current != null) { MethodInfo result = locateMethodInfo(current, name, paramTypes, isStatic, isPublic, strict); if (result != null) return result; current = current.getSuperclass(); } throw new JoinpointException("Method not found " + name + Arrays.asList(paramTypes) + " for class " + classInfo.getName()); } /** * Find method info * * @param classInfo the class info * @param name the method name * @param paramTypes the parameter types * @param isStatic must the method be static * @param isPublic must the method be public * @param strict is strict about method modifiers * @return the method info or null if not found */ private static MethodInfo locateMethodInfo(ClassInfo classInfo, String name, String[] paramTypes, boolean isStatic, boolean isPublic, boolean strict) { MethodInfo[] methods = classInfo.getDeclaredMethods(); if (methods != null) { for (MethodInfo method : methods) { if (name.equals(method.getName()) && equals(paramTypes, method.getParameterTypes()) && (strict == false || (method.isStatic() == isStatic && method.isPublic() == isPublic))) return method; } } return null; } /** * Test whether type names are equal to type infos * * @param typeNames the type names * @param typeInfos the type infos * @return true when they are equal */ public static boolean equals(String[] typeNames, TypeInfo[] typeInfos) { if (simpleCheck(typeNames, typeInfos) == false) return false; for (int i = 0; i < typeNames.length; ++i) { if (typeNames[i] != null && typeNames[i].equals(typeInfos[i].getName()) == false) return false; } return true; } /** * A simple null and length check. * * @param typeNames the type names * @param typeInfos the type infos * @return false if either argument is null or lengths differ, else true */ protected static boolean simpleCheck(String[] typeNames, TypeInfo[] typeInfos) { return typeNames != null && typeInfos != null && typeNames.length == typeInfos.length; } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/joinpoint/plugins/BasicMethodJoinPoint.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/joinpoint/plugins/BasicMethodJoinPoint.j0000644000175000017500000000401110405527603033271 0ustar twernertwerner/* * 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.joinpoint.plugins; import org.jboss.joinpoint.spi.MethodJoinpoint; import org.jboss.reflect.spi.MethodInfo; /** * A method joinpoint * * @author Adrian Brock */ public class BasicMethodJoinPoint extends BasicTargettedJoinPoint implements MethodJoinpoint { /** The method info */ protected MethodInfo methodInfo; /** The arguments */ protected Object[] arguments; /** * Create a new method join point * * @param methodInfo the methodInfo */ public BasicMethodJoinPoint(MethodInfo methodInfo) { this.methodInfo = methodInfo; } public MethodInfo getMethodInfo() { return methodInfo; } public Object[] getArguments() { return arguments; } public void setArguments(Object[] args) { this.arguments = args; } public Object dispatch() throws Throwable { return methodInfo.invoke(target, arguments); } public String toHumanReadableString() { return methodInfo.toString(); } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/joinpoint/plugins/BasicTargettedJoinPoint.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/joinpoint/plugins/BasicTargettedJoinPoin0000644000175000017500000000325410405527603033370 0ustar twernertwerner/* * 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.joinpoint.plugins; import org.jboss.joinpoint.spi.TargettedJoinpoint; import org.jboss.util.UnreachableStatementException; /** * A targetted joinpoint * * @author Adrian Brock */ public abstract class BasicTargettedJoinPoint implements TargettedJoinpoint { /** The target */ protected Object target; public Object getTarget() { return target; } public void setTarget(Object target) { this.target = target; } public Object clone() { try { return super.clone(); } catch (CloneNotSupportedException e) { throw new UnreachableStatementException(); } } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/joinpoint/spi/0000755000175000017500000000000011620314127026213 5ustar twernertwernerlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/joinpoint/spi/TargettedJoinpoint.java0000644000175000017500000000273710374121046032705 0ustar twernertwerner/* * 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.joinpoint.spi; /** * A join point with a target * * @author Bill Burke * @author Adrian Brock */ public interface TargettedJoinpoint extends Joinpoint { /** * Get the target of the join point * * @return the target of the join point */ Object getTarget(); /** * Set the target of the join point * * @param target the target */ void setTarget(Object target); } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/joinpoint/spi/FieldGetJoinpoint.java0000644000175000017500000000261010374121046032433 0ustar twernertwerner/* * 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.joinpoint.spi; import org.jboss.reflect.spi.FieldInfo; /** * A field get join point * * @author Bill Burke * @author Adrian Brock */ public interface FieldGetJoinpoint extends TargettedJoinpoint { /** * Get the field info for this join point * * @return the field info */ FieldInfo getFieldInfo(); } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/joinpoint/spi/Joinpoint.java0000644000175000017500000000322210374121046031027 0ustar twernertwerner/* * 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.joinpoint.spi; /** * A join point * * @author Bill Burke * @author Adrian Brock */ public interface Joinpoint extends Cloneable { /** * Invoke on the actual joinpoint * * @return the result of the invocation * @throws Throwable for any error */ Object dispatch() throws Throwable; /** * Make a copy of the joinpoint * * @return a copy of the join point */ Object clone(); /** * A human readable version of the join point * * @return a human readable description of the join point */ String toHumanReadableString(); } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/joinpoint/spi/JoinpointFactoryBuilder.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/joinpoint/spi/JoinpointFactoryBuilder.ja0000644000175000017500000000263110540110763033341 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, 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.joinpoint.spi; import org.jboss.reflect.spi.ClassInfo; /** * JoinpointFactoryBuilder. * * @author Adrian Brock * @version $Revision: 59020 $ */ public interface JoinpointFactoryBuilder { /** * Create a joinpoint factory * * @param classInfo the class info * @return the joinpoint factory */ JoinpointFactory createJoinpointFactory(ClassInfo classInfo); } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/joinpoint/spi/ConstructorJoinpoint.java0000644000175000017500000000325210374121046033300 0ustar twernertwerner/* * 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.joinpoint.spi; import org.jboss.reflect.spi.ConstructorInfo; /** * A constructor join point. * * @author Bill Burke * @author Adrian Brock */ public interface ConstructorJoinpoint extends Joinpoint { /** * Get the constructor info for this join point * * @return the constructor info */ ConstructorInfo getConstructorInfo(); /** * Get the arguments for the constructor * * @return the arguments */ Object[] getArguments(); /** * Set the arguments for the constructor * * @param args the arguments */ void setArguments(Object[] args); } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/joinpoint/spi/package.html0000644000175000017500000000146210271236104030476 0ustar twernertwerner

Join Point API.

Package Specification

Related Documentation

Package Status

  • ALPHA

Todo

  • ???
libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/joinpoint/spi/JoinpointException.java0000644000175000017500000000335110374121046032711 0ustar twernertwerner/* * 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.joinpoint.spi; /** * Thrown when an invocation context does not exist * * @author Adrian Brock * @version $Revision: 41135 $ */ public class JoinpointException extends RuntimeException { /** The serialVersionUID */ private static final long serialVersionUID = 3257572793343030583L; /** * Create a new join point exception * * @param description the description */ public JoinpointException(String description) { super(description); } /** * Create a new join point exception * * @param description the description * @param cause the cause */ public JoinpointException(String description, Throwable cause) { super(description, cause); } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/joinpoint/spi/MethodJoinpoint.java0000644000175000017500000000317610374121046032200 0ustar twernertwerner/* * 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.joinpoint.spi; import org.jboss.reflect.spi.MethodInfo; /** * A method join point * * @author Bill Burke * @author Adrian Brock */ public interface MethodJoinpoint extends TargettedJoinpoint { /** * Get the method info * * @return the method info */ MethodInfo getMethodInfo(); /** * Get the arguments of the join point * * @return the arguments */ Object[] getArguments(); /** * Set the arguments of the method invocation * * @param args the arguments */ void setArguments(Object[] args); } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/joinpoint/spi/FieldSetJoinpoint.java0000644000175000017500000000277110374121046032457 0ustar twernertwerner/* * 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.joinpoint.spi; import org.jboss.reflect.spi.FieldInfo; /** * A field set join point * * @author Bill Burke * @author Adrian Brock */ public interface FieldSetJoinpoint extends TargettedJoinpoint { /** * Get the field info for this join point * * @return the field info */ FieldInfo getFieldInfo(); /** * The value to set * * @param value the value to set */ void setValue(Object value); } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/joinpoint/spi/JoinpointFactory.java0000644000175000017500000000562711042322360032365 0ustar twernertwerner/* * 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.joinpoint.spi; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.ConstructorInfo; import org.jboss.reflect.spi.FieldInfo; import org.jboss.reflect.spi.MethodInfo; /** * A join point factory. * * @author Adrian Brock */ public interface JoinpointFactory { /** * Get the class info for this join point factory * * @return the class info */ ClassInfo getClassInfo(); /** * Get a constructor join point * * @param constructorInfo the constructor info * @return the constructor join point * @throws JoinpointException when no such constructor */ ConstructorJoinpoint getConstructorJoinpoint(ConstructorInfo constructorInfo) throws JoinpointException; /** * Get a constructor join point * * @param constructorInfo the constructor info * @param metaData the metaData * @return the constructor join point * @throws JoinpointException when no such constructor */ ConstructorJoinpoint getConstructorJoinpoint(ConstructorInfo constructorInfo, Object metaData) throws JoinpointException; /** * Get a field get join point * * @param fieldInfo the field info * @return the field get join point * @throws JoinpointException when no such field */ FieldGetJoinpoint getFieldGetJoinpoint(FieldInfo fieldInfo) throws JoinpointException; /** * Get a field set join point * * @param fieldInfo the field info * @return the field set join point * @throws JoinpointException when no such field */ FieldSetJoinpoint getFieldSetJoinpoint(FieldInfo fieldInfo) throws JoinpointException; /** * Get a method join point * * @param methodInfo the method info * @return the method join point * @throws JoinpointException when no such method */ MethodJoinpoint getMethodJoinpoint(MethodInfo methodInfo) throws JoinpointException; } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/classadapter/0000755000175000017500000000000011620314126026054 5ustar twernertwernerlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/classadapter/plugins/0000755000175000017500000000000011620314126027535 5ustar twernertwernerlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/classadapter/plugins/package.html0000644000175000017500000000146710405533602032030 0ustar twernertwerner

Basic Class Adapter.

Package Specification

Related Documentation

Package Status

  • ALPHA

Todo

  • ???
././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/classadapter/plugins/BasicClassAdapterFactory.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/classadapter/plugins/BasicClassAdapterFa0000644000175000017500000000505610756326650033263 0ustar twernertwerner/* * 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.classadapter.plugins; import org.jboss.classadapter.spi.ClassAdapter; import org.jboss.classadapter.spi.ClassAdapterFactory; import org.jboss.config.spi.Configuration; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.reflect.spi.TypeInfoFactory; /** * A class adapter factory. * * @author Adrian Brock */ public class BasicClassAdapterFactory implements ClassAdapterFactory { /** The type info factory */ protected Configuration configuration; public Configuration getConfiguration() { return configuration; } public void setConfiguration(Configuration configuration) { this.configuration = configuration; } public ClassAdapter getClassAdapter(Class clazz) { TypeInfoFactory typeInfoFactory = configuration.getTypeInfoFactory(); TypeInfo typeInfo = typeInfoFactory.getTypeInfo(clazz); return getClassAdapter(typeInfo); } public ClassAdapter getClassAdapter(String name, ClassLoader cl) throws ClassNotFoundException { TypeInfoFactory typeInfoFactory = configuration.getTypeInfoFactory(); TypeInfo typeInfo = typeInfoFactory.getTypeInfo(name, cl); return getClassAdapter(typeInfo); } public ClassAdapter getClassAdapter(TypeInfo typeInfo) { if (typeInfo instanceof ClassInfo == false) throw new IllegalArgumentException("Not a class " + typeInfo.getName()); ClassInfo classInfo = (ClassInfo) typeInfo; return new BasicClassAdapter(this, classInfo); } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/classadapter/plugins/BasicClassAdapter.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/classadapter/plugins/BasicClassAdapter.j0000644000175000017500000000452210770506700033231 0ustar twernertwerner/* * 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.classadapter.plugins; import org.jboss.classadapter.spi.ClassAdapter; import org.jboss.classadapter.spi.ClassAdapterFactory; import org.jboss.joinpoint.spi.JoinpointFactory; import org.jboss.joinpoint.spi.JoinpointFactoryBuilder; import org.jboss.reflect.spi.ClassInfo; import org.jboss.util.JBossObject; /** * A class adapter. * * @author Adrian Brock */ public class BasicClassAdapter extends JBossObject implements ClassAdapter { /** The class adapter factory */ protected ClassAdapterFactory classAdapterFactory; /** The class info */ protected ClassInfo classInfo; /** * Create a new reflected class adapter * * @param factory class adapter factory * @param classInfo class info */ public BasicClassAdapter(ClassAdapterFactory factory, ClassInfo classInfo) { this.classAdapterFactory = factory; this.classInfo = classInfo; } public ClassInfo getClassInfo() { return classInfo; } public JoinpointFactory getJoinpointFactory() { JoinpointFactoryBuilder builder = classAdapterFactory.getConfiguration().getJoinpointFactoryBuilder(); return builder.createJoinpointFactory(classInfo); } @SuppressWarnings("deprecation") public ClassLoader getClassLoader() { return classInfo.getType().getClassLoader(); } } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/classadapter/spi/0000755000175000017500000000000011620314126026647 5ustar twernertwernerlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/classadapter/spi/ClassAdapter.java0000644000175000017500000000450010763231257032071 0ustar twernertwerner/* * 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.classadapter.spi; import org.jboss.joinpoint.spi.JoinpointFactory; import org.jboss.reflect.spi.ClassInfo; import org.jboss.util.JBossInterface; /** * A class adapter.

* * A class adapter is the integration point for manipulating * class information at runtime, e.g. overriding annotations * or obtaining an aop instance advisor.

* * The class adapter has the following protocol. * *

    *
  1. Use getClassInfo to obtain information about * the class. *
  2. Obtain an Instance ClassAdapter if the class information * should be overridden at the instance level, e.g. annotations *
  3. Obtain the dependencies of the Class/Instance and any * advice factories, e.g. @Depends annotations *
  4. Obtain the JoinpointFactory so the instance can be * constructed. *
* * @author Adrian Brock */ public interface ClassAdapter extends JBossInterface { /** * Get the class info. * * @return the class info */ ClassInfo getClassInfo(); /** * Get the Joinpoint Factory for this adapter. * * @return the joinpoint factory */ JoinpointFactory getJoinpointFactory(); /** * Get the classloader associated with this class adapter * * @return the classloader */ ClassLoader getClassLoader(); } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/classadapter/spi/ClassAdapterFactory.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/classadapter/spi/ClassAdapterFactory.jav0000644000175000017500000000453510756326650033274 0ustar twernertwerner/* * 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.classadapter.spi; import org.jboss.config.spi.Configuration; import org.jboss.reflect.spi.TypeInfo; /** * A class adapter factory.

* * The ClassAdapterFactory serves as the entry point * for deciding whether it supports the class. e.g. * the AOP ClassAdapterFactory may return null * allowing the microcontainer to default back to * reflection for the class. * * @author Adrian Brock */ public interface ClassAdapterFactory { /** * Get a class adapter * * @param name the class name * @param cl the classloader * @return the class adapter * @throws ClassNotFoundException when there is no such class */ ClassAdapter getClassAdapter(String name, ClassLoader cl) throws ClassNotFoundException; /** * Get a class adapter * * @param clazz the class * @return the class adapter */ ClassAdapter getClassAdapter(Class clazz); /** * Get a class adapter * * @param typeInfo the type info * @return the class adapter */ ClassAdapter getClassAdapter(TypeInfo typeInfo); /** * Get the configuration. * * @return the configuration. */ Configuration getConfiguration(); /** * Set the typeInfoFactory. * * @param configuration the configuration. */ void setConfiguration(Configuration configuration); } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/classadapter/spi/package.html0000644000175000017500000000146510271236104031136 0ustar twernertwerner

Class Adapter API.

Package Specification

Related Documentation

Package Status

  • ALPHA

Todo

  • ???
libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/classloading/0000755000175000017500000000000011620314121026044 5ustar twernertwernerlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/classloading/spi/0000755000175000017500000000000011620314121026637 5ustar twernertwernerlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/classloading/spi/DomainClassLoader.java0000644000175000017500000000611710756326650033056 0ustar twernertwerner/* * 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.classloading.spi; import java.io.IOException; import java.net.URL; import java.util.Enumeration; /** * A classloader that can be put in a domain * * @author Adrian Brock * @version $Revision: 69888 $ */ public interface DomainClassLoader { /** * The domain of the classloader * * @return the domain */ ClassLoadingDomain getDomain(); /** * Set the domain of the classloader * * @param domain the domain */ void setDomain(ClassLoadingDomain domain); /** * Get the classpath * * @return the classpath */ public URL[] getClasspath(); /** * Load a class * * @param name the name * @return the class * @throws ClassNotFoundException */ Class loadClass(String name) throws ClassNotFoundException; /** * Load a class * * @param name the class name * @param resolve whether to resolve the class * @return the class * @throws ClassNotFoundException when there is not class */ Class loadClassLocally(String name, boolean resolve) throws ClassNotFoundException; /** * Get a resource * * @param name the resource name * @return the resource or null if not found */ URL loadResourceLocally(String name); /** * Find resources locally * * @param name the name of the resource * @return the resources * @throws IOException for any error */ Enumeration findResourcesLocally(String name) throws IOException; /** * Get the possible package names associated with the class loader. This * may be a superset of the currently defined Packages. * * @return unique package names of classes available to the class loader. */ public String[] getPackageNames(); /** * Get the packages defined by the classloader * * @return the packages */ Package[] getPackages(); /** * Get a package defined by the classloader * * @param name the name of the package * @return the package */ Package getPackage(String name); } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/classloading/spi/ClassLoadingDomain.javalibjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/classloading/spi/ClassLoadingDomain.java0000644000175000017500000000452610756326650033227 0ustar twernertwerner/* * 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.classloading.spi; import java.net.URL; import java.util.Enumeration; /** * A ClassLoadingDomain holds a number of classloaders. * * @author Adrian Brock * @version $Revision: 69888 $ */ public interface ClassLoadingDomain { // Constants ----------------------------------------------------- // Public -------------------------------------------------------- /** * Get the parent classloading domain * * @return the parent or null if there isn't one */ ClassLoadingDomain getParent(); /** * Load a class from this domain * * @param name the class to load * @param resolve whether to resolve the class * @param classLoader the requesting classloader * @return the class * @throws ClassNotFoundException when the class is not found */ Class loadClass(String name, boolean resolve, DomainClassLoader classLoader) throws ClassNotFoundException; /** * Get a resource * * @param name the resource name * @param classLoader the requesting classloader * @return the resource or null if not found */ URL getResource(String name, DomainClassLoader classLoader); Enumeration findResources(String name); Translator getTranslator(); // Inner classes ------------------------------------------------- } libjboss-reflect-java-2.0.3.GA.orig/src/main/java/org/jboss/classloading/spi/Translator.java0000644000175000017500000000604010474757231031656 0ustar twernertwerner/* * 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.classloading.spi; import java.lang.instrument.IllegalClassFormatException; import java.lang.instrument.Instrumentation; import java.security.ProtectionDomain; /** * An implementation of this interface in order to transform class files. * The transformation occurs before the class is defined by the JVM. * @see java.lang.instrument.ClassFileTransformer * * @author Scott.Stark@jboss.org * @version $Revision:$ */ public interface Translator { /** * The implementation of this method may transform the supplied class file and * return a new replacement class file. * * @param loader - the DomainClassLoader owning the defining loader of the * class to be transformed, may be null if the bootstrap loader * @param className - the name of the class in the internal form of fully * qualified class and interface names. * @param classBeingRedefined - if this is a redefine, the class being redefined, * otherwise null * @param protectionDomain - the protection domain of the class being defined or redefined * @param classfileBuffer - the input byte buffer in class file format - must not be modified * * @throws IllegalClassFormatException if the input does not represent a well-formed class file * @return a well-formed class file buffer (the result of the transform), or null if no transform is performed. * @see Instrumentation#redefineClasses */ public byte[] transform(DomainClassLoader loader, String className, Class classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException; /** Called to indicate that the ClassLoader is being discarded by the server. * * @param loader - a class loader that has possibly been used previously * as an argument to transform. */ public void unregisterClassLoader(DomainClassLoader loader); } libjboss-reflect-java-2.0.3.GA.orig/.settings/0000755000175000017500000000000011620314127020762 5ustar twernertwernerlibjboss-reflect-java-2.0.3.GA.orig/.settings/org.eclipse.jdt.core.prefs0000644000175000017500000000032010674774740025762 0ustar twernertwerner#Fri Sep 21 17:48:03 BST 2007 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.source=1.5 org.eclipse.jdt.core.compiler.compliance=1.5 libjboss-reflect-java-2.0.3.GA.orig/.project0000644000175000017500000000050111060213534020505 0ustar twernertwerner jboss-reflect JBoss Reflection org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature