
org.eclipse.uml2.uml.internal.impl.InstanceValueImpl Maven / Gradle / Ivy
/*
* Copyright (c) 2005, 2011 IBM Corporation, CEA, 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:
* IBM - initial API and implementation
* Kenn Hussey - 286329, 323181
* Kenn Hussey (CEA) - 327039, 351774
*
*/
package org.eclipse.uml2.uml.internal.impl;
import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
import java.util.Map;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.DiagnosticChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EAnnotation;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.uml2.uml.Comment;
import org.eclipse.uml2.uml.Dependency;
import org.eclipse.uml2.uml.InstanceSpecification;
import org.eclipse.uml2.uml.InstanceValue;
import org.eclipse.uml2.uml.NamedElement;
import org.eclipse.uml2.uml.Namespace;
import org.eclipse.uml2.uml.ParameterableElement;
import org.eclipse.uml2.uml.Stereotype;
import org.eclipse.uml2.uml.StringExpression;
import org.eclipse.uml2.uml.TemplateParameter;
import org.eclipse.uml2.uml.Type;
import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.VisibilityKind;
import org.eclipse.uml2.uml.internal.operations.InstanceValueOperations;
/**
*
* An implementation of the model object 'Instance Value'.
*
*
* The following features are implemented:
*
* - {@link org.eclipse.uml2.uml.internal.impl.InstanceValueImpl#getInstance Instance}
*
*
*
* @generated
*/
public class InstanceValueImpl
extends ValueSpecificationImpl
implements InstanceValue {
/**
* The cached value of the '{@link #getInstance() Instance}' reference.
*
*
* @see #getInstance()
* @generated
* @ordered
*/
protected InstanceSpecification instance;
/**
*
*
* @generated
*/
protected InstanceValueImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return UMLPackage.Literals.INSTANCE_VALUE;
}
/**
*
*
* @generated
*/
public InstanceSpecification getInstance() {
if (instance != null && instance.eIsProxy()) {
InternalEObject oldInstance = (InternalEObject) instance;
instance = (InstanceSpecification) eResolveProxy(oldInstance);
if (instance != oldInstance) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE,
UMLPackage.INSTANCE_VALUE__INSTANCE, oldInstance,
instance));
}
}
return instance;
}
/**
*
*
* @generated
*/
public InstanceSpecification basicGetInstance() {
return instance;
}
/**
*
*
* @generated
*/
public void setInstance(InstanceSpecification newInstance) {
InstanceSpecification oldInstance = instance;
instance = newInstance;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
UMLPackage.INSTANCE_VALUE__INSTANCE, oldInstance, instance));
}
/**
*
*
* @generated
*/
@Override
public String stringValue() {
return InstanceValueOperations.stringValue(this);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case UMLPackage.INSTANCE_VALUE__EANNOTATIONS :
return getEAnnotations();
case UMLPackage.INSTANCE_VALUE__OWNED_COMMENT :
return getOwnedComments();
case UMLPackage.INSTANCE_VALUE__OWNED_ELEMENT :
return getOwnedElements();
case UMLPackage.INSTANCE_VALUE__OWNER :
if (resolve)
return getOwner();
return basicGetOwner();
case UMLPackage.INSTANCE_VALUE__CLIENT_DEPENDENCY :
return getClientDependencies();
case UMLPackage.INSTANCE_VALUE__NAME :
return getName();
case UMLPackage.INSTANCE_VALUE__NAME_EXPRESSION :
if (resolve)
return getNameExpression();
return basicGetNameExpression();
case UMLPackage.INSTANCE_VALUE__NAMESPACE :
if (resolve)
return getNamespace();
return basicGetNamespace();
case UMLPackage.INSTANCE_VALUE__QUALIFIED_NAME :
return getQualifiedName();
case UMLPackage.INSTANCE_VALUE__VISIBILITY :
return getVisibility();
case UMLPackage.INSTANCE_VALUE__OWNING_TEMPLATE_PARAMETER :
if (resolve)
return getOwningTemplateParameter();
return basicGetOwningTemplateParameter();
case UMLPackage.INSTANCE_VALUE__TEMPLATE_PARAMETER :
if (resolve)
return getTemplateParameter();
return basicGetTemplateParameter();
case UMLPackage.INSTANCE_VALUE__TYPE :
if (resolve)
return getType();
return basicGetType();
case UMLPackage.INSTANCE_VALUE__INSTANCE :
if (resolve)
return getInstance();
return basicGetInstance();
}
return eDynamicGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case UMLPackage.INSTANCE_VALUE__EANNOTATIONS :
getEAnnotations().clear();
getEAnnotations().addAll(
(Collection extends EAnnotation>) newValue);
return;
case UMLPackage.INSTANCE_VALUE__OWNED_COMMENT :
getOwnedComments().clear();
getOwnedComments().addAll(
(Collection extends Comment>) newValue);
return;
case UMLPackage.INSTANCE_VALUE__CLIENT_DEPENDENCY :
getClientDependencies().clear();
getClientDependencies().addAll(
(Collection extends Dependency>) newValue);
return;
case UMLPackage.INSTANCE_VALUE__NAME :
setName((String) newValue);
return;
case UMLPackage.INSTANCE_VALUE__NAME_EXPRESSION :
setNameExpression((StringExpression) newValue);
return;
case UMLPackage.INSTANCE_VALUE__VISIBILITY :
setVisibility((VisibilityKind) newValue);
return;
case UMLPackage.INSTANCE_VALUE__OWNING_TEMPLATE_PARAMETER :
setOwningTemplateParameter((TemplateParameter) newValue);
return;
case UMLPackage.INSTANCE_VALUE__TEMPLATE_PARAMETER :
setTemplateParameter((TemplateParameter) newValue);
return;
case UMLPackage.INSTANCE_VALUE__TYPE :
setType((Type) newValue);
return;
case UMLPackage.INSTANCE_VALUE__INSTANCE :
setInstance((InstanceSpecification) newValue);
return;
}
eDynamicSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case UMLPackage.INSTANCE_VALUE__EANNOTATIONS :
getEAnnotations().clear();
return;
case UMLPackage.INSTANCE_VALUE__OWNED_COMMENT :
getOwnedComments().clear();
return;
case UMLPackage.INSTANCE_VALUE__CLIENT_DEPENDENCY :
getClientDependencies().clear();
return;
case UMLPackage.INSTANCE_VALUE__NAME :
unsetName();
return;
case UMLPackage.INSTANCE_VALUE__NAME_EXPRESSION :
setNameExpression((StringExpression) null);
return;
case UMLPackage.INSTANCE_VALUE__VISIBILITY :
unsetVisibility();
return;
case UMLPackage.INSTANCE_VALUE__OWNING_TEMPLATE_PARAMETER :
setOwningTemplateParameter((TemplateParameter) null);
return;
case UMLPackage.INSTANCE_VALUE__TEMPLATE_PARAMETER :
setTemplateParameter((TemplateParameter) null);
return;
case UMLPackage.INSTANCE_VALUE__TYPE :
setType((Type) null);
return;
case UMLPackage.INSTANCE_VALUE__INSTANCE :
setInstance((InstanceSpecification) null);
return;
}
eDynamicUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case UMLPackage.INSTANCE_VALUE__EANNOTATIONS :
return eAnnotations != null && !eAnnotations.isEmpty();
case UMLPackage.INSTANCE_VALUE__OWNED_COMMENT :
return ownedComments != null && !ownedComments.isEmpty();
case UMLPackage.INSTANCE_VALUE__OWNED_ELEMENT :
return isSetOwnedElements();
case UMLPackage.INSTANCE_VALUE__OWNER :
return isSetOwner();
case UMLPackage.INSTANCE_VALUE__CLIENT_DEPENDENCY :
return clientDependencies != null
&& !clientDependencies.isEmpty();
case UMLPackage.INSTANCE_VALUE__NAME :
return isSetName();
case UMLPackage.INSTANCE_VALUE__NAME_EXPRESSION :
return nameExpression != null;
case UMLPackage.INSTANCE_VALUE__NAMESPACE :
return isSetNamespace();
case UMLPackage.INSTANCE_VALUE__QUALIFIED_NAME :
return QUALIFIED_NAME_EDEFAULT == null
? getQualifiedName() != null
: !QUALIFIED_NAME_EDEFAULT.equals(getQualifiedName());
case UMLPackage.INSTANCE_VALUE__VISIBILITY :
return isSetVisibility();
case UMLPackage.INSTANCE_VALUE__OWNING_TEMPLATE_PARAMETER :
return basicGetOwningTemplateParameter() != null;
case UMLPackage.INSTANCE_VALUE__TEMPLATE_PARAMETER :
return templateParameter != null;
case UMLPackage.INSTANCE_VALUE__TYPE :
return type != null;
case UMLPackage.INSTANCE_VALUE__INSTANCE :
return instance != null;
}
return eDynamicIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
@SuppressWarnings("unchecked")
public Object eInvoke(int operationID, EList> arguments)
throws InvocationTargetException {
switch (operationID) {
case UMLPackage.INSTANCE_VALUE___GET_EANNOTATION__STRING :
return getEAnnotation((String) arguments.get(0));
case UMLPackage.INSTANCE_VALUE___VALIDATE_HAS_OWNER__DIAGNOSTICCHAIN_MAP :
return validateHasOwner((DiagnosticChain) arguments.get(0),
(Map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy