当前位置: 首页>>代码示例>>Java>>正文


Java EPackage.getEClassifier方法代码示例

本文整理汇总了Java中org.eclipse.emf.ecore.EPackage.getEClassifier方法的典型用法代码示例。如果您正苦于以下问题:Java EPackage.getEClassifier方法的具体用法?Java EPackage.getEClassifier怎么用?Java EPackage.getEClassifier使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.emf.ecore.EPackage的用法示例。


在下文中一共展示了EPackage.getEClassifier方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getEClassifier

import org.eclipse.emf.ecore.EPackage; //导入方法依赖的package包/类
public EClassifier getEClassifier(String packageName, String classifierName) {
	if (packageName == null) {
		return null;
	}
	if (packageName.contains(".")) {
		packageName = packageName.substring(packageName.lastIndexOf(".") + 1);
	}
	EPackage ePackage = server.getMetaDataManager().getPackageMetaData(packageName).getEPackage();
	if (ePackage == null) {
		return null;
	}
	if (ePackage.getEClassifier(classifierName) != null) {
		return ePackage.getEClassifier(classifierName);
	}
	throw null;
}
 
开发者ID:shenan4321,项目名称:BIMplatform,代码行数:17,代码来源:CatalogServiceImpl.java

示例2: getMappedType

import org.eclipse.emf.ecore.EPackage; //导入方法依赖的package包/类
/**
 * Get the EMF data type associated to an OCCI data type.
 * 
 * @param type
 *            the given OCCI data type.
 * @return the EMF data type.
 */
