KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > ecore > EStructuralFeature


1 /**
2  * <copyright>
3  *
4  * Copyright (c) 2002-2004 IBM Corporation and others.
5  * All rights reserved. This program and the accompanying materials
6  * are made available under the terms of the Eclipse Public License v1.0
7  * which accompanies this distribution, and is available at
8  * http://www.eclipse.org/legal/epl-v10.html
9  *
10  * Contributors:
11  * IBM - Initial API and implementation
12  *
13  * </copyright>
14  *
15  * $Id: EStructuralFeature.java,v 1.6 2005/06/22 20:00:41 davidms Exp $
16  */

17 package org.eclipse.emf.ecore;
18
19
20 import org.eclipse.emf.common.notify.NotificationChain;
21
22
23 /**
24  * <!-- begin-user-doc -->
25  * A representation of the model object '<em><b>EStructural Feature</b></em>'.
26  * <!-- end-user-doc -->
27  *
28  * <p>
29  * The following features are supported:
30  * <ul>
31  * <li>{@link org.eclipse.emf.ecore.EStructuralFeature#isChangeable <em>Changeable</em>}</li>
32  * <li>{@link org.eclipse.emf.ecore.EStructuralFeature#isVolatile <em>Volatile</em>}</li>
33  * <li>{@link org.eclipse.emf.ecore.EStructuralFeature#isTransient <em>Transient</em>}</li>
34  * <li>{@link org.eclipse.emf.ecore.EStructuralFeature#getDefaultValueLiteral <em>Default Value Literal</em>}</li>
35  * <li>{@link org.eclipse.emf.ecore.EStructuralFeature#getDefaultValue <em>Default Value</em>}</li>
36  * <li>{@link org.eclipse.emf.ecore.EStructuralFeature#isUnsettable <em>Unsettable</em>}</li>
37  * <li>{@link org.eclipse.emf.ecore.EStructuralFeature#isDerived <em>Derived</em>}</li>
38  * <li>{@link org.eclipse.emf.ecore.EStructuralFeature#getEContainingClass <em>EContaining Class</em>}</li>
39  * </ul>
40  * </p>
41  *
42  * @see org.eclipse.emf.ecore.EcorePackage#getEStructuralFeature()
43  * @model abstract="true"
44  * @generated
45  */

