1   package nl.tudelft.dsol.introspection;
2   
3   import nl.tudelft.dsol.introspection.beans.SubTestBean2;
4   import nl.tudelft.simulation.introspection.Property;
5   import nl.tudelft.simulation.introspection.fields.FieldIntrospector;
6   import nl.tudelft.simulation.logger.Logger;
7   
8   /***
9    * A test program for the field introspection implementation.
10   * 
11   * @author (c) 2003 <a href="http://www.tudelft.nl">Delft University of
12   *         Technology </a>, Delft, the Netherlands <br>
13   *         <a href="http://www.tbm.tudelft.nl">Faculty of Technology, Policy and
14   *         Management </a> <br>
15   *         <a href="http://www.sk.tbm.tudelft.nl">Department of System
16   *         Engineering </a> <br>
17   *         Main researcher : <a
18   *         href="http://www.tbm.tudelft.nl/webstaf/alexandv/">Dr. Ir. A.
19   *         Verbraeck <a/><br>
20   *         Assistant researchers <a href="http://www.peter-jacobs.com">Ir.
21   *         P.H.M. Jacobs </a> and <a
22   *         href="http://www.tbm.tudelft.nl/webstaf/nielsl">Ir. N.A. Lang </a>
23   */
24  public final class PTestFieldIntrospector
25  {
26      /***
27       * constructs a new PTestFieldIntrospector
28       */
29      private PTestFieldIntrospector()
30      {
31          super();
32          // unreachable code
33      }
34  
35      /***
36       * executes the PTestFieldIntrospector
37       * 
38       * @param args the commandline arguments
39       */
40      public static void main(final String[] args)
41      {
42          try
43          {
44              Logger.info(PTestFieldIntrospector.class, "main",
45                      "Running field introspector test");
46              Property[] props = (new FieldIntrospector())
47                      .getProperties(new SubTestBean2());
48              for (int i = 0; i < props.length; i++)
49              {
50                  Logger.info(PTestFieldIntrospector.class, "main", "Prop name: "
51                          + props[i].getName());
52                  Logger.info(PTestFieldIntrospector.class, "main",
53                          "Prop class: " + props[i].getType());
54                  Logger.info(PTestFieldIntrospector.class, "main",
55                          "Prop value: " + props[i].getValue());
56                  Logger.info(PTestFieldIntrospector.class, "main",
57                          "Setting Possible? ");
58                  props[i].setValue("TEST");
59                  Logger.info(PTestFieldIntrospector.class, "main",
60                          "If so, 'TEST' should be retrieved: "
61                                  + props[i].getValue());
62              }
63          } catch (Throwable throwable)
64          {
65              throwable.printStackTrace();
66          }
67      }
68  }