private EClassifier getMappedType(DataType type) {
	EClassifier res = null;
	if (type == null) {
		res = EcorePackage.eINSTANCE.getEString();
	} else {
		// retrieve from currently converted data types
		res = occiType2emfType.get(type);
		if (res == null) {
			// retrieve from installed extensions.
			EPackage p = ConverterUtils.getEPackage(type);
			res = p.getEClassifier(type.getName());
			// Cache it for optimizing next searches.
			occiType2emfType.put(type, res);
		}
	}
	return res;
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:25,代码来源:OCCIExtension2Ecore.java

示例3: getJavaTypeName

import org.eclipse.emf.ecore.EPackage; //导入方法依赖的package包/类
/**
 * Get the Java type of an OCCI attribute.
 */
public String getJavaTypeName(Attribute attribute)
{
	// Get the data type of this attribute.
	DataType attributeType = (DataType) attribute.getType();
	//System.out.println("attributeType "+attributeType);
	// Get the extension containing this attribute type.
	Extension extension = (Extension)(attributeType.eContainer());
	//System.out.println("extension "+extension);
	// Get the Epackage for this extension.
	EPackage ePackage = getEPackage(extension);
	//System.out.println("ePackage "+ePackage);
	// Get the data type.
	EDataType eDataType = (EDataType)ePackage.getEClassifier(attributeType.getName());
	// Return the instance class name of this data type.
	return eDataType.getName();
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:20,代码来源:GenUtils.java

示例4: createEntity

import org.eclipse.emf.ecore.EPackage; //导入方法依赖的package包/类
/**
 * Create an entity of a given kind.
 * 
 * @param kind
 *            The kind of the entity to create.
 * @return The created entity, else null.
 */
public static Entity createEntity(Kind kind) {
	Entity createdEntity = null;

	// Get the name space of the Ecore package for this kind.
	String epackageNS = Occi2Ecore.convertOcciScheme2EcoreNamespace(kind.getScheme());
	// Get the Ecore package associated to the kind.
	EPackage epackage = EPackage.Registry.INSTANCE.getEPackage(epackageNS);
	if (epackage == null) {
		LOGGER.warn("EPackage " + epackageNS + " not found!");
	} else {
		String classname = Occi2Ecore.convertOcciCategoryTerm2EcoreClassName(kind.getTerm());
		// Get the Ecore class associated to the kind.
		EClass eclass = (EClass) epackage.getEClassifier(classname);
		if (eclass == null) {
			LOGGER.warn("EClass " + classname + " not found!");
		} else {
			// Get the Ecore factory associated to the kind.
			EFactory efactory = EPackage.Registry.INSTANCE.getEFactory(epackageNS);
			if (efactory == null) {
				LOGGER.warn("EFactory " + epackageNS + " not found!");
			} else {
				// Create the EObject for this kind.
				createdEntity = (Entity) efactory.create(eclass);
			}
		}
	}
	if (createdEntity == null) {
		LOGGER.warn("Create OCCI Core Resource!");
		createdEntity = OCCIFactory.eINSTANCE.createResource();
		createdEntity.setKind(kind);
	}

	LOGGER.debug("created entity=" + createdEntity);
	// Return the new entity.
	return createdEntity;
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:44,代码来源:OcciHelper.java

示例5: getEClass

import org.eclipse.emf.ecore.EPackage; //导入方法依赖的package包/类
public EClass getEClass(Type type) {
	Extension extension = (Extension) type.eContainer();
	EPackage ePackage = getEPackage(extension);
	EClass eclass = (EClass) ePackage
			.getEClassifier(ConverterUtils.toU1Case(ConverterUtils.formatName(type.getTerm())));
	return eclass;
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:8,代码来源:GenUtils.java

示例6: addSuperTypeFromOCCI

import org.eclipse.emf.ecore.EPackage; //导入方法依赖的package包/类
private void addSuperTypeFromOCCI(EClass subClass, String esuperClassName) {
	Resource oCCIEcoreResource = createAndLoadOCCIEcoreResource("org.eclipse.cmf.occi.core/model/OCCI.ecore");
	// of course, in production code we would fail here if there were no
	// contents or they weren't of type EPackage.
	final EPackage oCCIEPackage = (EPackage) oCCIEcoreResource.getContents().get(0);
	final EClass eSuperClass = (EClass) oCCIEPackage.getEClassifier(esuperClassName);
	subClass.getESuperTypes().add(eSuperClass);
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:9,代码来源:OCCIExtension2Ecore.java

示例7: createMixinBase

import org.eclipse.emf.ecore.EPackage; //导入方法依赖的package包/类
/**
 * Create an entity of a given kind.
 * 
 * @param kind
 *            The kind of the entity to create.
 * @return The created entity, else null.
 */
public static MixinBase createMixinBase(Entity entity, Mixin mixin) {
	MixinBase createdMixinBase = null;

	// Get the name space of the Ecore package for this mixin.
	String epackageNS = null;
	// If the mixin is a new mixin tag (doesnt exist on extension so, the method
	// eContainer() will return a Configuration object.
	EPackage epackage = null;
	if (mixin.eContainer() instanceof Extension) {
		// Establish that this is an extension.
		epackageNS = Occi2Ecore.convertOcciScheme2EcoreNamespace(((Extension) mixin.eContainer()).getScheme());
		// Get the Ecore package associated to the mixin.
		epackage = EPackage.Registry.INSTANCE.getEPackage(epackageNS);
	}
	// String epackageNS =
	// Occi2Ecore.convertOcciScheme2EcoreNamespace(((Extension)mixin.eContainer()).getScheme());
	if (epackage == null) {
		LOGGER.warn("EPackage " + epackageNS + " not found ! and this is a mixin tag");
	} else {
		String classname = Occi2Ecore.convertOcciCategoryTerm2EcoreClassName(mixin.getTerm());
		// Get the Ecore class associated to the mixin.
		EClass eclass = (EClass) epackage.getEClassifier(classname);
		if (eclass == null) {
			LOGGER.warn("EClass " + classname + " not found!");
		} else {
			// Get the Ecore factory associated to the mixinbase.
			EFactory efactory = EPackage.Registry.INSTANCE.getEFactory(epackageNS);
			if (efactory == null) {
				LOGGER.warn("EFactory " + epackageNS + " not found!");
			} else {
				// Create the EObject for this kind.
				createdMixinBase = (MixinBase) efactory.create(eclass);
			}
		}
	}
	if (createdMixinBase == null) {
		LOGGER.warn("Couldnt create mixin base for mixin : " + mixin.getScheme() + mixin.getTerm());
		createdMixinBase = OCCIFactory.eINSTANCE.createMixinBase();
	}
	createdMixinBase.setMixin(mixin);
	createdMixinBase.setEntity(entity);
	entity.getParts().add(createdMixinBase);

	LOGGER.debug("created MixinBase=" + createdMixinBase);
	// Return the new entity.
	return createdMixinBase;
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:55,代码来源:OcciHelper.java


注:本文中的org.eclipse.emf.ecore.EPackage.getEClassifier方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。