Skip to main content
summaryrefslogtreecommitdiffstats
blob: 0ad1f089824e3c82c3971288604bd25b2c134087 (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
/*******************************************************************************
 *  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 org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
import org.eclipse.wst.common.internal.emf.resource.Translator;

public abstract class GeneratorTranslator extends Translator implements OrmXmlMapper
{
	protected static final JpaCoreMappingsPackage MAPPINGS_PKG = 
		JpaCoreMappingsPackage.eINSTANCE;
	protected static final OrmPackage JPA_CORE_XML_PKG = 
		OrmPackage.eINSTANCE;
	
	
	private Translator[] children;	
	
	public GeneratorTranslator(String domNameAndPath, EStructuralFeature aFeature, int style) {
		super(domNameAndPath, aFeature, style);
	}
	
	public Translator[] getChildren(Object target, int versionID) {
		if (children == null) {
			children = createChildren();
		}
		return children;
	}
		
	protected abstract Translator[] createChildren();


	protected Translator createNameTranslator() {
		return new Translator(GENERATOR__NAME, MAPPINGS_PKG.getIGenerator_Name(), DOM_ATTRIBUTE);
	}
	
	protected Translator createInitialValueTranslator() {
		return new Translator(GENERATOR__INITIAL_VALUE, MAPPINGS_PKG.getIGenerator_SpecifiedInitialValue(), DOM_ATTRIBUTE);
	}
	
	protected Translator createAllocationSizeTranslator() {
		return new Translator(GENERATOR__ALLOCATION_SIZE, MAPPINGS_PKG.getIGenerator_SpecifiedAllocationSize(), DOM_ATTRIBUTE);
	}

}

Back to the top