/* license-start * * Copyright (C) 2008 - 2013 Crispico, <http://www.crispico.com/>. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details, at <http://www.gnu.org/licenses/>. * * Contributors: * Crispico - Initial API and implementation * * license-end */ /** * <copyright> * </copyright> * * $Id$ */ package com.crispico.flower.mp.model.astcache.code.impl; import com.crispico.flower.mp.model.astcache.code.AnnotationMember; import com.crispico.flower.mp.model.astcache.code.AstCacheCodePackage; import com.crispico.flower.mp.model.astcache.code.DocumentableElement; import com.crispico.flower.mp.model.astcache.code.ExtendedModifier; import com.crispico.flower.mp.model.astcache.code.ModifiableElement; import com.crispico.flower.mp.model.astcache.code.TypedElement; import com.crispico.flower.mp.model.codesync.impl.AstCacheElementImpl; import java.util.Collection; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.InternalEList; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Annotation Member</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link com.crispico.flower.mp.model.astcache.code.impl.AnnotationMemberImpl#getModifiers <em>Modifiers</em>}</li> * <li>{@link com.crispico.flower.mp.model.astcache.code.impl.AnnotationMemberImpl#getDocumentation <em>Documentation</em>}</li> * <li>{@link com.crispico.flower.mp.model.astcache.code.impl.AnnotationMemberImpl#getType <em>Type</em>}</li> * <li>{@link com.crispico.flower.mp.model.astcache.code.impl.AnnotationMemberImpl#getDefaultValue <em>Default Value</em>}</li> * </ul> * </p> * * @generated */ public class AnnotationMemberImpl extends AstCacheElementImpl implements AnnotationMember { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final long serialVersionUID = 1L; /** * The cached value of the '{@link #getModifiers() <em>Modifiers</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getModifiers() * @generated * @ordered */ protected EList<ExtendedModifier> modifiers; /** * The default value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getDocumentation() * @generated * @ordered */ protected static final String DOCUMENTATION_EDEFAULT = null; /** * The cached value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getDocumentation() * @generated * @ordered */ protected String documentation = DOCUMENTATION_EDEFAULT; /** * The default value of the '{@link #getType() <em>Type</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getType() * @generated * @ordered */ protected static final String TYPE_EDEFAULT = null; /** * The cached value of the '{@link #getType() <em>Type</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getType() * @generated * @ordered */ protected String type = TYPE_EDEFAULT; /** * The default value of the '{@link #getDefaultValue() <em>Default Value</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getDefaultValue() * @generated * @ordered */ protected static final String DEFAULT_VALUE_EDEFAULT = null; /** * The cached value of the '{@link #getDefaultValue() <em>Default Value</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getDefaultValue() * @generated * @ordered */ protected String defaultValue = DEFAULT_VALUE_EDEFAULT; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected AnnotationMemberImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return AstCacheCodePackage.Literals.ANNOTATION_MEMBER; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<ExtendedModifier> getModifiers() { if (modifiers == null) { modifiers = new EObjectContainmentEList<ExtendedModifier>(ExtendedModifier.class, this, AstCacheCodePackage.ANNOTATION_MEMBER__MODIFIERS); } return modifiers; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getDocumentation() { return documentation; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setDocumentation(String newDocumentation) { String oldDocumentation = documentation; documentation = newDocumentation; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AstCacheCodePackage.ANNOTATION_MEMBER__DOCUMENTATION, oldDocumentation, documentation)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getType() { return type; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setType(String newType) { String oldType = type; type = newType; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AstCacheCodePackage.ANNOTATION_MEMBER__TYPE, oldType, type)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getDefaultValue() { return defaultValue; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setDefaultValue(String newDefaultValue) { String oldDefaultValue = defaultValue; defaultValue = newDefaultValue; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AstCacheCodePackage.ANNOTATION_MEMBER__DEFAULT_VALUE, oldDefaultValue, defaultValue)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case AstCacheCodePackage.ANNOTATION_MEMBER__MODIFIERS: return ((InternalEList<?>)getModifiers()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case AstCacheCodePackage.ANNOTATION_MEMBER__MODIFIERS: return getModifiers(); case AstCacheCodePackage.ANNOTATION_MEMBER__DOCUMENTATION: return getDocumentation(); case AstCacheCodePackage.ANNOTATION_MEMBER__TYPE: return getType(); case AstCacheCodePackage.ANNOTATION_MEMBER__DEFAULT_VALUE: return getDefaultValue(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case AstCacheCodePackage.ANNOTATION_MEMBER__MODIFIERS: getModifiers().clear(); getModifiers().addAll((Collection<? extends ExtendedModifier>)newValue); return; case AstCacheCodePackage.ANNOTATION_MEMBER__DOCUMENTATION: setDocumentation((String)newValue); return; case AstCacheCodePackage.ANNOTATION_MEMBER__TYPE: setType((String)newValue); return; case AstCacheCodePackage.ANNOTATION_MEMBER__DEFAULT_VALUE: setDefaultValue((String)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case AstCacheCodePackage.ANNOTATION_MEMBER__MODIFIERS: getModifiers().clear(); return; case AstCacheCodePackage.ANNOTATION_MEMBER__DOCUMENTATION: setDocumentation(DOCUMENTATION_EDEFAULT); return; case AstCacheCodePackage.ANNOTATION_MEMBER__TYPE: setType(TYPE_EDEFAULT); return; case AstCacheCodePackage.ANNOTATION_MEMBER__DEFAULT_VALUE: setDefaultValue(DEFAULT_VALUE_EDEFAULT); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case AstCacheCodePackage.ANNOTATION_MEMBER__MODIFIERS: return modifiers != null && !modifiers.isEmpty(); case AstCacheCodePackage.ANNOTATION_MEMBER__DOCUMENTATION: return DOCUMENTATION_EDEFAULT == null ? documentation != null : !DOCUMENTATION_EDEFAULT.equals(documentation); case AstCacheCodePackage.ANNOTATION_MEMBER__TYPE: return TYPE_EDEFAULT == null ? type != null : !TYPE_EDEFAULT.equals(type); case AstCacheCodePackage.ANNOTATION_MEMBER__DEFAULT_VALUE: return DEFAULT_VALUE_EDEFAULT == null ? defaultValue != null : !DEFAULT_VALUE_EDEFAULT.equals(defaultValue); } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { if (baseClass == ModifiableElement.class) { switch (derivedFeatureID) { case AstCacheCodePackage.ANNOTATION_MEMBER__MODIFIERS: return AstCacheCodePackage.MODIFIABLE_ELEMENT__MODIFIERS; default: return -1; } } if (baseClass == DocumentableElement.class) { switch (derivedFeatureID) { case AstCacheCodePackage.ANNOTATION_MEMBER__DOCUMENTATION: return AstCacheCodePackage.DOCUMENTABLE_ELEMENT__DOCUMENTATION; default: return -1; } } if (baseClass == TypedElement.class) { switch (derivedFeatureID) { case AstCacheCodePackage.ANNOTATION_MEMBER__TYPE: return AstCacheCodePackage.TYPED_ELEMENT__TYPE; default: return -1; } } return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) { if (baseClass == ModifiableElement.class) { switch (baseFeatureID) { case AstCacheCodePackage.MODIFIABLE_ELEMENT__MODIFIERS: return AstCacheCodePackage.ANNOTATION_MEMBER__MODIFIERS; default: return -1; } } if (baseClass == DocumentableElement.class) { switch (baseFeatureID) { case AstCacheCodePackage.DOCUMENTABLE_ELEMENT__DOCUMENTATION: return AstCacheCodePackage.ANNOTATION_MEMBER__DOCUMENTATION; default: return -1; } } if (baseClass == TypedElement.class) { switch (baseFeatureID) { case AstCacheCodePackage.TYPED_ELEMENT__TYPE: return AstCacheCodePackage.ANNOTATION_MEMBER__TYPE; default: return -1; } } return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (documentation: "); result.append(documentation); result.append(", type: "); result.append(type); result.append(", defaultValue: "); result.append(defaultValue); result.append(')'); return result.toString(); } } //AnnotationMemberImpl