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-2025 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/dsol/manual/" target="_blank">DSOL Manual</a>. The DSOL
8    * project is distributed under a three-clause BSD-style license, which can be found at
9    * <a href="https://simulation.tudelft.nl/dsol/docs/latest/license.html" target="_blank">DSOL License</a>.
10   * </p>
11   * @author <a href="https://www.linkedin.com/in/peterhmjacobs">Peter Jacobs </a>
12   * @author <a href="https://github.com/averbraeck">Alexander Verbraeck</a>
13   * @author Niels Lang.
14   * @since 1.5
15   */
16  public interface Introspector
17  {
18      /**
19       * @param introspected Object; the introspected object
20       * @return Retrieves properties of the introspected object. The properties' values can themselves be introspectable. An
21       *         empty array is returned if no introspected object has been set.
22       */
23      Property[] getProperties(Object introspected);
24  
25      /**
26       * Retrieves the names of the properties of the introspected object.
27       * @param introspected Object; The introspected object.
28       * @return An unordered array of the introspected object's property names.
29       */
30      String[] getPropertyNames(Object introspected);
31  
32      /**
33       * Retrieves the {see Property}with a given name from an introspected object.
34       * @param introspected Object; The introspected object.
35       * @param property String; The name of the property to be retrieved
36       * @return A {see Property}instance for the given object and property name.
37       */
38      Property getProperty(Object introspected, String property);
39  }