View Javadoc

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