當前位置: 首頁>>代碼示例>>Java>>正文


Java EDataType.setName方法代碼示例

本文整理匯總了Java中org.eclipse.emf.ecore.EDataType.setName方法的典型用法代碼示例。如果您正苦於以下問題:Java EDataType.setName方法的具體用法?Java EDataType.setName怎麽用?Java EDataType.setName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.emf.ecore.EDataType的用法示例。


在下文中一共展示了EDataType.setName方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createStringType

import org.eclipse.emf.ecore.EDataType; //導入方法依賴的package包/類
private EDataType createStringType(StringType type) {
	EDataType edatatype = EcoreFactory.eINSTANCE.createEDataType();
	edatatype.setName(type.getName());
	edatatype.setInstanceTypeName("java.lang.String");
	if (type.getDocumentation() != null) {
		attachInfo(edatatype, type.getDocumentation());
	}
	if (type.isSetLength() || type.isSetMaxLength() || type.isSetMinLength() || type.getPattern() != null) {
		EAnnotation eannotation = EcoreFactory.eINSTANCE.createEAnnotation();
		edatatype.getEAnnotations().add(eannotation);
		eannotation.setSource("http:///org/eclipse/emf/ecore/util/ExtendedMetaData");
		if (type.isSetLength())
			eannotation.getDetails().put("length", Integer.toString(type.getLength()));
		if (type.isSetMaxLength())
			eannotation.getDetails().put("maxLength", Integer.toString(type.getMaxLength()));
		if (type.isSetMinLength())
			eannotation.getDetails().put("minLength", Integer.toString(type.getMinLength()));
		if (type.getPattern() != null) {
			if (type.getPattern() != "")
				eannotation.getDetails().put("pattern", type.getPattern());
		}
	}
	return edatatype;
}
 
開發者ID:occiware,項目名稱:OCCI-Studio,代碼行數:25,代碼來源:OCCIExtension2Ecore.java

示例2: interpret

import org.eclipse.emf.ecore.EDataType; //導入方法依賴的package包/類
public static EObject interpret(String groovyScript) {
		EDataType data =  EcorePackage.eINSTANCE.getEString();				
		Binding binding = new Binding();

		//Binding setVariable allow to pass a variable from the moonti arc model to the groovy interpreter
		//binding.setVariable(name, value);
		
		 GroovyShell shell = new GroovyShell(binding);		    
		    Object result = shell.evaluate(groovyScript);
		    
		    //Binding.getVariable get the new value of this variable. 
//		    binding.getVariable(name)

		    
		    //		data.setName(""+(rand.nextInt(100)+1));
		data.setName(""+result);
		return data;
	}
 
開發者ID:awortmann,項目名稱:xmontiarc,代碼行數:19,代碼來源:GroovyInterpreter.java

示例3: visit

import org.eclipse.emf.ecore.EDataType; //導入方法依賴的package包/類
@Override
public void visit(DataType t, String param) {
    if (hasElement(t)) {
        return;
    }

    if (t instanceof StringType) {
        setElement(t, g_EcorePackage.getEString());
    } else if (t instanceof BoolType) {
        setElement(t, g_EcorePackage.getEBoolean());
    } else if (t instanceof IntType) {
        setElement(t, g_EcorePackage.getEInt());
    } else if (t instanceof RealType) {
        setElement(t, g_EcorePackage.getEFloat());
    } else if (t instanceof CustomDataType) {
        EDataType eDataType = g_EcoreFactory.createEDataType();
        setElement(t, eDataType);

        CustomDataType cmDataType = (CustomDataType) t;
        eDataType.setName(cmDataType.getId()
            .getName()
            .toString());
        // Forcing to the string class, as it always has a string representation.
        // This is a limitation of the conceptual model (doesn't store other type information)
        eDataType.setInstanceClass(String.class);
        EPackage typePackage = packageFromId(cmDataType.getId()
            .getNamespace());
        typePackage.getEClassifiers()
            .add(eDataType);
    }
}
 
開發者ID:meteoorkip,項目名稱:JavaGraph,代碼行數:32,代碼來源:TypeToEcore.java

