KickJava   Java API By Example, From Geeks To Geeks.

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


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: EObject.java,v 1.6 2005/06/08 12:35:27 marcelop Exp $
16  */

17 package org.eclipse.emf.ecore;
18
19
20 import org.eclipse.emf.common.notify.Notifier;
21 import org.eclipse.emf.common.util.EList;
22 import org.eclipse.emf.common.util.TreeIterator;
23 import org.eclipse.emf.ecore.resource.Resource;
24
25
26 /**
27  * <!-- begin-user-doc -->
28  * A representation of the model object '<em><b>EObject</b></em>'.
29  * <p>
30  * <code>EObject</code> is the root of all modeled objects
31  * so all the method names start with "e" to distinguish
32  * the EMF methods from the client methods.
33  * It provides support for the behaviors and features
34  * common to all modeled objects:
35  * <ul>
36  * <li><b>Content</b></li>
37  * <ul>
38  * <li>{@link #eResource()}</li>
39  * <li>{@link #eContainer}</li>
40  * <li>{@link #eContainingFeature}</li>
41  * <li>{@link #eContainmentFeature}</li>
42  * <li>{@link #eContents}</li>
43  * <li>{@link #eAllContents()}</li>
44  * <li>{@link #eCrossReferences}</li>
45  * </ul>
46  * <li><b><a name="reflection">Reflection</a></b></li>
47  * <ul>
48  * <li>{@link #eClass}
49  * <li>{@link #eGet(EStructuralFeature)}</li>
50  * <li>{@link #eGet(EStructuralFeature, boolean)}</li>
51  * <li>{@link #eSet(EStructuralFeature, Object)}</li>
52  * <li>{@link #eIsSet(EStructuralFeature)}</li>
53  * <li>{@link #eUnset(EStructuralFeature)}</li>
54  * </ul>
55  * <li><b>Serialization</b></li>
56  * <ul>
57  * <li>{@link #eIsProxy}
58  * </ul>
59  * </ul>
60  * It is a full participant of the common notification framework: {@link org.eclipse.emf.common.notify}.
61  * Any <code>EObject</code> is assumed to also implement {@link InternalEObject},
62  * which provides lower-level access that is not necessarily suitable for general consumption
63  * but is required for maintaining the EMF support mechanisms.
64  * </p>
65  *
66  * @extends Notifier
67  * <!-- end-user-doc -->
68  *
69  *
70  * @see org.eclipse.emf.ecore.EcorePackage#getEObject()
71  * @model
72  * @generated
73  */