46 public interface EStructuralFeature extends ETypedElement
47 {
48   /**
49    * Returns the value of the '<em><b>Transient</b></em>' attribute.
50    * <!-- begin-user-doc -->
51    * <!-- end-user-doc -->
52    * @return the value of the '<em>Transient</em>' attribute.
53    * @see #setTransient(boolean)
54    * @see org.eclipse.emf.ecore.EcorePackage#getEStructuralFeature_Transient()
55    * @model
56    * @generated
57    */

58   boolean isTransient();
59
60   /**
61    * Sets the value of the '{@link org.eclipse.emf.ecore.EStructuralFeature#isTransient <em>Transient</em>}' attribute.
62    * <!-- begin-user-doc -->
63    * <!-- end-user-doc -->
64    * @param value the new value of the '<em>Transient</em>' attribute.
65    * @see #isTransient()
66    * @generated
67    */

68   void setTransient(boolean value);
69
70   /**
71    * Returns the value of the '<em><b>Volatile</b></em>' attribute.
72    * <!-- begin-user-doc -->
73    * <!-- end-user-doc -->
74    * @return the value of the '<em>Volatile</em>' attribute.
75    * @see #setVolatile(boolean)
76    * @see org.eclipse.emf.ecore.EcorePackage#getEStructuralFeature_Volatile()
77    * @model
78    * @generated
79    */

80   boolean isVolatile();
81
82   /**
83    * Sets the value of the '{@link org.eclipse.emf.ecore.EStructuralFeature#isVolatile <em>Volatile</em>}' attribute.
84    * <!-- begin-user-doc -->
85    * <!-- end-user-doc -->
86    * @param value the new value of the '<em>Volatile</em>' attribute.
87    * @see #isVolatile()
88    * @generated
89    */

90   void setVolatile(boolean value);
91
92   /**
93    * Returns the value of the '<em><b>Changeable</b></em>' attribute.
94    * The default value is <code>"true"</code>.
95    * <!-- begin-user-doc -->
96    * <!-- end-user-doc -->
97    * @return the value of the '<em>Changeable</em>' attribute.
98    * @see #setChangeable(boolean)
99    * @see org.eclipse.emf.ecore.EcorePackage#getEStructuralFeature_Changeable()
100    * @model default="true"
101    * @generated
102    */

103   boolean isChangeable();
104
105   /**
106    * Sets the value of the '{@link org.eclipse.emf.ecore.EStructuralFeature#isChangeable <em>Changeable</em>}' attribute.
107    * <!-- begin-user-doc -->
108    * <!-- end-user-doc -->
109    * @param value the new value of the '<em>Changeable</em>' attribute.
110    * @see #isChangeable()
111    * @generated
112    */

113   void setChangeable(boolean value);
114
115   /**
116    * Returns the value of the '<em><b>Default Value Literal</b></em>' attribute.
117    * <!-- begin-user-doc -->
118    * <p>
119    * It represents the serialized form of the default value.
120    * </p>
121    * <!-- end-user-doc -->
122    * @return the value of the '<em>Default Value Literal</em>' attribute.
123    * @see #setDefaultValueLiteral(String)
124    * @see org.eclipse.emf.ecore.EcorePackage#getEStructuralFeature_DefaultValueLiteral()
125    * @model
126    * @generated
127    */

128   String JavaDoc getDefaultValueLiteral();
129
130   /**
131    * Sets the value of the '{@link org.eclipse.emf.ecore.EStructuralFeature#getDefaultValueLiteral <em>Default Value Literal</em>}' attribute.
132    * <!-- begin-user-doc -->
133    * <!-- end-user-doc -->
134    * @param value the new value of the '<em>Default Value Literal</em>' attribute.
135    * @see #getDefaultValueLiteral()
136    * @generated
137    */

138   void setDefaultValueLiteral(String JavaDoc value);
139
140   /**
141    * Returns the value of the '<em><b>Default Value</b></em>' attribute.
142    * <!-- begin-user-doc -->
143    * <p>
144    * It represents the default value that feature must take on when an
145    * explicit value has not been set. Specifically, it may be non-null if
146    * the feature has an {@link ETypedElement#getEType eType}. If the
147    * {@link #getDefaultValueLiteral defaultValueLiteral} is null, it is
148    * simply the <code>eType</code>'s intrinsic {@link
149    * EClassifier#getDefaultValue default value}. Otherwise, if the
150    * <code>eType</code> is an {@link EDataType} and the
151    * <code>defaultValueLiteral</code> is non-null, it is the object created
152    * by the factory's {@link EFactory#createFromString} method when invoked
153    * with those two objects as parameters.
154    * </p>
155    * <!-- end-user-doc -->
156    * @return the value of the '<em>Default Value</em>' attribute.
157    * @see org.eclipse.emf.ecore.EcorePackage#getEStructuralFeature_DefaultValue()
158    * @model transient="true" changeable="false" volatile="true"
159    * @generated
160    */

161   Object JavaDoc getDefaultValue();
162
163   /**
164    * A convenience method for setting the '<em><b>Default Value Literal</b></em>' attribute.
165    * <p>
166    * If the feature has an {@link ETypedElement#getEType eType} that is an
167    * {@link EDataType}, the specified <code>value</code> is converted to
168    * a string using the factory's {@link EFactory#convertToString}
169    * method, and the {@link #getDefaultValueLiteral defaultValueLiteral} is
170    * set to the result.
171    * </p>
172    * @see #setDefaultValueLiteral
173    */

174   void setDefaultValue(Object JavaDoc value);
175
176   /**
177    * Returns the value of the '<em><b>Unsettable</b></em>' attribute.
178    * <!-- begin-user-doc -->
179    * <p>
180    * An unsettable feature explicitly models the state of being set verses being unset
181    * and so provides a direct implementation for the reflective {@link EObject#eIsSet eIsSet}.
182    * It is only applicable {@link ETypedElement#isMany single-valued} features.
183    * One effect of this setting is that,
184    * in addition to generating the methods <code>getXyz</code>
185    * and <code>setXyz</code> (if the feature is {@link #isChangeable changeable}),
186    * a reflective generator will generate the methods <code>isSetXyz</code> and <code>unsetXyz</code>.
187    * </p>
188    * <!-- end-user-doc -->
189    * @return the value of the '<em>Unsettable</em>' attribute.
190    * @see #setUnsettable(boolean)
191    * @see org.eclipse.emf.ecore.EcorePackage#getEStructuralFeature_Unsettable()
192    * @model
193    * @generated
194    */

195   boolean isUnsettable();
196
197   /**
198    * Sets the value of the '{@link org.eclipse.emf.ecore.EStructuralFeature#isUnsettable <em>Unsettable</em>}' attribute.
199    * <!-- begin-user-doc -->
200    * <!-- end-user-doc -->
201    * @param value the new value of the '<em>Unsettable</em>' attribute.
202    * @see #isUnsettable()
203    * @generated
204    */

205   void setUnsettable(boolean value);
206
207   /**
208    * Returns the value of the '<em><b>Derived</b></em>' attribute.
209    * <!-- begin-user-doc -->
210    * <p>
211    * A derived feature typically computes its value from those of other features.
212    * It will typically be {@link #isTransient transient}
213    * and will often be {@link #isVolatile volatile} and not {@link #isChangeable changeable}.
214    * The default {@link org.eclipse.emf.ecore.util.EcoreUtil.Copier copier} won't copy it.
215    * </p>
216    * <!-- end-user-doc -->
217    * @return the value of the '<em>Derived</em>' attribute.
218    * @see #setDerived(boolean)
219    * @see org.eclipse.emf.ecore.EcorePackage#getEStructuralFeature_Derived()
220    * @model
221    * @generated
222    */

223   boolean isDerived();
224
225   /**
226    * Sets the value of the '{@link org.eclipse.emf.ecore.EStructuralFeature#isDerived <em>Derived</em>}' attribute.
227    * <!-- begin-user-doc -->
228    * <!-- end-user-doc -->
229    * @param value the new value of the '<em>Derived</em>' attribute.
230    * @see #isDerived()
231    * @generated
232    */

233   void setDerived(boolean value);
234
235   /**
236    * Returns the value of the '<em><b>EContaining Class</b></em>' container reference.
237    * It is bidirectional and its opposite is '{@link org.eclipse.emf.ecore.EClass#getEStructuralFeatures <em>EStructural Features</em>}'.
238    * <!-- begin-user-doc -->
239    * <p>
240    * It represents the containing class of this feature.
241    * </p>
242    * <!-- end-user-doc -->
243    * @return the value of the '<em>EContaining Class</em>' container reference.
244    * @see org.eclipse.emf.ecore.EcorePackage#getEStructuralFeature_EContainingClass()
245    * @see org.eclipse.emf.ecore.EClass#getEStructuralFeatures
246    * @model opposite="eStructuralFeatures" changeable="false"
247    * @generated
248    */

249   EClass getEContainingClass();
250
251   /**
252    * <!-- begin-user-doc -->
253    * Returns the ID relative to the {@link #getEContainingClass containing} class.
254    * @return the relative ID.
255    * <!-- end-user-doc -->
256    * @model kind="operation"
257    * @generated
258    */

259   int getFeatureID();
260
261   /**
262    * <!-- begin-user-doc -->
263    * Returns the {@link EClassifier#getInstanceClass instance class} of the {@link #getEContainingClass containing} class.
264    * @return the instance class of the containing class.
265    * <!-- end-user-doc -->
266    * @model kind="operation"
267    * @generated
268    */

269   Class JavaDoc getContainerClass();
270
271   /**
272    * A representation of a value held by a feature of an object.
273    * In the case of a {@link org.eclipse.emf.ecore.InternalEObject#eSetClass dynamic} instance,
274    * a setting will be the only actual representation of the object-feature-value association.
275    */

276   interface Setting
277   {
278     /**
279      * Returns the object holding a value.
280      * @return the object holding a value.
281      */

282     EObject getEObject();
283
284     /**
285      * Returns the specific feature holding a value for the object.
286      * @return the specific feature holding a value for the object.
287      */

288     EStructuralFeature getEStructuralFeature();
289
290     /**
291      * Returns the value held by the feature of the object;
292      * it optionally {@link org.eclipse.emf.ecore.util.EcoreUtil#resolve resolves} the value.
293      * @param resolve whether to resolve.
294      * @return the value held by the feature of the object.
295      * @see EObject#eGet(EStructuralFeature, boolean)
296      */

297     Object JavaDoc get(boolean resolve);
298
299     /**
300      * Set the value held by the feature of the object.
301      * @param newValue the newValue.
302      * @see EObject#eSet(EStructuralFeature, Object)
303      */

304     void set(Object JavaDoc newValue);
305
306     /**
307      * Returns whether a value is held by the feature of the object.
308      * @return whether a value is held by the feature of the object.
309      * @see EObject#eIsSet(EStructuralFeature)
310      */

311     boolean isSet();
312
313     /**
314      * Unsets the value held by the feature of the object.
315      * @see EObject#eUnset(EStructuralFeature)
316      */

317     void unset();
318   }
319
320   /**
321    * Internal API implemented by all features.
322    */

323   interface Internal extends EStructuralFeature, InternalEObject
324   {
325     /**
326      * An API for the backing store that holds dynamic values.
327      */

328     interface DynamicValueHolder
329     {
330       /**
331        * An object use to represent being set to null <code>null</code>
332        * as opposed to having no value and hence being in the default state.
333        */

334       Object JavaDoc NIL = new Object JavaDoc();
335
336       /**
337        * Returns the value of the feature.
338        * @param dynamicFeatureID the feature's index in the cached dynamic values.
339        * @return the value of the feature.
340        */

341       Object JavaDoc dynamicGet(int dynamicFeatureID);
342
343       /**
344        * Sets the value of the feature to the new value.
345        * @param dynamicFeatureID the feature's index in the cached dynamic values.
346        * @param newValue the new value for the feature.
347        */

348       void dynamicSet(int dynamicFeatureID, Object JavaDoc newValue);
349
350       /**
351        * Unsets the value of the feature.
352        * @param dynamicFeatureID the feature's index in the cached dynamic values.
353        */

354       void dynamicUnset(int dynamicFeatureID);
355     }
356
357     /**
358      * An API for delegating reflective access to settings.
359      */

360     interface SettingDelegate
361     {
362       /**
363        * Returns a setting that can be used to access the owner's feature.
364        * @param owner the owner of the feature.
365        * @param settings the owner's array of cached values.
366        * @param dynamicFeatureID the feature's index in the owner's cached dynamic values.
367        * @return a setting that can be used to access the owner's feature.
368        * @see InternalEObject#eSetting(EStructuralFeature)
369        */

370       Setting dynamicSetting(InternalEObject owner, DynamicValueHolder settings, int dynamicFeatureID);
371
372       /**
373        * Returns the value of the feature of this owner.
374        * @param owner the owner of the feature.
375        * @param settings the owner's array of cached values.
376        * @param dynamicFeatureID the feature's index in the owner's cached dynamic values.
377        * @param resolve whether to resolve.
378        * @return the value of the feature of this owner.
379        * @see EObject#eGet(EStructuralFeature, boolean)
380        */

381       Object JavaDoc dynamicGet(InternalEObject owner, DynamicValueHolder settings, int dynamicFeatureID, boolean resolve);
382
383       /**
384        * Sets the value of the given feature of the owner to the new value.
385        * @param owner the owner of the feature.
386        * @param settings the owner's array of cached values.
387        * @param dynamicFeatureID the feature's index in the owner's cached dynamic values.
388        * @param newValue the new value for the feature.
389        * @see EObject#eSet(EStructuralFeature, Object)
390        */

391       void dynamicSet(InternalEObject owner, DynamicValueHolder settings, int dynamicFeatureID, Object JavaDoc newValue);
392
393       /**
394        * Returns whether the feature of the owner is considered to be set.
395        * @param owner the owner of the feature.
396        * @param settings the owner's array of cached values.
397        * @param dynamicFeatureID the feature's index in the owner's cached dynamic values.
398        * @return whether the feature of the owner is considered to be set.
399        * @see EObject#eIsSet(EStructuralFeature)
400        */

401       boolean dynamicIsSet(InternalEObject owner, DynamicValueHolder settings, int dynamicFeatureID);
402
403       /**
404        * Unsets the value of the given feature of the owner.
405        * @param owner the owner of the feature.
406        * @param settings the owner's array of cached values.
407        * @param dynamicFeatureID the feature's index in the owner's cached dynamic values.
408        * @see EObject#eUnset(EStructuralFeature)
409        */

410       void dynamicUnset(InternalEObject owner, DynamicValueHolder settings, int dynamicFeatureID);
411
412       /**
413        * Adds the object at the other end of a bidirectional reference to the appropriate feature
414        * and returns accumulated notifications.
415        * @param owner the owner of the feature.
416        * @param settings the owner's array of cached values.
417        * @param dynamicFeatureID the feature's index in the owner's cached dynamic values.
418        * @param otherEnd the object to inverse add.
419        * @param notifications the incoming accumulated notifications.
420        * @return accumulated notifications.
421        * @see InternalEObject#eInverseAdd
422        */

423       NotificationChain dynamicInverseAdd
424         (InternalEObject owner, DynamicValueHolder settings, int dynamicFeatureID, InternalEObject otherEnd, NotificationChain notifications);
425
426       /**
427        * Removes the object at the other end of a bidirectional reference from the appropriate feature
428        * and returns accumulated notifications.
429        * @param owner the owner of the feature.
430        * @param settings the owner's array of cached values.
431        * @param dynamicFeatureID the feature's index in the owner's cached dynamic values.
432        * @param otherEnd the object to inverse remove.
433        * @param notifications the incoming accumulated notifications.
434        * @return accumulated notifications.
435        * @see InternalEObject#eInverseRemove
436        */

437       NotificationChain dynamicInverseRemove
438         (InternalEObject owner, DynamicValueHolder settings, int dynamicFeatureID, InternalEObject otherEnd, NotificationChain notifications);
439     }
440
441     /**
442      * Returns the delegate for this feature.
443      * A default delegate implementation should always be available,
444      * so this should never return <code>null</code>.
445      * @return the delegate for this feature.
446      */

447     SettingDelegate getSettingDelegate();
448
449     /**
450      * Sets the specialized delegate for this feature.
451      * @param settingDelegate the specialized delegate.
452      */

453     void setSettingDelegate(SettingDelegate settingDelegate);
454
455     /**
456      * Returns whether the type is a feature map.
457      * @return whether the type is a feature map.
458      */

459     boolean isFeatureMap();
460   }
461 }
462
Popular Tags