示例4: createEObjectType

import org.eclipse.emf.ecore.EDataType; //導入方法依賴的package包/類
private EDataType createEObjectType(EObjectType type) {
	EDataType edatatype = EcoreFactory.eINSTANCE.createEDataType();
	edatatype.setName(type.getName());
	edatatype.setInstanceTypeName(type.getInstanceClassName());
	if (type.getDocumentation() != null) {
		attachInfo(edatatype, type.getDocumentation());
	}
	return edatatype;
}
 
開發者ID:occiware,項目名稱:OCCI-Studio,代碼行數:10,代碼來源:OCCIExtension2Ecore.java

示例5: createBooleanType

import org.eclipse.emf.ecore.EDataType; //導入方法依賴的package包/類
private EDataType createBooleanType(BooleanType type) {
	EDataType edatatype = EcoreFactory.eINSTANCE.createEDataType();
	edatatype.setName(type.getName());
	edatatype.setInstanceTypeName("java.lang.Boolean");
	if (type.getDocumentation() != null) {
		attachInfo(edatatype, type.getDocumentation());
	}
	return edatatype;
}
 
開發者ID:occiware,項目名稱:OCCI-Studio,代碼行數:10,代碼來源:OCCIExtension2Ecore.java

示例6: edt

import org.eclipse.emf.ecore.EDataType; //導入方法依賴的package包/類
private EDataType edt(String n) {
	EDataType d = EcoreFactory.eINSTANCE.createEDataType();
	d.setName(n);
	return d;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:6,代碼來源:EcoreUtilN4Test.java

示例7: createNumericType

import org.eclipse.emf.ecore.EDataType; //導入方法依賴的package包/類
private EDataType createNumericType(NumericType type) {
	EDataType edatatype = EcoreFactory.eINSTANCE.createEDataType();
	edatatype.setName(type.getName());
	switch (type.getType()) {
	case BYTE:
		edatatype.setInstanceTypeName("java.lang.Byte");
		break;
	case DOUBLE:
		edatatype.setInstanceTypeName("java.lang.Double");
		break;
	case FLOAT:
		edatatype.setInstanceTypeName("java.lang.Float");
		break;
	case INTEGER:
		edatatype.setInstanceTypeName("java.lang.Integer");
		break;
	case LONG:
		edatatype.setInstanceTypeName("java.lang.Long");
		break;
	case SHORT:
		edatatype.setInstanceTypeName("java.lang.Short");
		break;
	case BIG_DECIMAL:
		edatatype.setInstanceTypeName("java.math.BigDecimal");
		break;
	default:
		break;
	}
	if (type.isSetTotalDigits() || type.isSetMinInclusive() || type.isSetMinExclusive() || type.isSetMaxInclusive()
			|| type.isSetMaxExclusive()) {
		EAnnotation eannotation = EcoreFactory.eINSTANCE.createEAnnotation();
		edatatype.getEAnnotations().add(eannotation);
		eannotation.setSource("http:///org/eclipse/emf/ecore/util/ExtendedMetaData");
		if (type.isSetTotalDigits())
			eannotation.getDetails().put("totalDigits", Integer.toString(type.getTotalDigits()));
		if (type.isSetMinInclusive())
			eannotation.getDetails().put("MinInclusive", type.getMinInclusive());
		if (type.isSetMinExclusive())
			eannotation.getDetails().put("MinExclusive", type.getMinExclusive());
		if (type.isSetMaxInclusive())
			eannotation.getDetails().put("MaxInclusive", type.getMaxInclusive());
		if (type.isSetMaxExclusive())
			eannotation.getDetails().put("MaxExclusive", type.getMaxExclusive());
	}
	if (type.getDocumentation() != null) {
		attachInfo(edatatype, type.getDocumentation());
	}
	return edatatype;
}
 
開發者ID:occiware,項目名稱:OCCI-Studio,代碼行數:50,代碼來源:OCCIExtension2Ecore.java


注:本文中的org.eclipse.emf.ecore.EDataType.setName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。