1
2
3
4
5
6
7 package nl.tudelft.simulation.introspection;
8
9 /***
10 * A property defines a characteristic of an object. It has a name, a type and
11 * provides methods to view and alter its value. Different introspection
12 * implementation may provide different definitions for what exactly are
13 * regarded to be the 'properties' of an object.
14 * <p>
15 * (c) copyright 2002-2005-2004 <a href="http://www.simulation.tudelft.nl">Delft
16 * University of Technology </a>, the Netherlands. <br>
17 * See for project information <a
18 * href="http://www.simulation.tudelft.nl">www.simulation.tudelft.nl </a> <br>
19 * License of use: <a href="http://www.gnu.org/copyleft/lesser.html">Lesser
20 * General Public License (LGPL) </a>, no warranty.
21 *
22 * @author <a
23 * href="http://web.eur.nl/fbk/dep/dep1/Introduction/Staff/People/Lang">Niels
24 * Lang </a><a href="http://www.peter-jacobs.com/index.htm">Peter
25 * Jacobs </a>
26 * @version 1.1 Apr 15, 2004
27 * @since 1.5
28 */
29 public interface Property
30 {
31 /***
32 * Retrieves the name of the property.
33 *
34 * @return The name of the property
35 */
36 String getName();
37
38 /***
39 * Returns the type of this property's value.
40 *
41 * @return A {see java.lang.Class}instance denoting the type of this
42 * property.
43 */
44 Class< ? > getType();
45
46 /***
47 * Returns whether the value of this property may be altered.
48 *
49 * @return 'True', when this property's value can be altered, 'false'
50 * otherwise.
51 */
52 boolean isEditable();
53
54 /***
55 * Set the value of this property. However, if isEditable() returns 'false',
56 * the value of this property will not be altered. Composite property values
57 * (i.e. {see java.util.Collection}or arrays) should be provided as an
58 * instance of {see java.util.Collection}.
59 *
60 * @param value The new value of this property.
61 */
62 void setValue(Object value);
63
64 /***
65 * Returns the current value of this property.
66 *
67 * @return The current value of this property.
68 */
69 Object getValue();
70
71 /***
72 * Retrieves the introspected object, which contains this Property.
73 *
74 * @return the instance
75 */
76 Object getInstance();
77
78 /***
79 * Returns whether the contained value is a collection (i.e. is a composite
80 * value). The definition whether a value is considered composite depends on
81 * the property paradigm used by this Property.
82 *
83 * @return true, if the contained value is a collection, false otherwise.
84 */
85 boolean isCollection();
86
87 /***
88 * Returns the type of the collection components contained in this Property.
89 *
90 * @return The type of the collection components contained in this Property.
91 * Returns null when isCollection() returns false, or when the
92 * component type could not be determined by this Property.
93 */
94 Class getComponentType();
95 }