| /******************************************************************************* |
| * Copyright (c) 2006, 2009 Oracle. 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: |
| * Oracle - initial API and implementation |
| ******************************************************************************/ |
| package org.eclipse.jpt.core.resource.persistence; |
| |
| import java.util.Collection; |
| 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.EStructuralFeature; |
| import org.eclipse.emf.ecore.InternalEObject; |
| import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| import org.eclipse.jpt.core.internal.resource.xml.translators.SimpleTranslator; |
| import org.eclipse.jpt.core.resource.xml.AbstractJpaEObject; |
| import org.eclipse.jpt.core.resource.xml.JpaEObject; |
| import org.eclipse.wst.common.internal.emf.resource.Translator; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * A representation of the model object '<em><b>XmlProperties</b></em>'. |
| * |
| * Provisional API: This interface is part of an interim API that is still |
| * under development and expected to change significantly before reaching |
| * stability. It is available at this early stage to solicit feedback from |
| * pioneering adopters on the understanding that any code that uses this API |
| * will almost certainly be broken (repeatedly) as the API evolves. |
| * <!-- end-user-doc --> |
| * |
| * <p> |
| * The following features are supported: |
| * <ul> |
| * <li>{@link org.eclipse.jpt.core.resource.persistence.XmlProperties#getProperties <em>Properties</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @see org.eclipse.jpt.core.resource.persistence.PersistencePackage#getXmlProperties() |
| * @model kind="class" |
| * @extends JpaEObject |
| * @generated |
| */ |
| public class XmlProperties extends AbstractJpaEObject implements JpaEObject |
| { |
| /** |
| * The cached value of the '{@link #getProperties() <em>Properties</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getProperties() |
| * @generated |
| * @ordered |
| */ |
| protected EList<XmlProperty> properties; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected XmlProperties() |
| { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() |
| { |
| return PersistencePackage.Literals.XML_PROPERTIES; |
| } |
| |
| /** |
| * Returns the value of the '<em><b>Properties</b></em>' containment reference list. |
| * The list contents are of type {@link org.eclipse.jpt.core.resource.persistence.XmlProperty}. |
| * <!-- begin-user-doc --> |
| * <p> |
| * If the meaning of the '<em>XmlProperties</em>' containment reference list isn't clear, |
| * there really should be more of a description here... |
| * </p> |
| * <!-- end-user-doc --> |
| * @return the value of the '<em>Properties</em>' containment reference list. |
| * @see org.eclipse.jpt.core.resource.persistence.PersistencePackage#getXmlProperties_Properties() |
| * @model containment="true" |
| * @generated |
| */ |
| public EList<XmlProperty> getProperties() |
| { |
| if (properties == null) |
| { |
| properties = new EObjectContainmentEList<XmlProperty>(XmlProperty.class, this, PersistencePackage.XML_PROPERTIES__PROPERTIES); |
| } |
| return properties; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) |
| { |
| switch (featureID) |
| { |
| case PersistencePackage.XML_PROPERTIES__PROPERTIES: |
| return ((InternalEList<?>)getProperties()).basicRemove(otherEnd, msgs); |
| } |
| return super.eInverseRemove(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) |
| { |
| switch (featureID) |
| { |
| case PersistencePackage.XML_PROPERTIES__PROPERTIES: |
| return getProperties(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public void eSet(int featureID, Object newValue) |
| { |
| switch (featureID) |
| { |
| case PersistencePackage.XML_PROPERTIES__PROPERTIES: |
| getProperties().clear(); |
| getProperties().addAll((Collection<? extends XmlProperty>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) |
| { |
| switch (featureID) |
| { |
| case PersistencePackage.XML_PROPERTIES__PROPERTIES: |
| getProperties().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) |
| { |
| switch (featureID) |
| { |
| case PersistencePackage.XML_PROPERTIES__PROPERTIES: |
| return properties != null && !properties.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| |
| // ********** translators ********** |
| |
| public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) { |
| return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren()); |
| } |
| |
| private static Translator[] buildTranslatorChildren() { |
| return new Translator[] { |
| XmlProperty.buildTranslator(JPA.PROPERTY, PersistencePackage.eINSTANCE.getXmlProperties_Properties()), |
| }; |
| } |
| |
| } |