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-2023 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/" target="_blank"> https://simulation.tudelft.nl</a>. The DSOL
10 * project is distributed under a three-clause BSD-style license, which can be found at
11 * <a href="https://https://simulation.tudelft.nl/dsol/docs/latest/license.html" target="_blank">
12 * https://https://simulation.tudelft.nl/dsol/docs/latest/license.html</a>.
13 * </p>
14 * @author <a href="https://www.linkedin.com/in/peterhmjacobs">Peter Jacobs </a>
15 * @author <a href="https://www.tudelft.nl/averbraeck">Alexander Verbraeck</a>
16 * @author Niels Lang.
17 * @since 1.5
18 */
19 public interface Property
20 {
21 /**
22 * Retrieves the name of the property.
23 * @return The name of the property
24 */
25 String getName();
26
27 /**
28 * Returns the type of this property's value.
29 * @return A {see java.lang.Class}instance denoting the type of this property.
30 */
31 Class<?> getType();
32
33 /**
34 * Returns whether the value of this property may be altered.
35 * @return 'True', when this property's value can be altered, 'false' otherwise.
36 */
37 boolean isEditable();
38
39 /**
40 * Set the value of this property. However, if isEditable() returns 'false', the value of this property will not be altered.
41 * Composite property values (i.e. {see java.util.Collection}or arrays) should be provided as an instance of {see
42 * java.util.Collection}.
43 * @param value Object; The new value of this property.
44 */
45 void setValue(Object value);
46
47 /**
48 * Returns the current value of this property.
49 * @return The current value of this property.
50 */
51 Object getValue();
52
53 /**
54 * Retrieves the introspected object, which contains this Property.
55 * @return the instance
56 */
57 Object getInstance();
58
59 /**
60 * Returns the collection type of the contained value (i.e. a composite value). The definition whether a value is considered
61 * composite depends on the property paradigm used by this Property.
62 * @return the CollectionTypeEnum of this Property.
63 */
64 ComposedTypeEnum getComposedType();
65
66 /**
67 * Returns the type of the collection components contained in this Property.
68 * @return The type of the collection components contained in this Property. Returns null when isCollection() returns false,
69 * or when the component type could not be determined by this Property.
70 */
71 Class<?> getComponentType();
72 }