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
21   *         href="http://www.tbm.tudelft.nl/webstaf/peterja">Ir. P.H.M. Jacobs
22   *         </a> and <a href="http://www.tbm.tudelft.nl/webstaf/nielsl">Ir. N.A.
23   *         Lang </a>
24   */
25  public final class PTestFieldIntrospector
26  {
27  	/***
28  	 * constructs a new PTestFieldIntrospector
29  	 */
30  	private PTestFieldIntrospector()
31  	{
32  		super();
33  		//unreachable code
34  	}
35  
36  	/***
37  	 * executes the PTestFieldIntrospector
38  	 * 
39  	 * @param args the commandline arguments
40  	 */
41  	public static void main(final String[] args)
42  	{
43  		try
44  		{
45  			Logger.info(PTestFieldIntrospector.class, "main",
46  					"Running field introspector test");
47  			Property[] props = (new FieldIntrospector())
48  					.getProperties(new SubTestBean2());
49  			for (int i = 0; i < props.length; i++)
50  			{
51  				Logger.info(PTestFieldIntrospector.class, "main", "Prop name: "
52  						+ props[i].getName());
53  				Logger.info(PTestFieldIntrospector.class, "main",
54  						"Prop class: " + props[i].getType());
55  				Logger.info(PTestFieldIntrospector.class, "main",
56  						"Prop value: " + props[i].getValue());
57  				Logger.info(PTestFieldIntrospector.class, "main",
58  						"Setting Possible? ");
59  				props[i].setValue("TEST");
60  				Logger.info(PTestFieldIntrospector.class, "main",
61  						"If so, 'TEST' should be retrieved: "
62  								+ props[i].getValue());
63  			}
64  		} catch (Throwable throwable)
65  		{
66  			throwable.printStackTrace();
67  		}
68  	}
69  }