本文整理汇总了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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例6: edt
import org.eclipse.emf.ecore.EDataType; //导入方法依赖的package包/类
private EDataType edt(String n) {
EDataType d = EcoreFactory.eINSTANCE.createEDataType();
d.setName(n);
return d;
}
示例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;
}