diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/EnumeratedTypeElementTranslator.java')
-rw-r--r-- | jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/EnumeratedTypeElementTranslator.java | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/EnumeratedTypeElementTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/EnumeratedTypeElementTranslator.java deleted file mode 100644 index c926b883d7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/EnumeratedTypeElementTranslator.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 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.internal.content.orm.resource; - -import java.util.Collections; -import java.util.List; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jpt.core.internal.mappings.EnumType; - -/** - * There is a bug in the translator framework that causes - * enumerators in xml elements and enumerators in xml attributes - * to be treated differently. When the enumerator is an attribute - * setting the model to the default causes the attribute to be removed. - * With an element is causes the default literal to be placed in - * the tag. - * - * The problem is wrapped up in the emf unsettable attribute as well. - * For attributes the eIsSet method returns false for the default value - * For elements the eIsSet method returns true for the default value. - * I don't want to have to use the unsettable option in emf since that would - * require that I call different api. I am not sure yet what the bug is in - * the translator, so I have entered one ~KFM - */ -public class EnumeratedTypeElementTranslator extends EnumeratorTranslator -{ - - public EnumeratedTypeElementTranslator(String domNameAndPath, EStructuralFeature aFeature, int style) { - super(domNameAndPath, aFeature, style); - } - - @Override - public Object getMOFValue(EObject mofObject) { - EnumType type = (EnumType) super.getMOFValue(mofObject); - if (type == EnumType.DEFAULT) { - return null; - } - return type; - } - - @Override - public List getMOFChildren(EObject mofObject) { - List result = super.getMOFChildren(mofObject); - if(result != null && result.size() > 0) { - EnumType type = (EnumType) result.get(0); - if(type.getValue() == EnumType.DEFAULT_VALUE) - result = Collections.EMPTY_LIST; - } - return result; - } -} |