/**
* Copyright (c) 2015-2016 Obeo, Inria
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* - William Piers <william.piers@obeo.fr>
* - Philippe Merle <philippe.merle@inria.fr>
*/
package org.occiware.clouddesigner.occi.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.occiware.clouddesigner.occi.Attribute;
import org.occiware.clouddesigner.occi.OCCIPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Attribute</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.occiware.clouddesigner.occi.impl.AttributeImpl#getName <em>Name</em>}</li>
* <li>{@link org.occiware.clouddesigner.occi.impl.AttributeImpl#isMutable <em>Mutable</em>}</li>
* <li>{@link org.occiware.clouddesigner.occi.impl.AttributeImpl#isRequired <em>Required</em>}</li>
* <li>{@link org.occiware.clouddesigner.occi.impl.AttributeImpl#getDefault <em>Default</em>}</li>
* <li>{@link org.occiware.clouddesigner.occi.impl.AttributeImpl#getDescription <em>Description</em>}</li>
* <li>{@link org.occiware.clouddesigner.occi.impl.AttributeImpl#getType <em>Type</em>}</li>
* <li>{@link org.occiware.clouddesigner.occi.impl.AttributeImpl#isMultiple_values <em>Multiple values</em>}</li>
* </ul>
*
* @generated
*/
public class AttributeImpl extends MinimalEObjectImpl.Container implements Attribute {
/**
* The default value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected static final String NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected String name = NAME_EDEFAULT;
/**
* The default value of the '{@link #isMutable() <em>Mutable</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isMutable()
* @generated
* @ordered
*/
protected static final boolean MUTABLE_EDEFAULT = true;
/**
* The cached value of the '{@link #isMutable() <em>Mutable</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isMutable()
* @generated
* @ordered
*/
protected boolean mutable = MUTABLE_EDEFAULT;
/**
* The default value of the '{@link #isRequired() <em>Required</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isRequired()
* @generated
* @ordered
*/
protected static final boolean REQUIRED_EDEFAULT = false;
/**
* The cached value of the '{@link #isRequired() <em>Required</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isRequired()
* @generated
* @ordered
*/
protected boolean required = REQUIRED_EDEFAULT;
/**
* The default value of the '{@link #getDefault() <em>Default</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDefault()
* @generated
* @ordered
*/
protected static final String DEFAULT_EDEFAULT = null;
/**
* The cached value of the '{@link #getDefault() <em>Default</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDefault()
* @generated
* @ordered
*/
protected String default_ = DEFAULT_EDEFAULT;
/**
* The default value of the '{@link #getDescription() <em>Description</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDescription()
* @generated
* @ordered
*/
protected static final String DESCRIPTION_EDEFAULT = null;
/**
* The cached value of the '{@link #getDescription() <em>Description</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDescription()
* @generated
* @ordered
*/
protected String description = DESCRIPTION_EDEFAULT;
/**
* The cached value of the '{@link #getType() <em>Type</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getType()
* @generated
* @ordered
*/
protected EDataType type;
/**
* The default value of the '{@link #isMultiple_values() <em>Multiple values</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isMultiple_values()
* @generated
* @ordered
*/
protected static final boolean MULTIPLE_VALUES_EDEFAULT = false;
/**
* The cached value of the '{@link #isMultiple_values() <em>Multiple values</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isMultiple_values()
* @generated
* @ordered
*/
protected boolean multiple_values = MULTIPLE_VALUES_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected AttributeImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return OCCIPackage.Literals.ATTRIBUTE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getName() {
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setName(String newName) {
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, OCCIPackage.ATTRIBUTE__NAME, oldName, name));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isMutable() {
return mutable;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setMutable(boolean newMutable) {
boolean oldMutable = mutable;
mutable = newMutable;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, OCCIPackage.ATTRIBUTE__MUTABLE, oldMutable, mutable));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isRequired() {
return required;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setRequired(boolean newRequired) {
boolean oldRequired = required;
required = newRequired;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, OCCIPackage.ATTRIBUTE__REQUIRED, oldRequired, required));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getDefault() {
return default_;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDefault(String newDefault) {
String oldDefault = default_;
default_ = newDefault;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, OCCIPackage.ATTRIBUTE__DEFAULT, oldDefault, default_));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getDescription() {
return description;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDescription(String newDescription) {
String oldDescription = description;
description = newDescription;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, OCCIPackage.ATTRIBUTE__DESCRIPTION, oldDescription, description));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EDataType getType() {
if (type != null && type.eIsProxy()) {
InternalEObject oldType = (InternalEObject)type;
type = (EDataType)eResolveProxy(oldType);
if (type != oldType) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, OCCIPackage.ATTRIBUTE__TYPE, oldType, type));
}
}
return type;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EDataType basicGetType() {
return type;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setType(EDataType newType) {
EDataType oldType = type;
type = newType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, OCCIPackage.ATTRIBUTE__TYPE, oldType, type));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isMultiple_values() {
return multiple_values;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setMultiple_values(boolean newMultiple_values) {
boolean oldMultiple_values = multiple_values;
multiple_values = newMultiple_values;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, OCCIPackage.ATTRIBUTE__MULTIPLE_VALUES, oldMultiple_values, multiple_values));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case OCCIPackage.ATTRIBUTE__NAME:
return getName();
case OCCIPackage.ATTRIBUTE__MUTABLE:
return isMutable();
case OCCIPackage.ATTRIBUTE__REQUIRED:
return isRequired();
case OCCIPackage.ATTRIBUTE__DEFAULT:
return getDefault();
case OCCIPackage.ATTRIBUTE__DESCRIPTION:
return getDescription();
case OCCIPackage.ATTRIBUTE__TYPE:
if (resolve) return getType();
return basicGetType();
case OCCIPackage.ATTRIBUTE__MULTIPLE_VALUES:
return isMultiple_values();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case OCCIPackage.ATTRIBUTE__NAME:
setName((String)newValue);
return;
case OCCIPackage.ATTRIBUTE__MUTABLE:
setMutable((Boolean)newValue);
return;
case OCCIPackage.ATTRIBUTE__REQUIRED:
setRequired((Boolean)newValue);
return;
case OCCIPackage.ATTRIBUTE__DEFAULT:
setDefault((String)newValue);
return;
case OCCIPackage.ATTRIBUTE__DESCRIPTION:
setDescription((String)newValue);
return;
case OCCIPackage.ATTRIBUTE__TYPE:
setType((EDataType)newValue);
return;
case OCCIPackage.ATTRIBUTE__MULTIPLE_VALUES:
setMultiple_values((Boolean)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case OCCIPackage.ATTRIBUTE__NAME:
setName(NAME_EDEFAULT);
return;
case OCCIPackage.ATTRIBUTE__MUTABLE:
setMutable(MUTABLE_EDEFAULT);
return;
case OCCIPackage.ATTRIBUTE__REQUIRED:
setRequired(REQUIRED_EDEFAULT);
return;
case OCCIPackage.ATTRIBUTE__DEFAULT:
setDefault(DEFAULT_EDEFAULT);
return;
case OCCIPackage.ATTRIBUTE__DESCRIPTION:
setDescription(DESCRIPTION_EDEFAULT);
return;
case OCCIPackage.ATTRIBUTE__TYPE:
setType((EDataType)null);
return;
case OCCIPackage.ATTRIBUTE__MULTIPLE_VALUES:
setMultiple_values(MULTIPLE_VALUES_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case OCCIPackage.ATTRIBUTE__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case OCCIPackage.ATTRIBUTE__MUTABLE:
return mutable != MUTABLE_EDEFAULT;
case OCCIPackage.ATTRIBUTE__REQUIRED:
return required != REQUIRED_EDEFAULT;
case OCCIPackage.ATTRIBUTE__DEFAULT:
return DEFAULT_EDEFAULT == null ? default_ != null : !DEFAULT_EDEFAULT.equals(default_);
case OCCIPackage.ATTRIBUTE__DESCRIPTION:
return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
case OCCIPackage.ATTRIBUTE__TYPE:
return type != null;
case OCCIPackage.ATTRIBUTE__MULTIPLE_VALUES:
return multiple_values != MULTIPLE_VALUES_EDEFAULT;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (name: ");
result.append(name);
result.append(", mutable: ");
result.append(mutable);
result.append(", required: ");
result.append(required);
result.append(", default: ");
result.append(default_);
result.append(", description: ");
result.append(description);
result.append(", multiple_values: ");
result.append(multiple_values);
result.append(')');
return result.toString();
}
} //AttributeImpl