本文整理汇总了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;
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}