blob: d6f9434d55418fb6bb7294d66fcd387b5057802f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
/**
* Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others.
* 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:
* Simon McDuff - initial API and implementation
* Ibrahim Sallam - code refactoring for CDO 3.0
*/
package org.eclipse.emf.cdo.server.internal.objectivity.mapper;
import org.eclipse.emf.cdo.server.internal.objectivity.db.ObjyObject;
import org.eclipse.emf.ecore.EStructuralFeature;
/**
* @author Simon McDuff
*/
public class EnumTypeMapper extends NumericTypeMapper.TMInteger
{
static EnumTypeMapper INSTANCE = new EnumTypeMapper();
@Override
public Object getValue(ObjyObject objyObject, EStructuralFeature feature)
{
// Integer intValue = (Integer) super.getValue(objyObject, feature);
// /*
// EEnum enumType = (EEnum)feature.getEType();
// EEnumLiteral literal = enumType.getEEnumLiteral(intValue);
// if (literal == null)
// {
// throw new IllegalStateException();
// }
// return literal.getInstance();
// */
// return intValue;
return super.getValue(objyObject, feature);
}
@Override
public void setValue(ObjyObject objyObject, EStructuralFeature feature, Object newValue)
{
Integer enumLiteral = (Integer)newValue;
if (enumLiteral == null)
{
return;
}
super.setValue(objyObject, feature, enumLiteral);
// Numeric_Value numericValue = new Numeric_Value(enumLiteral.intValue());
}
}
|