View Javadoc
1   package nl.tudelft.simulation.introspection;
2   
3   /**
4    * The introspector provides introspection services, i.e. property discovery and manipulation, for any object.
5    * <p>
6    * Copyright (c) 2002-2024 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See
7    * for project information <a href="https://simulation.tudelft.nl/" target="_blank"> https://simulation.tudelft.nl</a>. The DSOL
8    * project is distributed under a three-clause BSD-style license, which can be found at
9    * <a href="https://https://simulation.tudelft.nl/dsol/docs/latest/license.html" target="_blank">
10   * https://https://simulation.tudelft.nl/dsol/docs/latest/license.html</a>.
11   * </p>
12   * @author <a href="https://www.linkedin.com/in/peterhmjacobs">Peter Jacobs </a>
13   * @author <a href="https://www.tudelft.nl/averbraeck">Alexander Verbraeck</a>
14   * @author Niels Lang.
15   * @since 1.5
16   */
17  public interface Introspector
18  {
19      /**
20       * @param introspected Object; the introspected object
21       * @return Retrieves properties of the introspected object. The properties' values can themselves be introspectable. An
22       *         empty array is returned if no introspected object has been set.
23       */
24      Property[] getProperties(Object introspected);
25  
26      /**
27       * Retrieves the names of the properties of the introspected object.
28       * @param introspected Object; The introspected object.
29       * @return An unordered array of the introspected object's property names.
30       */
31      String[] getPropertyNames(Object introspected);
32  
33      /**
34       * Retrieves the {see Property}with a given name from an introspected object.
35       * @param introspected Object; The introspected object.
36       * @param property String; The name of the property to be retrieved
37       * @return A {see Property}instance for the given object and property name.
38       */
39      Property getProperty(Object introspected, String property);
40  }