org.contextmapper.dsl.contextMappingDSL.impl.FeatureImpl Maven / Gradle / Ivy
/**
* generated by Xtext 2.21.0
*/
package org.contextmapper.dsl.contextMappingDSL.impl;
import java.util.Collection;
import org.contextmapper.dsl.contextMappingDSL.ContextMappingDSLPackage;
import org.contextmapper.dsl.contextMappingDSL.Feature;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.EDataTypeEList;
/**
*
* An implementation of the model object 'Feature'.
*
*
* The following features are implemented:
*
*
* - {@link org.contextmapper.dsl.contextMappingDSL.impl.FeatureImpl#getVerb Verb}
* - {@link org.contextmapper.dsl.contextMappingDSL.impl.FeatureImpl#getEntity Entity}
* - {@link org.contextmapper.dsl.contextMappingDSL.impl.FeatureImpl#getEntityAttributes Entity Attributes}
* - {@link org.contextmapper.dsl.contextMappingDSL.impl.FeatureImpl#getContainerEntity Container Entity}
*
*
* @generated
*/
public class FeatureImpl extends MinimalEObjectImpl.Container implements Feature
{
/**
* The default value of the '{@link #getVerb() Verb}' attribute.
*
*
* @see #getVerb()
* @generated
* @ordered
*/
protected static final String VERB_EDEFAULT = null;
/**
* The cached value of the '{@link #getVerb() Verb}' attribute.
*
*
* @see #getVerb()
* @generated
* @ordered
*/
protected String verb = VERB_EDEFAULT;
/**
* The default value of the '{@link #getEntity() Entity}' attribute.
*
*
* @see #getEntity()
* @generated
* @ordered
*/
protected static final String ENTITY_EDEFAULT = null;
/**
* The cached value of the '{@link #getEntity() Entity}' attribute.
*
*
* @see #getEntity()
* @generated
* @ordered
*/
protected String entity = ENTITY_EDEFAULT;
/**
* The cached value of the '{@link #getEntityAttributes() Entity Attributes}' attribute list.
*
*
* @see #getEntityAttributes()
* @generated
* @ordered
*/
protected EList entityAttributes;
/**
* The default value of the '{@link #getContainerEntity() Container Entity}' attribute.
*
*
* @see #getContainerEntity()
* @generated
* @ordered
*/
protected static final String CONTAINER_ENTITY_EDEFAULT = null;
/**
* The cached value of the '{@link #getContainerEntity() Container Entity}' attribute.
*
*
* @see #getContainerEntity()
* @generated
* @ordered
*/
protected String containerEntity = CONTAINER_ENTITY_EDEFAULT;
/**
*
*
* @generated
*/
protected FeatureImpl()
{
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass()
{
return ContextMappingDSLPackage.Literals.FEATURE;
}
/**
*
*
* @generated
*/
@Override
public String getVerb()
{
return verb;
}
/**
*
*
* @generated
*/
@Override
public void setVerb(String newVerb)
{
String oldVerb = verb;
verb = newVerb;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ContextMappingDSLPackage.FEATURE__VERB, oldVerb, verb));
}
/**
*
*
* @generated
*/
@Override
public String getEntity()
{
return entity;
}
/**
*
*
* @generated
*/
@Override
public void setEntity(String newEntity)
{
String oldEntity = entity;
entity = newEntity;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ContextMappingDSLPackage.FEATURE__ENTITY, oldEntity, entity));
}
/**
*
*
* @generated
*/
@Override
public EList getEntityAttributes()
{
if (entityAttributes == null)
{
entityAttributes = new EDataTypeEList(String.class, this, ContextMappingDSLPackage.FEATURE__ENTITY_ATTRIBUTES);
}
return entityAttributes;
}
/**
*
*
* @generated
*/
@Override
public String getContainerEntity()
{
return containerEntity;
}
/**
*
*
* @generated
*/
@Override
public void setContainerEntity(String newContainerEntity)
{
String oldContainerEntity = containerEntity;
containerEntity = newContainerEntity;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ContextMappingDSLPackage.FEATURE__CONTAINER_ENTITY, oldContainerEntity, containerEntity));
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case ContextMappingDSLPackage.FEATURE__VERB:
return getVerb();
case ContextMappingDSLPackage.FEATURE__ENTITY:
return getEntity();
case ContextMappingDSLPackage.FEATURE__ENTITY_ATTRIBUTES:
return getEntityAttributes();
case ContextMappingDSLPackage.FEATURE__CONTAINER_ENTITY:
return getContainerEntity();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case ContextMappingDSLPackage.FEATURE__VERB:
setVerb((String)newValue);
return;
case ContextMappingDSLPackage.FEATURE__ENTITY:
setEntity((String)newValue);
return;
case ContextMappingDSLPackage.FEATURE__ENTITY_ATTRIBUTES:
getEntityAttributes().clear();
getEntityAttributes().addAll((Collection extends String>)newValue);
return;
case ContextMappingDSLPackage.FEATURE__CONTAINER_ENTITY:
setContainerEntity((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case ContextMappingDSLPackage.FEATURE__VERB:
setVerb(VERB_EDEFAULT);
return;
case ContextMappingDSLPackage.FEATURE__ENTITY:
setEntity(ENTITY_EDEFAULT);
return;
case ContextMappingDSLPackage.FEATURE__ENTITY_ATTRIBUTES:
getEntityAttributes().clear();
return;
case ContextMappingDSLPackage.FEATURE__CONTAINER_ENTITY:
setContainerEntity(CONTAINER_ENTITY_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case ContextMappingDSLPackage.FEATURE__VERB:
return VERB_EDEFAULT == null ? verb != null : !VERB_EDEFAULT.equals(verb);
case ContextMappingDSLPackage.FEATURE__ENTITY:
return ENTITY_EDEFAULT == null ? entity != null : !ENTITY_EDEFAULT.equals(entity);
case ContextMappingDSLPackage.FEATURE__ENTITY_ATTRIBUTES:
return entityAttributes != null && !entityAttributes.isEmpty();
case ContextMappingDSLPackage.FEATURE__CONTAINER_ENTITY:
return CONTAINER_ENTITY_EDEFAULT == null ? containerEntity != null : !CONTAINER_ENTITY_EDEFAULT.equals(containerEntity);
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (verb: ");
result.append(verb);
result.append(", entity: ");
result.append(entity);
result.append(", entityAttributes: ");
result.append(entityAttributes);
result.append(", containerEntity: ");
result.append(containerEntity);
result.append(')');
return result.toString();
}
} //FeatureImpl