blob: 51289bd908c0df0e3f260eff312a007cf1013ef6 [file] [log] [blame]
justinchen7f57f4a2006-04-27 23:42:48 +00001/***************************************************************************************************
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 * Oracle Corporation - revision
11 **************************************************************************************************/
12package org.eclipse.jst.jsf.facesconfig.emf.impl;
13
14import java.util.Collection;
15
16import org.eclipse.emf.common.notify.Notification;
17import org.eclipse.emf.common.notify.NotificationChain;
justinchen7f57f4a2006-04-27 23:42:48 +000018import org.eclipse.emf.common.util.EList;
justinchen7f57f4a2006-04-27 23:42:48 +000019import org.eclipse.emf.ecore.EClass;
justinchen7f57f4a2006-04-27 23:42:48 +000020import org.eclipse.emf.ecore.InternalEObject;
justinchen7f57f4a2006-04-27 23:42:48 +000021import org.eclipse.emf.ecore.impl.ENotificationImpl;
22import org.eclipse.emf.ecore.impl.EObjectImpl;
justinchen7f57f4a2006-04-27 23:42:48 +000023import org.eclipse.emf.ecore.util.EObjectContainmentEList;
cbateman39c15422006-12-21 02:36:52 +000024import org.eclipse.emf.ecore.util.EObjectResolvingEList;
justinchen7f57f4a2006-04-27 23:42:48 +000025import org.eclipse.emf.ecore.util.InternalEList;
26import org.eclipse.jst.jsf.facesconfig.emf.ApplicationFactoryType;
27import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
28import org.eclipse.jst.jsf.facesconfig.emf.FacesContextFactoryType;
cbateman39c15422006-12-21 02:36:52 +000029import org.eclipse.jst.jsf.facesconfig.emf.FactoryExtensionType;
justinchen7f57f4a2006-04-27 23:42:48 +000030import org.eclipse.jst.jsf.facesconfig.emf.FactoryType;
31import org.eclipse.jst.jsf.facesconfig.emf.LifecycleFactoryType;
32import org.eclipse.jst.jsf.facesconfig.emf.RenderKitFactoryType;
33
34
35/**
36 * <!-- begin-user-doc -->
37 * An implementation of the model object '<em><b>Factory Type</b></em>'.
38 * <!-- end-user-doc -->
39 * <p>
40 * The following features are implemented:
41 * <ul>
42 * <li>{@link org.eclipse.jst.jsf.facesconfig.emf.impl.FactoryTypeImpl#getApplicationFactory <em>Application Factory</em>}</li>
43 * <li>{@link org.eclipse.jst.jsf.facesconfig.emf.impl.FactoryTypeImpl#getFacesContextFactory <em>Faces Context Factory</em>}</li>
44 * <li>{@link org.eclipse.jst.jsf.facesconfig.emf.impl.FactoryTypeImpl#getLifecycleFactory <em>Lifecycle Factory</em>}</li>
45 * <li>{@link org.eclipse.jst.jsf.facesconfig.emf.impl.FactoryTypeImpl#getRenderKitFactory <em>Render Kit Factory</em>}</li>
cbateman39c15422006-12-21 02:36:52 +000046 * <li>{@link org.eclipse.jst.jsf.facesconfig.emf.impl.FactoryTypeImpl#getFactoryExtension <em>Factory Extension</em>}</li>
justinchen7f57f4a2006-04-27 23:42:48 +000047 * <li>{@link org.eclipse.jst.jsf.facesconfig.emf.impl.FactoryTypeImpl#getId <em>Id</em>}</li>
48 * </ul>
49 * </p>
50 *
51 * @generated
52 */
53public class FactoryTypeImpl extends EObjectImpl implements FactoryType {
cbateman39c15422006-12-21 02:36:52 +000054 /**
55 * <!-- begin-user-doc -->
justinchen7f57f4a2006-04-27 23:42:48 +000056 * <!-- end-user-doc -->
cbateman39c15422006-12-21 02:36:52 +000057 * @generated
58 */
gkesslercfc53082008-11-18 22:25:04 +000059 public static final String copyright = "Copyright (c) 2005, 2006 IBM Corporation and others"; //$NON-NLS-1$
justinchen7f57f4a2006-04-27 23:42:48 +000060
cbateman39c15422006-12-21 02:36:52 +000061 /**
62 * The cached value of the '{@link #getApplicationFactory() <em>Application Factory</em>}' containment reference list.
63 * <!-- begin-user-doc -->
justinchen7f57f4a2006-04-27 23:42:48 +000064 * <!-- end-user-doc -->
cbateman39c15422006-12-21 02:36:52 +000065 * @see #getApplicationFactory()
66 * @generated
67 * @ordered
68 */
justinchen7f57f4a2006-04-27 23:42:48 +000069 protected EList applicationFactory = null;
70
cbateman39c15422006-12-21 02:36:52 +000071 /**
72 * The cached value of the '{@link #getFacesContextFactory() <em>Faces Context Factory</em>}' containment reference list.
73 * <!-- begin-user-doc -->
justinchen7f57f4a2006-04-27 23:42:48 +000074 * <!-- end-user-doc -->
cbateman39c15422006-12-21 02:36:52 +000075 * @see #getFacesContextFactory()
76 * @generated
77 * @ordered
78 */
justinchen7f57f4a2006-04-27 23:42:48 +000079 protected EList facesContextFactory = null;
80
cbateman39c15422006-12-21 02:36:52 +000081 /**
82 * The cached value of the '{@link #getLifecycleFactory() <em>Lifecycle Factory</em>}' containment reference list.
83 * <!-- begin-user-doc -->
justinchen7f57f4a2006-04-27 23:42:48 +000084 * <!-- end-user-doc -->
cbateman39c15422006-12-21 02:36:52 +000085 * @see #getLifecycleFactory()
86 * @generated
87 * @ordered
88 */
justinchen7f57f4a2006-04-27 23:42:48 +000089 protected EList lifecycleFactory = null;
90
cbateman39c15422006-12-21 02:36:52 +000091 /**
92 * The cached value of the '{@link #getRenderKitFactory() <em>Render Kit Factory</em>}' containment reference list.
93 * <!-- begin-user-doc -->
justinchen7f57f4a2006-04-27 23:42:48 +000094 * <!-- end-user-doc -->
cbateman39c15422006-12-21 02:36:52 +000095 * @see #getRenderKitFactory()
96 * @generated
97 * @ordered
98 */
justinchen7f57f4a2006-04-27 23:42:48 +000099 protected EList renderKitFactory = null;
100
cbateman39c15422006-12-21 02:36:52 +0000101 /**
102 * The cached value of the '{@link #getFactoryExtension() <em>Factory Extension</em>}' reference list.
103 * <!-- begin-user-doc -->
104 * <!-- end-user-doc -->
105 * @see #getFactoryExtension()
106 * @generated
107 * @ordered
108 */
109 protected EList factoryExtension = null;
110
111 /**
112 * The default value of the '{@link #getId() <em>Id</em>}' attribute.
113 * <!-- begin-user-doc -->
justinchen7f57f4a2006-04-27 23:42:48 +0000114 * <!-- end-user-doc -->
cbateman39c15422006-12-21 02:36:52 +0000115 * @see #getId()
116 * @generated
117 * @ordered
118 */
justinchen7f57f4a2006-04-27 23:42:48 +0000119 protected static final String ID_EDEFAULT = null;
120
cbateman39c15422006-12-21 02:36:52 +0000121 /**
122 * The cached value of the '{@link #getId() <em>Id</em>}' attribute.
123 * <!-- begin-user-doc -->
justinchen7f57f4a2006-04-27 23:42:48 +0000124 * <!-- end-user-doc -->
cbateman39c15422006-12-21 02:36:52 +0000125 * @see #getId()
126 * @generated
127 * @ordered
128 */
justinchen7f57f4a2006-04-27 23:42:48 +0000129 protected String id = ID_EDEFAULT;
130
cbateman39c15422006-12-21 02:36:52 +0000131 /**
132 * <!-- begin-user-doc -->
justinchen7f57f4a2006-04-27 23:42:48 +0000133 * <!-- end-user-doc -->
cbateman39c15422006-12-21 02:36:52 +0000134 * @generated
135 */
justinchen7f57f4a2006-04-27 23:42:48 +0000136 protected FactoryTypeImpl() {
cbateman39c15422006-12-21 02:36:52 +0000137 super();
138 }
justinchen7f57f4a2006-04-27 23:42:48 +0000139
cbateman39c15422006-12-21 02:36:52 +0000140 /**
141 * <!-- begin-user-doc -->
justinchen7f57f4a2006-04-27 23:42:48 +0000142 * <!-- end-user-doc -->
cbateman39c15422006-12-21 02:36:52 +0000143 * @generated
144 */
justinchen7f57f4a2006-04-27 23:42:48 +0000145 protected EClass eStaticClass() {
cbateman39c15422006-12-21 02:36:52 +0000146 return FacesConfigPackage.Literals.FACTORY_TYPE;
147 }
justinchen7f57f4a2006-04-27 23:42:48 +0000148
cbateman39c15422006-12-21 02:36:52 +0000149 /**
150 * <!-- begin-user-doc -->
justinchen7f57f4a2006-04-27 23:42:48 +0000151 * <!-- end-user-doc -->
cbateman39c15422006-12-21 02:36:52 +0000152 * @generated
153 */
justinchen7f57f4a2006-04-27 23:42:48 +0000154 public EList getApplicationFactory() {
cbateman39c15422006-12-21 02:36:52 +0000155 if (applicationFactory == null) {
156 applicationFactory = new EObjectContainmentEList(ApplicationFactoryType.class, this, FacesConfigPackage.FACTORY_TYPE__APPLICATION_FACTORY);
157 }
158 return applicationFactory;
159 }
justinchen7f57f4a2006-04-27 23:42:48 +0000160
cbateman39c15422006-12-21 02:36:52 +0000161 /**
162 * <!-- begin-user-doc -->
justinchen7f57f4a2006-04-27 23:42:48 +0000163 * <!-- end-user-doc -->
cbateman39c15422006-12-21 02:36:52 +0000164 * @generated
165 */
justinchen7f57f4a2006-04-27 23:42:48 +0000166 public EList getFacesContextFactory() {
cbateman39c15422006-12-21 02:36:52 +0000167 if (facesContextFactory == null) {
168 facesContextFactory = new EObjectContainmentEList(FacesContextFactoryType.class, this, FacesConfigPackage.FACTORY_TYPE__FACES_CONTEXT_FACTORY);
169 }
170 return facesContextFactory;
171 }
justinchen7f57f4a2006-04-27 23:42:48 +0000172
cbateman39c15422006-12-21 02:36:52 +0000173 /**
174 * <!-- begin-user-doc -->
justinchen7f57f4a2006-04-27 23:42:48 +0000175 * <!-- end-user-doc -->
cbateman39c15422006-12-21 02:36:52 +0000176 * @generated
177 */
justinchen7f57f4a2006-04-27 23:42:48 +0000178 public EList getLifecycleFactory() {
cbateman39c15422006-12-21 02:36:52 +0000179 if (lifecycleFactory == null) {
180 lifecycleFactory = new EObjectContainmentEList(LifecycleFactoryType.class, this, FacesConfigPackage.FACTORY_TYPE__LIFECYCLE_FACTORY);
181 }
182 return lifecycleFactory;
183 }
justinchen7f57f4a2006-04-27 23:42:48 +0000184
cbateman39c15422006-12-21 02:36:52 +0000185 /**
186 * <!-- begin-user-doc -->
justinchen7f57f4a2006-04-27 23:42:48 +0000187 * <!-- end-user-doc -->
cbateman39c15422006-12-21 02:36:52 +0000188 * @generated
189 */
justinchen7f57f4a2006-04-27 23:42:48 +0000190 public EList getRenderKitFactory() {
cbateman39c15422006-12-21 02:36:52 +0000191 if (renderKitFactory == null) {
192 renderKitFactory = new EObjectContainmentEList(RenderKitFactoryType.class, this, FacesConfigPackage.FACTORY_TYPE__RENDER_KIT_FACTORY);
193 }
194 return renderKitFactory;
195 }
justinchen7f57f4a2006-04-27 23:42:48 +0000196
cbateman39c15422006-12-21 02:36:52 +0000197 /**
198 * <!-- begin-user-doc -->
199 * <!-- end-user-doc -->
200 * @generated
201 */
202 public EList getFactoryExtension() {
203 if (factoryExtension == null) {
204 factoryExtension = new EObjectResolvingEList(FactoryExtensionType.class, this, FacesConfigPackage.FACTORY_TYPE__FACTORY_EXTENSION);
205 }
206 return factoryExtension;
207 }
208
209 /**
210 * <!-- begin-user-doc -->
justinchen7f57f4a2006-04-27 23:42:48 +0000211 * <!-- end-user-doc -->
cbateman39c15422006-12-21 02:36:52 +0000212 * @generated
213 */
justinchen7f57f4a2006-04-27 23:42:48 +0000214 public String getId() {
cbateman39c15422006-12-21 02:36:52 +0000215 return id;
216 }
justinchen7f57f4a2006-04-27 23:42:48 +0000217
cbateman39c15422006-12-21 02:36:52 +0000218 /**
219 * <!-- begin-user-doc -->
justinchen7f57f4a2006-04-27 23:42:48 +0000220 * <!-- end-user-doc -->
cbateman39c15422006-12-21 02:36:52 +0000221 * @generated
222 */
justinchen7f57f4a2006-04-27 23:42:48 +0000223 public void setId(String newId) {
cbateman39c15422006-12-21 02:36:52 +0000224 String oldId = id;
225 id = newId;
226 if (eNotificationRequired())
227 eNotify(new ENotificationImpl(this, Notification.SET, FacesConfigPackage.FACTORY_TYPE__ID, oldId, id));
228 }
justinchen7f57f4a2006-04-27 23:42:48 +0000229
cbateman39c15422006-12-21 02:36:52 +0000230 /**
231 * <!-- begin-user-doc -->
232 * <!-- end-user-doc -->
233 * @generated
234 */
235 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
236 switch (featureID) {
237 case FacesConfigPackage.FACTORY_TYPE__APPLICATION_FACTORY:
238 return ((InternalEList)getApplicationFactory()).basicRemove(otherEnd, msgs);
239 case FacesConfigPackage.FACTORY_TYPE__FACES_CONTEXT_FACTORY:
240 return ((InternalEList)getFacesContextFactory()).basicRemove(otherEnd, msgs);
241 case FacesConfigPackage.FACTORY_TYPE__LIFECYCLE_FACTORY:
242 return ((InternalEList)getLifecycleFactory()).basicRemove(otherEnd, msgs);
243 case FacesConfigPackage.FACTORY_TYPE__RENDER_KIT_FACTORY:
244 return ((InternalEList)getRenderKitFactory()).basicRemove(otherEnd, msgs);
245 }
246 return super.eInverseRemove(otherEnd, featureID, msgs);
247 }
justinchen7f57f4a2006-04-27 23:42:48 +0000248
cbateman39c15422006-12-21 02:36:52 +0000249 /**
250 * <!-- begin-user-doc -->
251 * <!-- end-user-doc -->
252 * @generated
253 */
254 public Object eGet(int featureID, boolean resolve, boolean coreType) {
255 switch (featureID) {
256 case FacesConfigPackage.FACTORY_TYPE__APPLICATION_FACTORY:
257 return getApplicationFactory();
258 case FacesConfigPackage.FACTORY_TYPE__FACES_CONTEXT_FACTORY:
259 return getFacesContextFactory();
260 case FacesConfigPackage.FACTORY_TYPE__LIFECYCLE_FACTORY:
261 return getLifecycleFactory();
262 case FacesConfigPackage.FACTORY_TYPE__RENDER_KIT_FACTORY:
263 return getRenderKitFactory();
264 case FacesConfigPackage.FACTORY_TYPE__FACTORY_EXTENSION:
265 return getFactoryExtension();
266 case FacesConfigPackage.FACTORY_TYPE__ID:
267 return getId();
268 }
269 return super.eGet(featureID, resolve, coreType);
270 }
justinchen7f57f4a2006-04-27 23:42:48 +0000271
cbateman39c15422006-12-21 02:36:52 +0000272 /**
273 * <!-- begin-user-doc -->
274 * <!-- end-user-doc -->
275 * @generated
276 */
277 public void eSet(int featureID, Object newValue) {
278 switch (featureID) {
279 case FacesConfigPackage.FACTORY_TYPE__APPLICATION_FACTORY:
280 getApplicationFactory().clear();
281 getApplicationFactory().addAll((Collection)newValue);
282 return;
283 case FacesConfigPackage.FACTORY_TYPE__FACES_CONTEXT_FACTORY:
284 getFacesContextFactory().clear();
285 getFacesContextFactory().addAll((Collection)newValue);
286 return;
287 case FacesConfigPackage.FACTORY_TYPE__LIFECYCLE_FACTORY:
288 getLifecycleFactory().clear();
289 getLifecycleFactory().addAll((Collection)newValue);
290 return;
291 case FacesConfigPackage.FACTORY_TYPE__RENDER_KIT_FACTORY:
292 getRenderKitFactory().clear();
293 getRenderKitFactory().addAll((Collection)newValue);
294 return;
295 case FacesConfigPackage.FACTORY_TYPE__FACTORY_EXTENSION:
296 getFactoryExtension().clear();
297 getFactoryExtension().addAll((Collection)newValue);
298 return;
299 case FacesConfigPackage.FACTORY_TYPE__ID:
300 setId((String)newValue);
301 return;
302 }
303 super.eSet(featureID, newValue);
304 }
justinchen7f57f4a2006-04-27 23:42:48 +0000305
cbateman39c15422006-12-21 02:36:52 +0000306 /**
307 * <!-- begin-user-doc -->
308 * <!-- end-user-doc -->
309 * @generated
310 */
311 public void eUnset(int featureID) {
312 switch (featureID) {
313 case FacesConfigPackage.FACTORY_TYPE__APPLICATION_FACTORY:
314 getApplicationFactory().clear();
315 return;
316 case FacesConfigPackage.FACTORY_TYPE__FACES_CONTEXT_FACTORY:
317 getFacesContextFactory().clear();
318 return;
319 case FacesConfigPackage.FACTORY_TYPE__LIFECYCLE_FACTORY:
320 getLifecycleFactory().clear();
321 return;
322 case FacesConfigPackage.FACTORY_TYPE__RENDER_KIT_FACTORY:
323 getRenderKitFactory().clear();
324 return;
325 case FacesConfigPackage.FACTORY_TYPE__FACTORY_EXTENSION:
326 getFactoryExtension().clear();
327 return;
328 case FacesConfigPackage.FACTORY_TYPE__ID:
329 setId(ID_EDEFAULT);
330 return;
331 }
332 super.eUnset(featureID);
333 }
justinchen7f57f4a2006-04-27 23:42:48 +0000334
cbateman39c15422006-12-21 02:36:52 +0000335 /**
336 * <!-- begin-user-doc -->
337 * <!-- end-user-doc -->
338 * @generated
339 */
340 public boolean eIsSet(int featureID) {
341 switch (featureID) {
342 case FacesConfigPackage.FACTORY_TYPE__APPLICATION_FACTORY:
343 return applicationFactory != null && !applicationFactory.isEmpty();
344 case FacesConfigPackage.FACTORY_TYPE__FACES_CONTEXT_FACTORY:
345 return facesContextFactory != null && !facesContextFactory.isEmpty();
346 case FacesConfigPackage.FACTORY_TYPE__LIFECYCLE_FACTORY:
347 return lifecycleFactory != null && !lifecycleFactory.isEmpty();
348 case FacesConfigPackage.FACTORY_TYPE__RENDER_KIT_FACTORY:
349 return renderKitFactory != null && !renderKitFactory.isEmpty();
350 case FacesConfigPackage.FACTORY_TYPE__FACTORY_EXTENSION:
351 return factoryExtension != null && !factoryExtension.isEmpty();
352 case FacesConfigPackage.FACTORY_TYPE__ID:
353 return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id);
354 }
355 return super.eIsSet(featureID);
356 }
justinchen7f57f4a2006-04-27 23:42:48 +0000357
cbateman39c15422006-12-21 02:36:52 +0000358 /**
359 * <!-- begin-user-doc -->
justinchen7f57f4a2006-04-27 23:42:48 +0000360 * <!-- end-user-doc -->
cbateman39c15422006-12-21 02:36:52 +0000361 * @generated
362 */
justinchen7f57f4a2006-04-27 23:42:48 +0000363 public String toString() {
cbateman39c15422006-12-21 02:36:52 +0000364 if (eIsProxy()) return super.toString();
justinchen7f57f4a2006-04-27 23:42:48 +0000365
cbateman39c15422006-12-21 02:36:52 +0000366 StringBuffer result = new StringBuffer(super.toString());
gkesslercfc53082008-11-18 22:25:04 +0000367 result.append(" (id: "); //$NON-NLS-1$
cbateman39c15422006-12-21 02:36:52 +0000368 result.append(id);
369 result.append(')');
370 return result.toString();
371 }
justinchen7f57f4a2006-04-27 23:42:48 +0000372
373} //FactoryTypeImpl