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


Java BasicExtendedMetaData类代码示例

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


BasicExtendedMetaData类属于org.eclipse.emf.ecore.util包,在下文中一共展示了BasicExtendedMetaData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: lazyMetamodelRegistration

import org.eclipse.emf.ecore.util.BasicExtendedMetaData; //导入依赖的package包/类
private String lazyMetamodelRegistration(String metamodelPath){
	
	Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
  	
    ResourceSet rs = new ResourceSetImpl();
    // Enables extended meta-data, weird we have to do this but well...
    final ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(EPackage.Registry.INSTANCE);
    rs.getLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData);

    Resource r = rs.getResource(URI.createFileURI(metamodelPath), true);
    EObject eObject = r.getContents().get(0);
    // A meta-model might have multiple packages we assume the main package is the first one listed
    if (eObject instanceof EPackage) {
        EPackage p = (EPackage)eObject;
        System.out.println(p.getNsURI());
        EPackage.Registry.INSTANCE.put(p.getNsURI(), p);
        return p.getNsURI();
    }
    return null;
}
 
开发者ID:guana,项目名称:ATLauncher,代码行数:21,代码来源:ATLLauncher.java

示例2: getJavaObjectFromTrimmed

import org.eclipse.emf.ecore.util.BasicExtendedMetaData; //导入依赖的package包/类
/**
 * @throws ParseException
 */
