/*
* Copyright (c) 2014 Eike Stepper (Berlin, Germany) and others.
* 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:
* Eike Stepper - initial API and implementation
*/
package org.eclipse.oomph.setup.impl;
import org.eclipse.oomph.base.impl.ModelElementImpl;
import org.eclipse.oomph.setup.AttributeRule;
import org.eclipse.oomph.setup.SetupPackage;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
/**
*
* An implementation of the model object 'Attribute Rule'.
*
*
* The following features are implemented:
*
* - {@link org.eclipse.oomph.setup.impl.AttributeRuleImpl#getAttributeURI Attribute URI}
* - {@link org.eclipse.oomph.setup.impl.AttributeRuleImpl#getValue Value}
*
*
*
* @generated
*/
public class AttributeRuleImpl extends ModelElementImpl implements AttributeRule
{
/**
* The default value of the '{@link #getAttributeURI() Attribute URI}' attribute.
*
*
* @see #getAttributeURI()
* @generated
* @ordered
*/
protected static final URI ATTRIBUTE_URI_EDEFAULT = null;
/**
* The cached value of the '{@link #getAttributeURI() Attribute URI}' attribute.
*
*
* @see #getAttributeURI()
* @generated
* @ordered
*/
protected URI attributeURI = ATTRIBUTE_URI_EDEFAULT;
/**
* The default value of the '{@link #getValue() Value}' attribute.
*
*
* @see #getValue()
* @generated
* @ordered
*/
protected static final String VALUE_EDEFAULT = null;
/**
* The cached value of the '{@link #getValue() Value}' attribute.
*
*
* @see #getValue()
* @generated
* @ordered
*/
protected String value = VALUE_EDEFAULT;
/**
*
*
* @generated
*/
protected AttributeRuleImpl()
{
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass()
{
return SetupPackage.Literals.ATTRIBUTE_RULE;
}
/**
*
*
* @generated
*/
public URI getAttributeURI()
{
return attributeURI;
}
/**
*
*
* @generated
*/
public void setAttributeURI(URI newAttributeURI)
{
URI oldAttributeURI = attributeURI;
attributeURI = newAttributeURI;
if (eNotificationRequired())
{
eNotify(new ENotificationImpl(this, Notification.SET, SetupPackage.ATTRIBUTE_RULE__ATTRIBUTE_URI, oldAttributeURI, attributeURI));
}
}
/**
*
*
* @generated
*/
public String getValue()
{
return value;
}
/**
*
*
* @generated
*/
public void setValue(String newValue)
{
String oldValue = value;
value = newValue;
if (eNotificationRequired())
{
eNotify(new ENotificationImpl(this, Notification.SET, SetupPackage.ATTRIBUTE_RULE__VALUE, oldValue, value));
}
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case SetupPackage.ATTRIBUTE_RULE__ATTRIBUTE_URI:
return getAttributeURI();
case SetupPackage.ATTRIBUTE_RULE__VALUE:
return getValue();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case SetupPackage.ATTRIBUTE_RULE__ATTRIBUTE_URI:
setAttributeURI((URI)newValue);
return;
case SetupPackage.ATTRIBUTE_RULE__VALUE:
setValue((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case SetupPackage.ATTRIBUTE_RULE__ATTRIBUTE_URI:
setAttributeURI(ATTRIBUTE_URI_EDEFAULT);
return;
case SetupPackage.ATTRIBUTE_RULE__VALUE:
setValue(VALUE_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case SetupPackage.ATTRIBUTE_RULE__ATTRIBUTE_URI:
return ATTRIBUTE_URI_EDEFAULT == null ? attributeURI != null : !ATTRIBUTE_URI_EDEFAULT.equals(attributeURI);
case SetupPackage.ATTRIBUTE_RULE__VALUE:
return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value);
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString()
{
if (eIsProxy())
{
return super.toString();
}
StringBuffer result = new StringBuffer(super.toString());
result.append(" (attributeURI: ");
result.append(attributeURI);
result.append(", value: ");
result.append(value);
result.append(')');
return result.toString();
}
} // AttributeRuleImpl