74 public interface EObject extends Notifier
75 {
76   /**
77    * <!-- begin-user-doc -->
78    * Returns the meta class.
79    * <p>
80    * The meta class defines the {@link EClass#getEAllStructuralFeatures features}
81    * available for <a HREF="#reflection">reflective</a> access.
82    * </p>
83    * @return the meta class.
84    * @see EClass#getEAllStructuralFeatures
85    * @ignore
86    * <!-- end-user-doc -->
87    * @model
88    * @generated
89    */

90   EClass eClass();
91
92   /**
93    * <!-- begin-user-doc -->
94    * Returns the containing resource, or <code>null</code>.
95    * <p>
96    * An object is contained in a resource
97    * if it, or one of it's {@link #eContainer containers},
98    * appears in the {@link Resource#getContents contents} of that resource.
99    * <p>
100    * An object must be contained by a resource in order to be {@link Resource#save(java.util.Map) serialized}.
101    * </p>
102    * @return the containing resource.
103    * @see org.eclipse.emf.ecore.util.EcoreUtil#remove(EObject)
104    * @see #eContainer
105    * @ignore
106    * <!-- end-user-doc -->
107    * @model
108    * @generated
109    */

110   Resource eResource();
111
112   /**
113    * <!-- begin-user-doc -->
114    * Returns the containing object, or <code>null</code>.
115    * <p>
116    * An object is contained by another object
117    * if it appears in the {@link #eContents contents} of that object.
118    * The object will be contained by a {@link #eContainmentFeature containment feature} of the containing object.
119    * </p>
120    * @return the containing object.
121    * @see #eResource
122    * @see org.eclipse.emf.ecore.util.EcoreUtil#remove(EObject)
123    * @see #eContainmentFeature
124    * @see #eContainingFeature
125    * @see org.eclipse.emf.ecore.util.EcoreUtil#getRootContainer
126    * @see #eContents
127    * @ignore
128    * <!-- end-user-doc -->
129    * @model
130    * @generated
131    */

132   EObject eContainer();
133
134   /**
135    * <!-- begin-user-doc -->
136    * Returns the particular {@link EClass#getEAllContainments feature}
137    * of the {@link #eContainer container} that actually holds the object,
138    * or <code>null</code>, if there is no container.
139    * Because of support for wildcard content,
140    * this feature may be an attribute representing a {@link org.eclipse.emf.ecore.util.FeatureMap feature map};
141    * in this case the object is referenced by the {@link org.eclipse.emf.ecore.EReference#isContainment containment} feature
142    * of an {@link org.eclipse.emf.ecore.util.FeatureMap.Entry#getEStructuralFeature entry} in the map,
143    * i.e., the {@link #eContainmentFeature eContainmentFeature}.
144    * <p>
145    * @return the feature that actually contains the object.
146    * @see #eContainer
147    * @see #eContainmentFeature
148    * @see EClass#getEAllContainments
149    * @see EReference#isContainment
150    * @see org.eclipse.emf.ecore.util.FeatureMap.Entry#getEStructuralFeature
151    * @ignore
152    * <!-- end-user-doc -->
153    * @model
154    */

155   EStructuralFeature eContainingFeature();
156
157   /**
158    * <!-- begin-user-doc -->
159    * Returns the {@link org.eclipse.emf.ecore.EReference#isContainment containment} feature that properly contains the object,
160    * or <code>null</code>, if there is no container.
161    * Because of support for wildcard content,
162    * this feature may not be a direct feature of the container's {@link #eClass class},
163    * but rather a {@link org.eclipse.emf.ecore.util.FeatureMap.Entry#getEStructuralFeature feature}
164    * of an entry in a feature map {@link #eContainingFeature feature} of the container's class.
165    * <p>
166    * @return the feature that properly contains the object.
167    * @see #eContainer
168    * @see #eContainingFeature
169    * @see EReference#isContainment
170    * @see EClass#getEAllContainments
171    * @see org.eclipse.emf.ecore.util.FeatureMap.Entry#getEStructuralFeature
172    * @ignore
173    * <!-- end-user-doc -->
174    * @model
175    * @generated
176    */

177   EReference eContainmentFeature();
178
179   /**
180    * <!-- begin-user-doc -->
181    * Returns a list view of the content objects; it is unmodifiable.
182    * <p>
183    * This will be the list of {@link EObject}s determined by the
184    * {@link #eGet(EStructuralFeature) contents}
185    * of the {@link EClass#getEAllContainments containment features}
186    * of this object's {@link #eClass meta class}.
187    * Objects can, {@link org.eclipse.emf.ecore.util.EcoreUtil#remove(EObject) indirectly}, be removed
188    * and will change to reflect {@link #eContainer container} changes.
189    * The implicit {@link #eAllContents tree} of contents is also directly available.
190    * </p>
191    * @return a list view of the content objects.
192    * @see #eContainer
193    * @see EClass#getEAllContainments
194    * @see #eGet(EStructuralFeature)
195    * @see org.eclipse.emf.ecore.util.EcoreUtil#remove(EObject)
196    * @see #eAllContents
197    * @ignore
198    * <!-- end-user-doc -->
199    * @model many="false"
200    * @generated
201    */

202   EList eContents();
203
204   /**
205    * <!-- begin-user-doc -->
206    * Returns a tree iterator that iterates over all the {@link #eContents direct contents} and indirect contents of this object.
207    * @return a tree iterator that iterates over all contents.
208    * @see Resource#getAllContents
209    * @see org.eclipse.emf.ecore.util.EcoreUtil#getAllContents
210    * @ignore
211    * <!-- end-user-doc -->
212    * @model
213    * @generated
214    */

215   TreeIterator eAllContents();
216
217   /**
218    * <!-- begin-user-doc -->
219    * Indicates whether this object is a proxy.
220    * <p>
221    * A proxy is an object that is defined in a <code>Resource</code> that has not been loaded.
222    * An object may be a proxy either because proxy resolution was disabled
223    * when the object was accessed (see {@link #eGet(EStructuralFeature,boolean)})
224    * or because proxy {@link org.eclipse.emf.ecore.util.EcoreUtil#resolve resolution} failed.
225    * </p>
226    * @return <code>true</code> if this object is a proxy or <code>false</code>, otherwise.
227    * @see Resource#unload
228    * @see org.eclipse.emf.ecore.util.EcoreUtil#resolve(EObject, org.eclipse.emf.ecore.resource.ResourceSet)
229    * @ignore
230    * <!-- end-user-doc -->
231    * @model
232    * @generated
233    */

234   boolean eIsProxy();
235
236   /**
237    * <!-- begin-user-doc -->
238    * Returns a list view of the cross referenced objects; it is unmodifiable.
239    * <p>
240    * This will be the list of {@link EObject}s determined by the
241    * {@link #eGet(EStructuralFeature) contents}
242    * of the {@link EClass#getEAllReferences reference features}
243    * of this object's {@link #eClass meta class},
244    * <em>excluding</em> {@link EClass#getEAllContainments containment features}
245    * and their {@link EReference#getEOpposite opposites}.
246    * The cross reference list's iterator will be of type {@link org.eclipse.emf.ecore.util.EContentsEList.FeatureIterator},
247    * for efficient determination of the {@link org.eclipse.emf.ecore.util.EContentsEList.FeatureIterator#feature feature}
248    * of each cross reference in the list, e.g.,
249    *<pre>
250    * for (EContentEList.FeatureIterator featureIterator =
251    * (EContentEList.FeatureIterator)eObject.eCrossReferences().iterator();
252    * featureIterator.hasNext(); )
253    * {
254    * EObject eObject = (EObject)featureIterator.next();
255    * EReference eReference = (EReference)featureIterator.feature();
256    * ...
257    * }
258    *</pre>
259    * </p>
260    * @see #eContents
261    * @see EClass#getEAllReferences
262    * @see EClass#getEAllContainments
263    * @see #eGet(EStructuralFeature)
264    * @see org.eclipse.emf.ecore.util.EcoreUtil.CrossReferencer
265    * @return a list view of the cross referenced objects.
266    * <!-- end-user-doc -->
267    * @model many="false"
268    * @generated
269    */

270   EList eCrossReferences();
271
272   /**
273    * <!-- begin-user-doc -->
274    * Returns the value of the given feature of this object.
275    * <p>
276    * It returns the resolved value,
277    * i.e., it returns
278    *<pre>
279    * eObject.{@link #eGet(EStructuralFeature, boolean) eGet}(feature, true)
280    *</pre>
281    * @param feature the feature of the value to fetch.
282    * @return the value of the given feature of this object.
283    * @see #eGet(EStructuralFeature, boolean)
284    * @ignore
285    * <!-- end-user-doc -->
286    * @model
287    * @generated
288    */

289   Object JavaDoc eGet(EStructuralFeature feature);
290
291   /**
292    * <!-- begin-user-doc -->
293    * Returns the value of the given feature of the object;
294    * the value is optionally {@link org.eclipse.emf.ecore.util.EcoreUtil#resolve resolved} before it is returned.
295    * <p>
296    * If the feature is {@link EStructuralFeature#isMany many-valued},
297    * the result will be an {@link EList}
298    * and each object in the list will be {@link EClassifier#isInstance an instance of}
299    * the feature's {@link EStructuralFeature#getEType type};
300    * the list's contents are <b>not</b> affected by <code>resolve</code> argument.
301    * Otherwise the result directly will be an instance of the feature's type;
302    * if it is a {@link #eIsProxy proxy},
303    * it is resolved.
304    * @param feature the feature of the value to fetch.
305    * @param resolve whether to resolve.
306    * @return the value of the given feature of the object.
307    * @exception IllegalArgumentException
308    * if the feature is not one the {@link #eClass meta class}'s
309    * {@link EClass#getEAllStructuralFeatures features}.
310    * @see org.eclipse.emf.ecore.util.InternalEList#basicIterator
311    * @see org.eclipse.emf.ecore.util.InternalEList#basicList
312    * @see org.eclipse.emf.ecore.util.EcoreUtil#resolve(EObject, org.eclipse.emf.ecore.resource.ResourceSet)
313    * EcoreUtil.resolve(EObject, org.eclipse.emf.ecore.resource.ResourceSet)
314    * @see #eSet(EStructuralFeature, Object)
315    * @see #eUnset(EStructuralFeature)
316    * @see #eIsSet(EStructuralFeature)
317    * @see #eGet(EStructuralFeature)
318    * @ignore
319    * <!-- end-user-doc -->
320    * @model
321    * @generated
322    */

323   Object JavaDoc eGet(EStructuralFeature feature, boolean resolve);
324
325   /**
326    * <!-- begin-user-doc -->
327    * Sets the value of the given feature of the object to the new value.
328    * <p>
329    * If the feature is {@link EStructuralFeature#isMany many-valued},
330    * the new value must be an {@link EList}
331    * and each object in that list must be {@link EClassifier#isInstance an instance of}
332    * the feature's {@link EStructuralFeature#getEType type};
333    * the existing contents are cleared and the contents of the new value are added.
334    * Otherwise the new value directly must be an instance of the feature's type
335    * and it becomes the new value of the feature of the object.
336    * If the feature is {@link EAttribute#isUnsettable unsettable},
337    * the modeled state becomes set;
338    * otherwise, the feature may still not considered {@link #eIsSet set} if the new value is the same as the default.
339    * @param feature the feature of the value to set.
340    * @exception IllegalArgumentException
341    * if the feature is not one the {@link #eClass meta class}'s
342    * {@link EClass#getEAllStructuralFeatures features},
343    * or it isn't {@link EStructuralFeature#isChangeable changeable}.
344    * @exception ClassCastException if there is a type conflict.
345    * @exception ArrayStoreException if there is a type conflect.
346    * @see #eUnset(EStructuralFeature)
347    * @see #eIsSet(EStructuralFeature)
348    * @see #eGet(EStructuralFeature, boolean)
349    * @ignore
350    * <!-- end-user-doc -->
351    * @model
352    * @generated
353    */

354   void eSet(EStructuralFeature feature, Object JavaDoc newValue);
355
356   /**
357    * <!-- begin-user-doc -->
358    * Returns whether the feature of the object is considered to be set.
359    * <p>
360    * If the feature is {@link EStructuralFeature#isMany many-valued},
361    * the value must be an {@link EList}
362    * and the feature is considered set if the list is not empty.
363    * If the feature is {@link EAttribute#isUnsettable unsettable},
364    * the modeled state is directly available and is used.
365    * Otherwise,
366    * the {@link #eGet(EStructuralFeature, boolean) unresolved value} of the feature of the object
367    * is compared against the feature's {@link EStructuralFeature#getDefaultValue() default value}
368    * or the {@link #eClass meta class}'s {@link EStructuralFeature#getDefaultValue() default value},
369    * as appropriate;
370    * the feature is considered set if it's not the same as the default.
371    * </p>
372    * <p>
373    * This property can affect serialization, since defaults are typically omitted in a compact serialization.
374    * </p>
375    * @param feature the feature in question.
376    * @exception IllegalArgumentException
377    * if the feature is not one the {@link #eClass meta class}'s
378    * {@link EClass#getEAllStructuralFeatures features}.
379    * @return whether the feature of the object is set.
380    * @see #eSet(EStructuralFeature, Object)
381    * @see #eUnset(EStructuralFeature)
382    * @see #eGet(EStructuralFeature, boolean)
383    * @ignore
384    * <!-- end-user-doc -->
385    * @model
386    * @generated
387    */

388   boolean eIsSet(EStructuralFeature feature);
389
390   /**
391    * <!-- begin-user-doc -->
392    * Unsets the feature of the object.
393    * <p>
394    * If the feature is {@link EStructuralFeature#isMany many-valued},
395    * the value must be an {@link EList}
396    * and that list is cleared.
397    * Otherwise,
398    * the value of the feature of the object
399    * is set to the feature's {@link EStructuralFeature#getDefaultValue() default value}
400    * or the {@link #eClass meta class}'s {@link EStructuralFeature#getDefaultValue() default value},
401    * as appropriate.
402    * If the feature is {@link EAttribute#isUnsettable unsettable},
403    * the modeled state becomes unset.
404    * In any case, the feature will no longer be considered {@link #eIsSet set}.
405    * </p>
406    * @param feature the feature in question.
407    * @exception IllegalArgumentException
408    * if the feature is not one the {@link #eClass meta class}'s
409    * {@link EClass#getEAllStructuralFeatures features},
410    * or it isn't {@link EStructuralFeature#isChangeable changeable}.
411    * @see #eIsSet(EStructuralFeature)
412    * @see #eSet(EStructuralFeature, Object)
413    * @see #eGet(EStructuralFeature, boolean)
414    * @ignore
415    * <!-- end-user-doc -->
416    * @model
417    * @generated
418    */

419   void eUnset(EStructuralFeature feature);
420
421 }
422
Popular Tags