@Override
protected Object getJavaObjectFromTrimmed(String string, Object defaultObject) throws ParseException {
	try {
		if (eDataType.getInstanceClassName() != null 
				&& eDataType.getInstanceClassName().equalsIgnoreCase(BigDecimal.class.getName())) {
			double value = Double.parseDouble(string);
			BasicExtendedMetaData bemd = new BasicExtendedMetaData();
			int factionDigits = bemd.getFractionDigitsFacet(eDataType);
			String minInclusiveString = bemd.getMinInclusiveFacet(eDataType);
			if (minInclusiveString != null) {
				int minInclusive = Integer.parseInt(minInclusiveString);
				if (value < minInclusive) {
					value = 360 - Math.abs(value); // See SPF-9712
				}
			}
			return eFactoryInstance.createFromString(eDataType, String.format("%." + factionDigits + "f", value));
		}
		return eFactoryInstance.createFromString(eDataType, string);
	} catch (Exception e) {
		if (e instanceof ParseException) {
			throw (ParseException) e;
		}
		throw new ParseException(e.getMessage(), 0);
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:29,代码来源:EDataTypeStringifier.java

示例3: registerEPackageFromEcore

import org.eclipse.emf.ecore.util.BasicExtendedMetaData; //导入依赖的package包/类
/**
 * Registers a EPackage in {@link Registry} according to its {@code prefix} and {@code uri}, from an Ecore file.
 * <p>
 * The targeted Ecore file must be present in {@code /resources/ecore}.
 */
protected static void registerEPackageFromEcore(String prefix, String uri) {
    File file = getResourceFile(ECORE_PATH.replaceAll("\\{name\\}", prefix));

    EPackage ePackage = null;

    Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(ECORE, new EcoreResourceFactoryImpl());

    ResourceSet rs = new ResourceSetImpl();

    final ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(rs.getPackageRegistry());
    rs.getLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData);

    Resource r = rs.getResource(URI.createFileURI(file.toString()), true);
    EObject eObject = r.getContents().get(0);
    if (eObject instanceof EPackage) {
        ePackage = (EPackage) eObject;
        rs.getPackageRegistry().put(ePackage.getNsURI(), ePackage);
    }

    assertThat(ePackage).isNotNull(); // "EPackage does not exist"

    Registry.INSTANCE.put(uri, ePackage);
}
 
开发者ID:atlanmod,项目名称:NeoEMF,代码行数:29,代码来源:AbstractInputTest.java

示例4: persistenceResourceFactoryImpl

import org.eclipse.emf.ecore.util.BasicExtendedMetaData; //导入依赖的package包/类
/**
 * Creates an instance of the resource factory. <!-- begin-user-doc --> <!-- end-user-doc -->
 * 
 * @generated
 */
public persistenceResourceFactoryImpl() {
  super();
  extendedMetaData =
      new BasicExtendedMetaData(new EPackageRegistryImpl(EPackage.Registry.INSTANCE));
  extendedMetaData.putPackage(null, persistencePackage.eINSTANCE);
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:12,代码来源:persistenceResourceFactoryImpl.java

示例5: ModelLoader

import org.eclipse.emf.ecore.util.BasicExtendedMetaData; //导入依赖的package包/类
public ModelLoader()
{
	resourceSet = new ResourceSetImpl();
	final ExtendedMetaData extendedMetaData = 
		new BasicExtendedMetaData(resourceSet.getPackageRegistry());
	resourceSet.getLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA,
	    extendedMetaData);
}
 
开发者ID:catedrasaes-umu,项目名称:NoSQLDataEngineering,代码行数:9,代码来源:ModelLoader.java

示例6: init

import org.eclipse.emf.ecore.util.BasicExtendedMetaData; //导入依赖的package包/类
public static void init(ResourceSet resourceSet, String path) {
	Resource_Set = resourceSet;
	Extended_Meta_Data = new BasicExtendedMetaData(resourceSet.getPackageRegistry());
	Package_Map = new HashMap<String, EPackage>();
	Text_Attribute = (EAttribute) XMLTypeFactory.eINSTANCE.createXMLTypeDocumentRoot().eClass().getEStructuralFeature("text");
	Path = path;
}
 
开发者ID:alexander-bergmayr,项目名称:caml2tosca,代码行数:8,代码来源:ToscaUtil.java

示例7: readEcore

import org.eclipse.emf.ecore.util.BasicExtendedMetaData; //导入依赖的package包/类
public static EPackage readEcore (String ecorePath)
{	
	ResourceSet ecoreResourceSet = new ResourceSetImpl();		
	URI ecoreURI = URI.createFileURI(ecorePath);		
	Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
	ecoreResourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
	ecoreResourceSet.getPackageRegistry().put(EcorePackage.eNS_URI, EcorePackage.eINSTANCE);				
	final ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(ecoreResourceSet.getPackageRegistry());
	ecoreResourceSet.getLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA,  extendedMetaData);		
    Resource ecoreResource = ecoreResourceSet.getResource(ecoreURI,true);
    EPackage ecoremodel = (EPackage) ecoreResource.getContents().get(0);	    
    ecoreResource.getResourceSet().getPackageRegistry().put(ecoremodel.getNsURI(),ecoremodel);
    EPackage.Registry.INSTANCE.put(ecoremodel.getNsURI(), ecoremodel);	    
    return ecoremodel;
}
 
开发者ID:MenthorTools,项目名称:menthor-xcore,代码行数:16,代码来源:OntoumlResource.java

示例8: loadSimulinkModel

import org.eclipse.emf.ecore.util.BasicExtendedMetaData; //导入依赖的package包/类
/**
 * Loads the EMF representation of a Simulink model.
 * 
 * @param fileNameWithoutExtension
 *            the file to load specified by its name
 * @return the loaded SimulinkModel root EMF model object
 * @throws SimulinkApiException
 */
public SimulinkModel loadSimulinkModel(String fileNameWithoutExtension) throws SimulinkApiException {

    // Register a resource factory for the extension "simulink"
    Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
    Map<String, Object> m = reg.getExtensionToFactoryMap();
    m.put("simulink", new XMIResourceFactoryImpl());

    // Obtain a new resource set
    ResourceSet rs = new ResourceSetImpl();
    final ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(rs.getPackageRegistry());
    rs.getLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData);

    // The model will be saved to the root of the project for now under the
    // given name.
    // TODO save path may come from an extension or properties file
    String path = fileNameWithoutExtension + ".simulink";

    // Load the resource
    Resource loadResource = rs.getResource(URI.createURI(path), true);
    Object resourceContent = loadResource.getContents().get(0);

    // Make a log entry if the root object isn't a SimulinkModel
    if (!(resourceContent instanceof SimulinkModel))
        logger.error("The given resource contained no SimulinkModel as a root element!");

    // Return the root EMF model object
    // Also throws an exception when invalid cast occurs
    return (SimulinkModel) resourceContent;
}
 
