KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > internal > databinding > provisional > description > Property


1 /*******************************************************************************
2  * Copyright (c) 2005, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jface.internal.databinding.provisional.description;
12
13 /**
14  * A standard description type representing a property of an object. Description
15  * objects can be passed to <code>DataBindingContext.bind()</code> or
16  * <code>DataBindingContext.createUpdatable()</code>. They are passed to
17  * <code>IUpdatableFactory.createUpdatable()</code> to create an updatable
18  * object. It is up to the IUpdatableFactory objects to interpret this
19  * description.
20  * <p>
21  * <strong>EXPERIMENTAL</strong>. This class or interface has been added as
22  * part of a work in progress. There is no guarantee that this API will remain
23  * unchanged during the 3.2 release cycle. Please do not use this API without
24  * consulting with the Platform/UI team.
25  * </p>
26  *
27  * @since 1.0
28  *
29  */

30 public class Property {
31
32     private final Object JavaDoc object;
33
34     private final Object JavaDoc propertyID;
35
36     private final Class JavaDoc propertyType;
37
38     private final Boolean JavaDoc isCollectionProperty;
39
40     /**
41      * Creates a new property description from the given object and property
42      * identifier.
43      *
44      * @param object
45      * @param propertyID
46      */

47     public Property(Object JavaDoc object, Object JavaDoc propertyID) {
48         this(object, propertyID, null, null);
49     }
50
51     /**
52      * Creates a new property description from the given object, property
53      * identifier, property type, and information whether the property is a
54      * collection property.
55      *
56      * @param object
57      * the object that has the given property
58      * @param propertyID
59      * the property identifier
60      * @param propertyType
61      * the property type, or <code>null</code> if unknown
62      * @param isCollectionProperty
63      * <code>Boolean.TRUE</code> if the property is a collection
64      * property, <code>Boolean.FALSE</code> if it is a simple
65      * property, or <code>null</code> if unknown
66      */

67     public Property(Object JavaDoc object, Object JavaDoc propertyID,
68             Class JavaDoc propertyType, Boolean JavaDoc isCollectionProperty) {
69         this.object = object;
70         this.propertyID = propertyID;
71         this.propertyType = propertyType;
72         this.isCollectionProperty = isCollectionProperty;
73     }
74
75     /**
76      * Returns the object of this property description.
77      *
78      * @return the object
79      */

80     public Object JavaDoc getObject() {
81         return object;
82     }
83
84     /**
85      * Returns the property identifier of this property description.
86      *
87      * @return the property identifier
88      */

89     public Object JavaDoc getPropertyID() {
90         return propertyID;
91     }
92
93     /**
94      * Returns the property type of this property description, or
95      * <code>null</code> if unknown.
96      *
97      * @return the property identifier, or <code>null</code>
98      */

99     public Class JavaDoc getPropertyType() {
100         return propertyType;
101     }
102
103     /**
104      * Returns whether the property is a collection property, or
105      * <code>null</code> if unknown. If the property is a collection property,
106      * getPropertyType() returns the element type of the collection.
107      *
108      * @return <code>Boolean.TRUE</code> if the property is a collection
109      * property, <code>null</code> if it is a simple property, or
110      * <code>null</code> if unknown
111      */

112     public Boolean JavaDoc isCollectionProperty() {
113         return isCollectionProperty;
114     }
115     
116     /* (non-Javadoc)
117      * @see java.lang.Object#toString()
118      */

119     public String JavaDoc toString() {
120         return "Property(" + object.getClass().getName() + ", " + propertyID.toString() + ", ...)"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
121
}
122 }
123
Popular Tags