/**
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.tuscany.sdo.model.impl;
import commonj.sdo.Sequence;
import java.util.Collection;
import java.util.List;
import org.apache.tuscany.sdo.impl.DataObjectImpl;
import org.apache.tuscany.sdo.model.Property;
import org.apache.tuscany.sdo.model.Type;
import org.apache.tuscany.sdo.util.BasicSequence;
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.EObject;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.BasicFeatureMap;
import org.eclipse.emf.ecore.util.EDataTypeEList;
import org.eclipse.emf.ecore.util.FeatureMap;
import org.eclipse.emf.ecore.util.InternalEList;
/**
*
* An implementation of the model object 'Property'.
*
*
* The following features are implemented:
*
* - {@link org.apache.tuscany.sdo.model.impl.PropertyImpl#getAliasName Alias Name}
* - {@link org.apache.tuscany.sdo.model.impl.PropertyImpl#getAny Any}
* - {@link org.apache.tuscany.sdo.model.impl.PropertyImpl#isContainment Containment}
* - {@link org.apache.tuscany.sdo.model.impl.PropertyImpl#getDefault Default}
* - {@link org.apache.tuscany.sdo.model.impl.PropertyImpl#isMany Many}
* - {@link org.apache.tuscany.sdo.model.impl.PropertyImpl#getName Name}
* - {@link org.apache.tuscany.sdo.model.impl.PropertyImpl#getOpposite Opposite}
* - {@link org.apache.tuscany.sdo.model.impl.PropertyImpl#isReadOnly Read Only}
* - {@link org.apache.tuscany.sdo.model.impl.PropertyImpl#getType Type}
* - {@link org.apache.tuscany.sdo.model.impl.PropertyImpl#getAnyAttribute Any Attribute}
*
*
*
* Note: The getDefault and getOpposite methods had to be renamed to avoid
* conflict with the commonj.sdo.Property getDefault and getOpposite
* methods in classes that implement both. Eventually, the two interfaces
* should be brought in-line with one another -- James Snell
*
* @generated
*/
public class PropertyImpl extends DataObjectImpl implements Property
{
/**
* The cached value of the '{@link #getAliasName() Alias Name}' attribute list.
*
*
* @see #getAliasName()
* @generated
* @ordered
*/
protected EList aliasName = null;
/**
* The cached value of the '{@link #getAny() Any}' attribute list.
*
*
* @see #getAny()
* @generated
* @ordered
*/
protected BasicSequence any = null;
/**
* The default value of the '{@link #isContainment() Containment}' attribute.
*
*
* @see #isContainment()
* @generated
* @ordered
*/
protected static final boolean CONTAINMENT_EDEFAULT = false;
/**
* The cached value of the '{@link #isContainment() Containment}' attribute.
*
*
* @see #isContainment()
* @generated
* @ordered
*/
protected boolean containment = CONTAINMENT_EDEFAULT;
/**
* This is true if the Containment attribute has been set.
*
*
* @generated
* @ordered
*/
protected boolean containmentESet = false;
/**
* The default value of the '{@link #getDefault() Default}' attribute.
*
*
* @see #getDefault()
* @generated
* @ordered
*/
protected static final String DEFAULT_EDEFAULT = null;
/**
* The cached value of the '{@link #getDefault() Default}' attribute.
*
*
* @see #getDefault()
* @generated
* @ordered
*/
protected String default_ = DEFAULT_EDEFAULT;
/**
* The default value of the '{@link #isMany() Many}' attribute.
*
*
* @see #isMany()
* @generated
* @ordered
*/
protected static final boolean MANY_EDEFAULT = false;
/**
* The cached value of the '{@link #isMany() Many}' attribute.
*
*
* @see #isMany()
* @generated
* @ordered
*/
protected boolean many = MANY_EDEFAULT;
/**
* This is true if the Many attribute has been set.
*
*
* @generated
* @ordered
*/
protected boolean manyESet = false;
/**
* The default value of the '{@link #getName() Name}' attribute.
*
*
* @see #getName()
* @generated
* @ordered
*/
protected static final String NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getName() Name}' attribute.
*
*
* @see #getName()
* @generated
* @ordered
*/
protected String name = NAME_EDEFAULT;
/**
* The cached value of the '{@link #getOpposite() Opposite}' reference.
*
*
* @see #getOpposite()
* @generated
* @ordered
*/
protected Property opposite = null;
/**
* The default value of the '{@link #isReadOnly() Read Only}' attribute.
*
*
* @see #isReadOnly()
* @generated
* @ordered
*/
protected static final boolean READ_ONLY_EDEFAULT = false;
/**
* The cached value of the '{@link #isReadOnly() Read Only}' attribute.
*
*
* @see #isReadOnly()
* @generated
* @ordered
*/
protected boolean readOnly = READ_ONLY_EDEFAULT;
/**
* This is true if the Read Only attribute has been set.
*
*
* @generated
* @ordered
*/
protected boolean readOnlyESet = false;
/**
* The cached value of the '{@link #getType() Type}' reference.
*
*
* @see #getType()
* @generated
* @ordered
*/
protected Type type = null;
/**
* The cached value of the '{@link #getAnyAttribute() Any Attribute}' attribute list.
*
*
* @see #getAnyAttribute()
* @generated
* @ordered
*/
protected BasicSequence anyAttribute = null;
/**
*
*
* @generated
*/
protected PropertyImpl()
{
super();
}
/**
*
*
* @generated
*/
protected EClass eStaticClass()
{
return ModelPackageImpl.Literals.PROPERTY;
}
/**
*
*
* @generated
*/
public List getAliasName()
{
if (aliasName == null)
{
aliasName = new EDataTypeEList(String.class, this, ModelPackageImpl.PROPERTY__ALIAS_NAME);
}
return aliasName;
}
/**
*
*
* @generated
*/
public Sequence getAny()
{
if (any == null)
{
any = new BasicSequence(new BasicFeatureMap(this, ModelPackageImpl.PROPERTY__ANY));
}
return any;
}
/**
*
*
* @generated
*/
public boolean isContainment()
{
return containment;
}
/**
*
*
* @generated
*/
public void setContainment(boolean newContainment)
{
boolean oldContainment = containment;
containment = newContainment;
boolean oldContainmentESet = containmentESet;
containmentESet = true;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ModelPackageImpl.PROPERTY__CONTAINMENT, oldContainment, containment, !oldContainmentESet));
}
/**
*
*
* @generated
*/
public void unsetContainment()
{
boolean oldContainment = containment;
boolean oldContainmentESet = containmentESet;
containment = CONTAINMENT_EDEFAULT;
containmentESet = false;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.UNSET, ModelPackageImpl.PROPERTY__CONTAINMENT, oldContainment, CONTAINMENT_EDEFAULT, oldContainmentESet));
}
/**
*
*
* @generated
*/
public boolean isSetContainment()
{
return containmentESet;
}
/**
*
*
* @generated NOT
*/
public String getDefault_()
{
return default_;
}
/**
*
*
* @generated
*/
public void setDefault_(String newDefault)
{
String oldDefault = default_;
default_ = newDefault;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ModelPackageImpl.PROPERTY__DEFAULT, oldDefault, default_));
}
/**
*
*
* @generated
*/
public boolean isMany()
{
return many;
}
/**
*
*
* @generated
*/
public void setMany(boolean newMany)
{
boolean oldMany = many;
many = newMany;
boolean oldManyESet = manyESet;
manyESet = true;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ModelPackageImpl.PROPERTY__MANY, oldMany, many, !oldManyESet));
}
/**
*
*
* @generated
*/
public void unsetMany()
{
boolean oldMany = many;
boolean oldManyESet = manyESet;
many = MANY_EDEFAULT;
manyESet = false;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.UNSET, ModelPackageImpl.PROPERTY__MANY, oldMany, MANY_EDEFAULT, oldManyESet));
}
/**
*
*
* @generated
*/
public boolean isSetMany()
{
return manyESet;
}
/**
*
*
* @generated
*/
public String getName()
{
return name;
}
/**
*
*
* @generated
*/
public void setName(String newName)
{
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ModelPackageImpl.PROPERTY__NAME, oldName, name));
}
/**
*
*
* @generated NOT
*/
public Property getOpposite_()
{
if (opposite != null && ((EObject)opposite).eIsProxy())
{
InternalEObject oldOpposite = (InternalEObject)opposite;
opposite = (Property)eResolveProxy(oldOpposite);
if (opposite != oldOpposite)
{
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, ModelPackageImpl.PROPERTY__OPPOSITE, oldOpposite, opposite));
}
}
return opposite;
}
/**
*
*
* @generated
*/
public Property basicGetOpposite()
{
return opposite;
}
/**
*
*
* @generated NOT
*/
public void setOpposite_(Property newOpposite)
{
Property oldOpposite = opposite;
opposite = newOpposite;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ModelPackageImpl.PROPERTY__OPPOSITE, oldOpposite, opposite));
}
/**
*
*
* @generated
*/
public boolean isReadOnly()
{
return readOnly;
}
/**
*
*
* @generated
*/
public void setReadOnly(boolean newReadOnly)
{
boolean oldReadOnly = readOnly;
readOnly = newReadOnly;
boolean oldReadOnlyESet = readOnlyESet;
readOnlyESet = true;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ModelPackageImpl.PROPERTY__READ_ONLY, oldReadOnly, readOnly, !oldReadOnlyESet));
}
/**
*
*
* @generated
*/
public void unsetReadOnly()
{
boolean oldReadOnly = readOnly;
boolean oldReadOnlyESet = readOnlyESet;
readOnly = READ_ONLY_EDEFAULT;
readOnlyESet = false;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.UNSET, ModelPackageImpl.PROPERTY__READ_ONLY, oldReadOnly, READ_ONLY_EDEFAULT, oldReadOnlyESet));
}
/**
*
*
* @generated
*/
public boolean isSetReadOnly()
{
return readOnlyESet;
}
/**
*
*
* @generated
*/
public Type getType_()
{
if (type != null && ((EObject)type).eIsProxy())
{
InternalEObject oldType = (InternalEObject)type;
type = (Type)eResolveProxy(oldType);
if (type != oldType)
{
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, ModelPackageImpl.PROPERTY__TYPE, oldType, type));
}
}
return type;
}
/**
*
*
* @generated
*/
public Type basicGetType()
{
return type;
}
/**
*
*
* @generated
*/
public void setType(Type newType)
{
Type oldType = type;
type = newType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ModelPackageImpl.PROPERTY__TYPE, oldType, type));
}
/**
*
*
* @generated
*/
public Sequence getAnyAttribute()
{
if (anyAttribute == null)
{
anyAttribute = new BasicSequence(new BasicFeatureMap(this, ModelPackageImpl.PROPERTY__ANY_ATTRIBUTE));
}
return anyAttribute;
}
/**
*
*
* @generated
*/
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case ModelPackageImpl.PROPERTY__ANY:
return ((InternalEList)((FeatureMap.Internal.Wrapper)getAny()).featureMap()).basicRemove(otherEnd, msgs);
case ModelPackageImpl.PROPERTY__ANY_ATTRIBUTE:
return ((InternalEList)((FeatureMap.Internal.Wrapper)getAnyAttribute()).featureMap()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case ModelPackageImpl.PROPERTY__ALIAS_NAME:
return getAliasName();
case ModelPackageImpl.PROPERTY__ANY:
if (coreType) return ((FeatureMap.Internal.Wrapper)getAny()).featureMap();
return getAny();
case ModelPackageImpl.PROPERTY__CONTAINMENT:
return isContainment() ? Boolean.TRUE : Boolean.FALSE;
case ModelPackageImpl.PROPERTY__DEFAULT:
return getDefault_();
case ModelPackageImpl.PROPERTY__MANY:
return isMany() ? Boolean.TRUE : Boolean.FALSE;
case ModelPackageImpl.PROPERTY__NAME:
return getName();
case ModelPackageImpl.PROPERTY__OPPOSITE:
if (resolve) return getOpposite_();
return basicGetOpposite();
case ModelPackageImpl.PROPERTY__READ_ONLY:
return isReadOnly() ? Boolean.TRUE : Boolean.FALSE;
case ModelPackageImpl.PROPERTY__TYPE:
if (resolve) return getType_();
return basicGetType();
case ModelPackageImpl.PROPERTY__ANY_ATTRIBUTE:
if (coreType) return ((FeatureMap.Internal.Wrapper)getAnyAttribute()).featureMap();
return getAnyAttribute();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case ModelPackageImpl.PROPERTY__ALIAS_NAME:
getAliasName().clear();
getAliasName().addAll((Collection)newValue);
return;
case ModelPackageImpl.PROPERTY__ANY:
((FeatureMap.Internal)((FeatureMap.Internal.Wrapper)getAny()).featureMap()).set(newValue);
return;
case ModelPackageImpl.PROPERTY__CONTAINMENT:
setContainment(((Boolean)newValue).booleanValue());
return;
case ModelPackageImpl.PROPERTY__DEFAULT:
setDefault_((String)newValue);
return;
case ModelPackageImpl.PROPERTY__MANY:
setMany(((Boolean)newValue).booleanValue());
return;
case ModelPackageImpl.PROPERTY__NAME:
setName((String)newValue);
return;
case ModelPackageImpl.PROPERTY__OPPOSITE:
setOpposite_((Property)newValue);
return;
case ModelPackageImpl.PROPERTY__READ_ONLY:
setReadOnly(((Boolean)newValue).booleanValue());
return;
case ModelPackageImpl.PROPERTY__TYPE:
setType((Type)newValue);
return;
case ModelPackageImpl.PROPERTY__ANY_ATTRIBUTE:
((FeatureMap.Internal)((FeatureMap.Internal.Wrapper)getAnyAttribute()).featureMap()).set(newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
public void eUnset(int featureID)
{
switch (featureID)
{
case ModelPackageImpl.PROPERTY__ALIAS_NAME:
getAliasName().clear();
return;
case ModelPackageImpl.PROPERTY__ANY:
((FeatureMap.Internal.Wrapper)getAny()).featureMap().clear();
return;
case ModelPackageImpl.PROPERTY__CONTAINMENT:
unsetContainment();
return;
case ModelPackageImpl.PROPERTY__DEFAULT:
setDefault_(DEFAULT_EDEFAULT);
return;
case ModelPackageImpl.PROPERTY__MANY:
unsetMany();
return;
case ModelPackageImpl.PROPERTY__NAME:
setName(NAME_EDEFAULT);
return;
case ModelPackageImpl.PROPERTY__OPPOSITE:
setOpposite_((Property)null);
return;
case ModelPackageImpl.PROPERTY__READ_ONLY:
unsetReadOnly();
return;
case ModelPackageImpl.PROPERTY__TYPE:
setType((Type)null);
return;
case ModelPackageImpl.PROPERTY__ANY_ATTRIBUTE:
((FeatureMap.Internal.Wrapper)getAnyAttribute()).featureMap().clear();
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case ModelPackageImpl.PROPERTY__ALIAS_NAME:
return aliasName != null && !aliasName.isEmpty();
case ModelPackageImpl.PROPERTY__ANY:
return any != null && !any.featureMap().isEmpty();
case ModelPackageImpl.PROPERTY__CONTAINMENT:
return isSetContainment();
case ModelPackageImpl.PROPERTY__DEFAULT:
return DEFAULT_EDEFAULT == null ? default_ != null : !DEFAULT_EDEFAULT.equals(default_);
case ModelPackageImpl.PROPERTY__MANY:
return isSetMany();
case ModelPackageImpl.PROPERTY__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case ModelPackageImpl.PROPERTY__OPPOSITE:
return opposite != null;
case ModelPackageImpl.PROPERTY__READ_ONLY:
return isSetReadOnly();
case ModelPackageImpl.PROPERTY__TYPE:
return type != null;
case ModelPackageImpl.PROPERTY__ANY_ATTRIBUTE:
return anyAttribute != null && !anyAttribute.featureMap().isEmpty();
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (aliasName: ");
result.append(aliasName);
result.append(", any: ");
result.append(any);
result.append(", containment: ");
if (containmentESet) result.append(containment); else result.append("");
result.append(", default: ");
result.append(default_);
result.append(", many: ");
if (manyESet) result.append(many); else result.append("");
result.append(", name: ");
result.append(name);
result.append(", readOnly: ");
if (readOnlyESet) result.append(readOnly); else result.append("");
result.append(", anyAttribute: ");
result.append(anyAttribute);
result.append(')');
return result.toString();
}
} //PropertyImpl