View Javadoc
1   package nl.tudelft.simulation.introspection;
2   
3   /**
4    * A property defines a characteristic of an object. It has a name, a type and provides methods to view and alter its value.
5    * Different introspection implementation may provide different definitions for what exactly are regarded to be the 'properties'
6    * of an object.
7    * <p>
8    * Copyright (c) 2002-2025 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See
9    * for project information <a href="https://simulation.tudelft.nl/dsol/manual/" target="_blank">DSOL Manual</a>. The DSOL
10   * project is distributed under a three-clause BSD-style license, which can be found at
11   * <a href="https://simulation.tudelft.nl/dsol/docs/latest/license.html" target="_blank">DSOL License</a>.
12   * </p>
13   * @author <a href="https://www.linkedin.com/in/peterhmjacobs">Peter Jacobs </a>
14   * @author <a href="https://github.com/averbraeck">Alexander Verbraeck</a>
15   * @author Niels Lang.
16   * @since 1.5
17   */
18  public interface Property
19  {
20      /**
21       * Retrieves the name of the property.
22       * @return The name of the property
23       */
24      String getName();
25  
26      /**
27       * Returns the type of this property's value.
28       * @return A {see java.lang.Class}instance denoting the type of this property.
29       */
30      Class<?> getType();
31  
32      /**
33       * Returns whether the value of this property may be altered.
34       * @return 'True', when this property's value can be altered, 'false' otherwise.
35       */
36      boolean isEditable();
37  
38      /**
39       * Set the value of this property. However, if isEditable() returns 'false', the value of this property will not be altered.
40       * Composite property values (i.e. {see java.util.Collection}or arrays) should be provided as an instance of {see
41       * java.util.Collection}.
42       * @param value Object; The new value of this property.
43       */
44      void setValue(Object value);
45  
46      /**
47       * Returns the current value of this property.
48       * @return The current value of this property.
49       */
50      Object getValue();
51  
52      /**
53       * Retrieves the introspected object, which contains this Property.
54       * @return the instance
55       */
56      Object getInstance();
57  
58      /**
59       * Returns the collection type of the contained value (i.e. a composite value). The definition whether a value is considered
60       * composite depends on the property paradigm used by this Property.
61       * @return the CollectionTypeEnum of this Property.
62       */
63      ComposedTypeEnum getComposedType();
64  
65      /**
66       * Returns the type of the collection components contained in this Property.
67       * @return The type of the collection components contained in this Property. Returns null when isCollection() returns false,
68       *         or when the component type could not be determined by this Property.
69       */
70      Class<?> getComponentType();
71  }