/** * * 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.DataObjectBase; import org.apache.tuscany.sdo.model.ModelFactory; import org.apache.tuscany.sdo.model.Property; import org.apache.tuscany.sdo.model.Type; /** * * An implementation of the model object 'Property'. * *

* The following features are implemented: *

*

* * @generated */ public class PropertyImpl extends DataObjectBase implements Property { public final static int ALIAS_NAME = 0; public final static int ANY = -1; public final static int NAME = 1; public final static int MANY = 2; public final static int CONTAINMENT = 3; public final static int DEFAULT = 4; public final static int READ_ONLY = 5; public final static int TYPE = 6; public final static int OPPOSITE = 7; public final static int NULLABLE = 8; public final static int ANY_ATTRIBUTE = -2; public final static int SDO_PROPERTY_COUNT = 9; public final static int EXTENDED_PROPERTY_COUNT = -2; /** * The internal feature id for the 'Alias Name' attribute list. * * * @generated * @ordered */ public final static int INTERNAL_ALIAS_NAME = 0; /** * The internal feature id for the 'Any' attribute list. * * * @generated * @ordered */ public final static int INTERNAL_ANY = 1; /** * The internal feature id for the 'Name' attribute. * * * @generated * @ordered */ public final static int INTERNAL_NAME = 2; /** * The internal feature id for the 'Many' attribute. * * * @generated * @ordered */ public final static int INTERNAL_MANY = 3; /** * The internal feature id for the 'Containment' attribute. * * * @generated * @ordered */ public final static int INTERNAL_CONTAINMENT = 4; /** * The internal feature id for the 'Default' attribute. * * * @generated * @ordered */ public final static int INTERNAL_DEFAULT = 5; /** * The internal feature id for the 'Read Only' attribute. * * * @generated * @ordered */ public final static int INTERNAL_READ_ONLY = 6; /** * The internal feature id for the 'Type' reference. * * * @generated * @ordered */ public final static int INTERNAL_TYPE = 7; /** * The internal feature id for the 'Opposite' reference. * * * @generated * @ordered */ public final static int INTERNAL_OPPOSITE = 8; /** * The internal feature id for the 'Nullable' attribute. * * * @generated * @ordered */ public final static int INTERNAL_NULLABLE = 9; /** * The internal feature id for the 'Any Attribute' attribute list. * * * @generated * @ordered */ public final static int INTERNAL_ANY_ATTRIBUTE = 10; /** * The number of properties for this type. * * * @generated * @ordered */ public final static int INTERNAL_PROPERTY_COUNT = 11; protected int internalConvertIndex(int internalIndex) { switch (internalIndex) { case INTERNAL_ALIAS_NAME: return ALIAS_NAME; case INTERNAL_ANY: return ANY; case INTERNAL_NAME: return NAME; case INTERNAL_MANY: return MANY; case INTERNAL_CONTAINMENT: return CONTAINMENT; case INTERNAL_DEFAULT: return DEFAULT; case INTERNAL_READ_ONLY: return READ_ONLY; case INTERNAL_TYPE: return TYPE; case INTERNAL_OPPOSITE: return OPPOSITE; case INTERNAL_NULLABLE: return NULLABLE; case INTERNAL_ANY_ATTRIBUTE: return ANY_ATTRIBUTE; } return super.internalConvertIndex(internalIndex); } /** * The cached value of the '{@link #getAliasName() Alias Name}' attribute list. * * * @see #getAliasName() * @generated * @ordered */ protected List aliasName = null; /** * The cached value of the '{@link #getAny() Any}' attribute list. * * * @see #getAny() * @generated * @ordered */ protected Sequence any = null; /** * The default value of the '{@link #getName() Name}' attribute. * * * @see #getName() * @generated * @ordered */ protected static final String NAME_DEFAULT_ = null; /** * The cached value of the '{@link #getName() Name}' attribute. * * * @see #getName() * @generated * @ordered */ protected String name = NAME_DEFAULT_; /** * This is true if the Name attribute has been set. * * * @generated * @ordered */ protected boolean name_set_ = false; /** * The default value of the '{@link #isMany() Many}' attribute. * * * @see #isMany() * @generated * @ordered */ protected static final boolean MANY_DEFAULT_ = false; /** * The cached value of the '{@link #isMany() Many}' attribute. * * * @see #isMany() * @generated * @ordered */ protected boolean many = MANY_DEFAULT_; /** * This is true if the Many attribute has been set. * * * @generated * @ordered */ protected boolean many_set_ = false; /** * The default value of the '{@link #isContainment() Containment}' attribute. * * * @see #isContainment() * @generated * @ordered */ protected static final boolean CONTAINMENT_DEFAULT_ = false; /** * The cached value of the '{@link #isContainment() Containment}' attribute. * * * @see #isContainment() * @generated * @ordered */ protected boolean containment = CONTAINMENT_DEFAULT_; /** * This is true if the Containment attribute has been set. * * * @generated * @ordered */ protected boolean containment_set_ = false; /** * The default value of the '{@link #getDefault_() Default}' attribute. * * * @see #getDefault_() * @generated * @ordered */ protected static final String DEFAULT_DEFAULT_ = null; /** * The cached value of the '{@link #getDefault_() Default}' attribute. * * * @see #getDefault_() * @generated * @ordered */ protected String default_ = DEFAULT_DEFAULT_; /** * This is true if the Default attribute has been set. * * * @generated * @ordered */ protected boolean default_set_ = false; /** * The default value of the '{@link #isReadOnly() Read Only}' attribute. * * * @see #isReadOnly() * @generated * @ordered */ protected static final boolean READ_ONLY_DEFAULT_ = false; /** * The cached value of the '{@link #isReadOnly() Read Only}' attribute. * * * @see #isReadOnly() * @generated * @ordered */ protected boolean readOnly = READ_ONLY_DEFAULT_; /** * This is true if the Read Only attribute has been set. * * * @generated * @ordered */ protected boolean readOnly_set_ = false; /** * The cached value of the '{@link #getType_() Type}' reference. * * * @see #getType_() * @generated * @ordered */ protected Type type = null; /** * This is true if the Type reference has been set. * * * @generated * @ordered */ protected boolean type_set_ = false; /** * The cached value of the '{@link #getOpposite_() Opposite}' reference. * * * @see #getOpposite_() * @generated * @ordered */ protected Property opposite = null; /** * This is true if the Opposite reference has been set. * * * @generated * @ordered */ protected boolean opposite_set_ = false; /** * The default value of the '{@link #isNullable() Nullable}' attribute. * * * @see #isNullable() * @generated * @ordered */ protected static final boolean NULLABLE_DEFAULT_ = false; /** * The cached value of the '{@link #isNullable() Nullable}' attribute. * * * @see #isNullable() * @generated * @ordered */ protected boolean nullable = NULLABLE_DEFAULT_; /** * This is true if the Nullable attribute has been set. * * * @generated * @ordered */ protected boolean nullable_set_ = false; /** * The cached value of the '{@link #getAnyAttribute() Any Attribute}' attribute list. * * * @see #getAnyAttribute() * @generated * @ordered */ protected Sequence anyAttribute = null; /** * * * @generated */ public PropertyImpl() { super(); } /** * * * @generated */ public commonj.sdo.Type getStaticType() { return ((ModelFactoryImpl)ModelFactory.INSTANCE).getProperty(); } /** * * * @generated */ public List getAliasName() { if (aliasName == null) { aliasName = createPropertyList(ListKind.DATATYPE, String.class, ALIAS_NAME, 0); } return aliasName; } /** * * * @generated */ public Sequence getAny() { if (any == null) { any = createSequence(INTERNAL_ANY); } return any; } /** * * * @generated */ public String getName() { return name; } /** * * * @generated */ public void setName(String newName) { String oldName = name; name = newName; boolean oldName_set_ = name_set_; name_set_ = true; if (isNotifying()) notify(ChangeKind.SET, INTERNAL_NAME, oldName, name, !oldName_set_); } /** * * * @generated */ public void unsetName() { String oldName = name; boolean oldName_set_ = name_set_; name = NAME_DEFAULT_; name_set_ = false; if (isNotifying()) notify(ChangeKind.UNSET, INTERNAL_NAME, oldName, NAME_DEFAULT_, oldName_set_); } /** * * * @generated */ public boolean isSetName() { return name_set_; } /** * * * @generated */ public boolean isMany() { return many; } /** * * * @generated */ public void setMany(boolean newMany) { boolean oldMany = many; many = newMany; boolean oldMany_set_ = many_set_; many_set_ = true; if (isNotifying()) notify(ChangeKind.SET, INTERNAL_MANY, oldMany, many, !oldMany_set_); } /** * * * @generated */ public void unsetMany() { boolean oldMany = many; boolean oldMany_set_ = many_set_; many = MANY_DEFAULT_; many_set_ = false; if (isNotifying()) notify(ChangeKind.UNSET, INTERNAL_MANY, oldMany, MANY_DEFAULT_, oldMany_set_); } /** * * * @generated */ public boolean isSetMany() { return many_set_; } /** * * * @generated */ public boolean isContainment() { return containment; } /** * * * @generated */ public void setContainment(boolean newContainment) { boolean oldContainment = containment; containment = newContainment; boolean oldContainment_set_ = containment_set_; containment_set_ = true; if (isNotifying()) notify(ChangeKind.SET, INTERNAL_CONTAINMENT, oldContainment, containment, !oldContainment_set_); } /** * * * @generated */ public void unsetContainment() { boolean oldContainment = containment; boolean oldContainment_set_ = containment_set_; containment = CONTAINMENT_DEFAULT_; containment_set_ = false; if (isNotifying()) notify(ChangeKind.UNSET, INTERNAL_CONTAINMENT, oldContainment, CONTAINMENT_DEFAULT_, oldContainment_set_); } /** * * * @generated */ public boolean isSetContainment() { return containment_set_; } /** * * * @generated */ public String getDefault_() { return default_; } /** * * * @generated */ public void setDefault_(String newDefault) { String oldDefault = default_; default_ = newDefault; boolean oldDefault_set_ = default_set_; default_set_ = true; if (isNotifying()) notify(ChangeKind.SET, INTERNAL_DEFAULT, oldDefault, default_, !oldDefault_set_); } /** * * * @generated */ public void unsetDefault() { String oldDefault = default_; boolean oldDefault_set_ = default_set_; default_ = DEFAULT_DEFAULT_; default_set_ = false; if (isNotifying()) notify(ChangeKind.UNSET, INTERNAL_DEFAULT, oldDefault, DEFAULT_DEFAULT_, oldDefault_set_); } /** * * * @generated */ public boolean isSetDefault() { return default_set_; } /** * * * @generated */ public boolean isReadOnly() { return readOnly; } /** * * * @generated */ public void setReadOnly(boolean newReadOnly) { boolean oldReadOnly = readOnly; readOnly = newReadOnly; boolean oldReadOnly_set_ = readOnly_set_; readOnly_set_ = true; if (isNotifying()) notify(ChangeKind.SET, INTERNAL_READ_ONLY, oldReadOnly, readOnly, !oldReadOnly_set_); } /** * * * @generated */ public void unsetReadOnly() { boolean oldReadOnly = readOnly; boolean oldReadOnly_set_ = readOnly_set_; readOnly = READ_ONLY_DEFAULT_; readOnly_set_ = false; if (isNotifying()) notify(ChangeKind.UNSET, INTERNAL_READ_ONLY, oldReadOnly, READ_ONLY_DEFAULT_, oldReadOnly_set_); } /** * * * @generated */ public boolean isSetReadOnly() { return readOnly_set_; } /** * * * @generated */ public Type getType_() { if (type != null && isProxy(type)) { Object oldType = type; type = (Type)resolveProxy(oldType); if (type != oldType) { if (isNotifying()) notify(ChangeKind.RESOLVE, INTERNAL_TYPE, oldType, type); } } return type; } /** * * * @generated */ public Type basicGetType() { return type; } /** * * * @generated */ public void setType(Type newType) { Type oldType = type; type = newType; boolean oldType_set_ = type_set_; type_set_ = true; if (isNotifying()) notify(ChangeKind.SET, INTERNAL_TYPE, oldType, type, !oldType_set_); } /** * * * @generated */ public void unsetType() { Type oldType = type; boolean oldType_set_ = type_set_; type = null; type_set_ = false; if (isNotifying()) notify(ChangeKind.UNSET, INTERNAL_TYPE, oldType, null, oldType_set_); } /** * * * @generated */ public boolean isSetType() { return type_set_; } /** * * * @generated */ public Property getOpposite_() { if (opposite != null && isProxy(opposite)) { Object oldOpposite = opposite; opposite = (Property)resolveProxy(oldOpposite); if (opposite != oldOpposite) { if (isNotifying()) notify(ChangeKind.RESOLVE, INTERNAL_OPPOSITE, oldOpposite, opposite); } } return opposite; } /** * * * @generated */ public Property basicGetOpposite() { return opposite; } /** * * * @generated */ public void setOpposite_(Property newOpposite) { Property oldOpposite = opposite; opposite = newOpposite; boolean oldOpposite_set_ = opposite_set_; opposite_set_ = true; if (isNotifying()) notify(ChangeKind.SET, INTERNAL_OPPOSITE, oldOpposite, opposite, !oldOpposite_set_); } /** * * * @generated */ public void unsetOpposite() { Property oldOpposite = opposite; boolean oldOpposite_set_ = opposite_set_; opposite = null; opposite_set_ = false; if (isNotifying()) notify(ChangeKind.UNSET, INTERNAL_OPPOSITE, oldOpposite, null, oldOpposite_set_); } /** * * * @generated */ public boolean isSetOpposite() { return opposite_set_; } /** * * * @generated */ public boolean isNullable() { return nullable; } /** * * * @generated */ public void setNullable(boolean newNullable) { boolean oldNullable = nullable; nullable = newNullable; boolean oldNullable_set_ = nullable_set_; nullable_set_ = true; if (isNotifying()) notify(ChangeKind.SET, INTERNAL_NULLABLE, oldNullable, nullable, !oldNullable_set_); } /** * * * @generated */ public void unsetNullable() { boolean oldNullable = nullable; boolean oldNullable_set_ = nullable_set_; nullable = NULLABLE_DEFAULT_; nullable_set_ = false; if (isNotifying()) notify(ChangeKind.UNSET, INTERNAL_NULLABLE, oldNullable, NULLABLE_DEFAULT_, oldNullable_set_); } /** * * * @generated */ public boolean isSetNullable() { return nullable_set_; } /** * * * @generated */ public Sequence getAnyAttribute() { if (anyAttribute == null) { anyAttribute = createSequence(INTERNAL_ANY_ATTRIBUTE); } return anyAttribute; } /** * * * @generated */ public ChangeContext inverseRemove(Object otherEnd, int propertyIndex, ChangeContext changeContext) { switch (propertyIndex) { case ANY: return removeFromSequence(getAny(), otherEnd, changeContext); case ANY_ATTRIBUTE: return removeFromSequence(getAnyAttribute(), otherEnd, changeContext); } return super.inverseRemove(otherEnd, propertyIndex, changeContext); } /** * * * @generated */ public Object get(int propertyIndex, boolean resolve) { switch (propertyIndex) { case ALIAS_NAME: return getAliasName(); case ANY: // XXX query introduce coreType as an argument? -- semantic = if true -- coreType - return the core EMF object if value is a non-EMF wrapper/view //if (coreType) return getAny(); case NAME: return getName(); case MANY: return isMany() ? Boolean.TRUE : Boolean.FALSE; case CONTAINMENT: return isContainment() ? Boolean.TRUE : Boolean.FALSE; case DEFAULT: return getDefault_(); case READ_ONLY: return isReadOnly() ? Boolean.TRUE : Boolean.FALSE; case TYPE: if (resolve) return getType_(); return basicGetType(); case OPPOSITE: if (resolve) return getOpposite_(); return basicGetOpposite(); case NULLABLE: return isNullable() ? Boolean.TRUE : Boolean.FALSE; case ANY_ATTRIBUTE: // XXX query introduce coreType as an argument? -- semantic = if true -- coreType - return the core EMF object if value is a non-EMF wrapper/view //if (coreType) return getAnyAttribute(); } return super.get(propertyIndex, resolve); } /** * * * @generated */ public void set(int propertyIndex, Object newValue) { switch (propertyIndex) { case ALIAS_NAME: getAliasName().clear(); getAliasName().addAll((Collection)newValue); return; case ANY: setSequence(getAny(), newValue); return; case NAME: setName((String)newValue); return; case MANY: setMany(((Boolean)newValue).booleanValue()); return; case CONTAINMENT: setContainment(((Boolean)newValue).booleanValue()); return; case DEFAULT: setDefault_((String)newValue); return; case READ_ONLY: setReadOnly(((Boolean)newValue).booleanValue()); return; case TYPE: setType((Type)newValue); return; case OPPOSITE: setOpposite_((Property)newValue); return; case NULLABLE: setNullable(((Boolean)newValue).booleanValue()); return; case ANY_ATTRIBUTE: setSequence(getAnyAttribute(), newValue); return; } super.set(propertyIndex, newValue); } /** * * * @generated */ public void unset(int propertyIndex) { switch (propertyIndex) { case ALIAS_NAME: getAliasName().clear(); return; case ANY: unsetSequence(getAny()); return; case NAME: unsetName(); return; case MANY: unsetMany(); return; case CONTAINMENT: unsetContainment(); return; case DEFAULT: unsetDefault(); return; case READ_ONLY: unsetReadOnly(); return; case TYPE: unsetType(); return; case OPPOSITE: unsetOpposite(); return; case NULLABLE: unsetNullable(); return; case ANY_ATTRIBUTE: unsetSequence(getAnyAttribute()); return; } super.unset(propertyIndex); } /** * * * @generated */ public boolean isSet(int propertyIndex) { switch (propertyIndex) { case ALIAS_NAME: return aliasName != null && !aliasName.isEmpty(); case ANY: return any != null && !isSequenceEmpty(getAny()); case NAME: return isSetName(); case MANY: return isSetMany(); case CONTAINMENT: return isSetContainment(); case DEFAULT: return isSetDefault(); case READ_ONLY: return isSetReadOnly(); case TYPE: return isSetType(); case OPPOSITE: return isSetOpposite(); case NULLABLE: return isSetNullable(); case ANY_ATTRIBUTE: return anyAttribute != null && !isSequenceEmpty(getAnyAttribute()); } return super.isSet(propertyIndex); } /** * * * @generated */ public String toString() { if (isProxy(this)) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (aliasName: "); result.append(aliasName); result.append(", any: "); result.append(any); result.append(", name: "); if (name_set_) result.append(name); else result.append(""); result.append(", many: "); if (many_set_) result.append(many); else result.append(""); result.append(", containment: "); if (containment_set_) result.append(containment); else result.append(""); result.append(", default: "); if (default_set_) result.append(default_); else result.append(""); result.append(", readOnly: "); if (readOnly_set_) result.append(readOnly); else result.append(""); result.append(", nullable: "); if (nullable_set_) result.append(nullable); else result.append(""); result.append(", anyAttribute: "); result.append(anyAttribute); result.append(')'); return result.toString(); } } //PropertyImpl