diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/orm/EntityListener.java')
-rw-r--r-- | jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/orm/EntityListener.java | 227 |
1 files changed, 227 insertions, 0 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/orm/EntityListener.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/orm/EntityListener.java new file mode 100644 index 0000000000..cf0b022612 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/orm/EntityListener.java @@ -0,0 +1,227 @@ +/******************************************************************************* + * Copyright (c) 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.jpa2.resource.orm; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EStructuralFeature; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.jpt.core.internal.resource.xml.translators.SimpleTranslator; +import org.eclipse.jpt.core.resource.orm.OrmPackage; +import org.eclipse.wst.common.internal.emf.resource.Translator; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Entity Listener</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.jpt.core.jpa2.resource.orm.EntityListener#getDescription <em>Description</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.jpt.core.jpa2.resource.orm.Orm2_0Package#getEntityListener() + * @model kind="class" + * @generated + */ +public class EntityListener extends org.eclipse.jpt.core.resource.orm.EntityListener +{ + /** + * The default value of the '{@link #getDescription() <em>Description</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getDescription() + * @generated + * @ordered + */ + protected static final String DESCRIPTION_EDEFAULT = null; + + /** + * The cached value of the '{@link #getDescription() <em>Description</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getDescription() + * @generated + * @ordered + */ + protected String description = DESCRIPTION_EDEFAULT; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected EntityListener() + { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() + { + return Orm2_0Package.Literals.ENTITY_LISTENER; + } + + /** + * Returns the value of the '<em><b>Description</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Description</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Description</em>' attribute. + * @see #setDescription(String) + * @see org.eclipse.jpt.core.jpa2.resource.orm.Orm2_0Package#getEntityListener_Description() + * @model dataType="org.eclipse.emf.ecore.xml.type.String" + * @generated + */ + public String getDescription() + { + return description; + } + + /** + * Sets the value of the '{@link org.eclipse.jpt.core.jpa2.resource.orm.EntityListener#getDescription <em>Description</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Description</em>' attribute. + * @see #getDescription() + * @generated + */ + public void setDescription(String newDescription) + { + String oldDescription = description; + description = newDescription; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, Orm2_0Package.ENTITY_LISTENER__DESCRIPTION, oldDescription, description)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case Orm2_0Package.ENTITY_LISTENER__DESCRIPTION: + return getDescription(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case Orm2_0Package.ENTITY_LISTENER__DESCRIPTION: + setDescription((String)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) + { + switch (featureID) + { + case Orm2_0Package.ENTITY_LISTENER__DESCRIPTION: + setDescription(DESCRIPTION_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case Orm2_0Package.ENTITY_LISTENER__DESCRIPTION: + return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() + { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (description: "); + result.append(description); + result.append(')'); + return result.toString(); + } + + // ********** translators ********** + + public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) { + return new SimpleTranslator( + elementName, + structuralFeature, + Orm2_0Package.eINSTANCE.getEntityListener(), + buildTranslatorChildren()); + } + + private static Translator[] buildTranslatorChildren() { + return new Translator[] { + buildDescriptionTranslator(), + buildClassTranslator(), + PrePersist.buildTranslator(), + PostPersist.buildTranslator(), + PreRemove.buildTranslator(), + PostRemove.buildTranslator(), + PreUpdate.buildTranslator(), + PostUpdate.buildTranslator(), + PostLoad.buildTranslator() + }; + } + + protected static Translator buildDescriptionTranslator() { + return new Translator(JPA.DESCRIPTION, Orm2_0Package.eINSTANCE.getEntityListener_Description()); + } + +} // EntityListener |