Adding a counter for unique transitions.
[jpf-core.git] / examples / Reflection.java
index ac036c2282b337771991cf372ab8676d508d54f5..801940e9e7e2c54e79b087ecd138e738bbff9046 100644 (file)
@@ -12,6 +12,8 @@ import java.util.Collection;
 import java.math.BigInteger;
 import java.security.ProtectionDomain;
 
+import java.beans.Introspector;
+
 public class Reflection {
 
     interface GenericSuperShort<XYZ> {
@@ -52,15 +54,27 @@ public class Reflection {
           }*/
        }
 
-   public static void main(String[] args) {
+   public static void main(String[] args) throws Exception {
           
-         BigInteger bi = new BigInteger("-1");
-         System.out.println(bi);
+         //BigInteger bi = new BigInteger("-1");
+         //System.out.println(bi);
+         /*StringBuilder sb = new StringBuilder(0);
+         sb.append('[');
+         sb.append(']');
+         System.out.println(sb.toString());*/
+         
+         //Class cls = Class.forName("groovy.runtime.metaclass.Logger.LoggerMetaClass");
+         //Class cls2 = Class.forName("groovy.runtime.metaclass.[Ljava.lang.Object;MetaClass");
+         //Class cls2 = Class.forName("[Ljava.lang.Object;BeanInfo");
+         Class cls = Object[].class;
+         System.out.println("Bean introspection do not ignore bean info: " + cls.getSimpleName());
+         System.out.println("Bean introspection do not ignore bean info: " + cls.getName());
+      Object obj = Introspector.getBeanInfo(cls);
           
-         /* TODO: Enumerate all methods in Class.class 
-      Method[] methods = Class.class.getMethods();
+         /* TODO: Enumerate all methods in Class.class
+      Method[] methods = Collection.class.getMethods();
       for(Method mth : methods) {
-                 //System.out.println("===========================");
+                 System.out.println("===========================");
          //System.out.println("Method: " + mth.getName());
                  Type[] parameters = mth.getGenericParameterTypes();
                  for (int i = 0; i < parameters.length; i++) {
@@ -71,28 +85,20 @@ public class Reflection {
                  System.out.println(returnType + "\n");
       }*/
 
-      Method[] methods = Collection.class.getMethods();
+      /*Method[] methods = Collection.class.getMethods();
       //  Method[] methods = Class.class.getMethods();
         Method method = null;
         for(Method meth : methods) {
-                               System.out.println("===========================");
-                               //System.out.println("Method: " + meth.toString());
-                               Type[] parameters = meth.getGenericParameterTypes();
-                               for (int i = 0; i < parameters.length; i++) {
-                                       System.out.println(parameters[i]);
-                               }
-                               Type returnType = meth.getGenericReturnType();
-                               System.out.println(returnType);
-                               System.out.println("===========================");
-        }
-        Type[] parameters = method.getGenericParameterTypes();
-      //Type[] parameters = methods[0].getGenericParameterTypes();
-      for (int i = 0; i < parameters.length; i++) {
-         System.out.println(parameters[i]);
-      }
-      System.out.println();
-      Type returnType = method.getGenericReturnType();
-      System.out.println(returnType);
+                       System.out.println("===========================");
+                       //System.out.println("Method: " + meth.toString());
+                       Type[] parameters = meth.getGenericParameterTypes();
+                       for (int i = 0; i < parameters.length; i++) {
+                               System.out.println(parameters[i]);
+                       }
+                       Type returnType = meth.getGenericReturnType();
+                       System.out.println(returnType);
+                       System.out.println("===========================");
+        }*/
          
         /* TODO: This is an excerpt of the BigInteger library
                int radix = 10;
@@ -170,11 +176,11 @@ public class Reflection {
             System.out.println(interfaces[i]);
         }*/
       
-      /*
-         Method[] methods = Collection.class.getMethods();
+      
+         /*Method[] methods = Map.class.getMethods();
          Method method = null;
       for(Method mth : methods) {
-        if (mth.getName().equals("toArray")) {
+        if (mth.getName().equals("putAll")) {
         //if (mth.getName().equals("isAssignableFrom")) {
         //if (mth.getName().equals("getSuperclass")) {
            method = mth;