blob: 10076999ce8aaced3f48e970b4e1f26ac1220f61 (
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
/*******************************************************************************
* Copyright (c) 2006, 2013 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0, which accompanies this distribution
* and is available at https://www.eclipse.org/legal/epl-2.0/.
*
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.context.orm;
import org.eclipse.emf.ecore.EFactory;
import org.eclipse.jpt.common.core.internal.resource.xml.EFactoryTools;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.orm.OrmEntity;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextModelFactory;
import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity;
import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping;
/**
* default ORM Entity provider
*/
public class OrmEntityDefinition
implements OrmTypeMappingDefinition
{
// singleton
private static final OrmEntityDefinition INSTANCE =
new OrmEntityDefinition();
/**
* Return the singleton
*/
public static OrmTypeMappingDefinition instance() {
return INSTANCE;
}
/**
* Enforce singleton usage
*/
private OrmEntityDefinition() {
super();
}
public String getKey() {
return MappingKeys.ENTITY_TYPE_MAPPING_KEY;
}
public XmlTypeMapping buildResourceMapping(EFactory factory) {
return EFactoryTools.create(
factory,
OrmPackage.eINSTANCE.getXmlEntity(),
XmlEntity.class);
}
public OrmEntity buildContextMapping(
OrmPersistentType parent,
XmlTypeMapping resourceMapping,
OrmXmlContextModelFactory factory) {
return factory.buildOrmEntity(parent, (XmlEntity) resourceMapping);
}
}
|