开发者ID:viatra,项目名称:massif,代码行数:38,代码来源:Exporter.java

示例9: setup

import org.eclipse.emf.ecore.util.BasicExtendedMetaData; //导入依赖的package包/类
@Before
public void setup() {
  // We need the TOGAF model for some of the tests, but the plugin has no update site.
  // Instead, we use the Ecore file in resources/metamodels.  However, while EMFViews works
  // with the Ecore file, the code in EclDelegate assumes that metamodels are registered in
  // the EMF package registry.
  //
  // To work around this issue, we load the EPackage from the Ecore file into the package registry.
  //
  // See: https://stackoverflow.com/a/9389901

  Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap()
      .put("ecore", new EcoreResourceFactoryImpl());

  ResourceSet rs = new ResourceSetImpl();
  // enable extended metadata
  final ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(rs.getPackageRegistry());
  rs.getLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData);

  Resource r = rs.getResource(resourceURI("metamodels/contentfwk.ecore"), true);
  EObject eObject = r.getContents().get(0);
  if (eObject instanceof EPackage) {
    EPackage p = (EPackage) eObject;
    EPackage.Registry.INSTANCE.put(p.getNsURI(), p);
  } else {
    throw new IllegalStateException("Error loading TOGAF metamodel for testing");
  }
}
 
开发者ID:atlanmod,项目名称:emfviews,代码行数:29,代码来源:TestEMFViews.java

示例10: getExtendedMetaData

import org.eclipse.emf.ecore.util.BasicExtendedMetaData; //导入依赖的package包/类
public BasicExtendedMetaData.EPackageExtendedMetaData getExtendedMetaData()
{
  return ePackageExtendedMetaData;
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:5,代码来源:EPackageImpl.java

示例11: setExtendedMetaData

import org.eclipse.emf.ecore.util.BasicExtendedMetaData; //导入依赖的package包/类
public void setExtendedMetaData(BasicExtendedMetaData.EPackageExtendedMetaData ePackageExtendedMetaData)
{
  this.ePackageExtendedMetaData = ePackageExtendedMetaData;
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:5,代码来源:EPackageImpl.java

示例12: getExtendedMetaData

import org.eclipse.emf.ecore.util.BasicExtendedMetaData; //导入依赖的package包/类
public BasicExtendedMetaData.EClassifierExtendedMetaData getExtendedMetaData()
{
  return eClassifierExtendedMetaData;
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:5,代码来源:EClassifierImpl.java

示例13: setExtendedMetaData

import org.eclipse.emf.ecore.util.BasicExtendedMetaData; //导入依赖的package包/类
public void setExtendedMetaData(BasicExtendedMetaData.EClassifierExtendedMetaData eClassifierExtendedMetaData)
{
  this.eClassifierExtendedMetaData = eClassifierExtendedMetaData;
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:5,代码来源:EClassifierImpl.java

示例14: getExtendedMetaData

import org.eclipse.emf.ecore.util.BasicExtendedMetaData; //导入依赖的package包/类
public BasicExtendedMetaData.EStructuralFeatureExtendedMetaData getExtendedMetaData()
{
  return eStructuralFeatureExtendedMetaData;
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:5,代码来源:EStructuralFeatureImpl.java

示例15: setExtendedMetaData

import org.eclipse.emf.ecore.util.BasicExtendedMetaData; //导入依赖的package包/类
public void setExtendedMetaData(BasicExtendedMetaData.EStructuralFeatureExtendedMetaData eStructuralFeatureExtendedMetaData)
{
  this.eStructuralFeatureExtendedMetaData = eStructuralFeatureExtendedMetaData;
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:5,代码来源:EStructuralFeatureImpl.java


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