org.eclipse.vorto.core.api.model.datatype.Enum类的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(12.4k)|赞(0)|评价(0)|浏览(166)

本文整理了Java中org.eclipse.vorto.core.api.model.datatype.Enum类的一些代码示例,展示了Enum类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Enum类的具体详情如下:
包路径:org.eclipse.vorto.core.api.model.datatype.Enum
类名称:Enum

Enum介绍

[英]A representation of the model object 'Enum'.

The following features are supported:

  • org.eclipse.vorto.core.api.model.datatype.Enum#getEnums
    [中]模型对象“Enum”的表示形式。
    支持以下功能:
    *组织。日食沃托。果心应用程序编程接口。模型数据类型。枚举#获取枚举

代码示例

代码示例来源:origin: org.eclipse.vorto/org.eclipse.vorto.codegen.examples.aws

@Override
public String getFileName(final org.eclipse.vorto.core.api.model.datatype.Enum context) {
 String _name = context.getName();
 return (_name + "_CustomSlotType.txt");
}

代码示例来源:origin: org.eclipse.vorto/org.eclipse.vorto.editor.mapping

public IScope scope_EnumPropertySource_property(final EnumPropertySource exp, final EReference ref) {
 org.eclipse.vorto.core.api.model.datatype.Enum _model = exp.getModel();
 org.eclipse.vorto.core.api.model.datatype.Enum enumType = ((org.eclipse.vorto.core.api.model.datatype.Enum) _model);
 EList<EnumLiteral> _enums = enumType.getEnums();
 return Scopes.scopeFor(_enums);
}

代码示例来源:origin: org.eclipse.vorto/org.eclipse.vorto.codegen.arduino

public String getFirstValueEnum(final FunctionBlock fb, final PropertyType type) {
 EList<org.eclipse.vorto.core.api.model.datatype.Enum> _referencedEnums = Utils.getReferencedEnums(fb);
 for (final org.eclipse.vorto.core.api.model.datatype.Enum enum_ : _referencedEnums) {
  boolean _and = false;
  String _displayname = enum_.getDisplayname();
  Type _type = ((ObjectPropertyType) type).getType();
  String _name = _type.getName();
  boolean _equals = _displayname.equals(_name);
  if (!_equals) {
   _and = false;
  } else {
   String _namespace = enum_.getNamespace();
   Type _type_1 = ((ObjectPropertyType) type).getType();
   String _namespace_1 = _type_1.getNamespace();
   boolean _equals_1 = _namespace.equals(_namespace_1);
   _and = _equals_1;
  }
  if (_and) {
   EList<EnumLiteral> _enums = enum_.getEnums();
   EnumLiteral _get = _enums.get(0);
   return _get.getName();
  }
 }
 return "";
}

代码示例来源:origin: org.eclipse.vorto/org.eclipse.vorto.codegen.latex

StringConcatenation _builder = new StringConcatenation();
_builder.append("## Enum *");
String _name = en.getName();
_builder.append(_name, "");
_builder.append("*");
_builder.append("\t");
_builder.append("<tr><td>Name:</td><td>");
String _name_1 = en.getName();
_builder.append(_name_1, "\t");
_builder.append("</td></tr>");
_builder.append("\t");
_builder.append("<tr><td>Namespace:</td><td>");
String _namespace = en.getNamespace();
_builder.append(_namespace, "\t");
_builder.append("</td></tr>");
_builder.append("\t");
_builder.append("<tr><td>Version:</td><td>");
String _version = en.getVersion();
_builder.append(_version, "\t");
_builder.append("</td></tr>");
_builder.append("### Description");
_builder.newLine();
String _description = en.getDescription();
_builder.append(_description, "");
_builder.newLineIfNotEmpty();

代码示例来源:origin: org.eclipse.vorto/org.eclipse.vorto.codegen.examples.ios

@Override
 public String getContent(final org.eclipse.vorto.core.api.model.datatype.Enum context, final InvocationContext invocationContext) {
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("//Generated by Vorto");
  _builder.newLine();
  _builder.newLine();
  _builder.append("import Foundation");
  _builder.newLine();
  _builder.newLine();
  _builder.append("enum ");
  String _name = context.getName();
  _builder.append(_name, "");
  _builder.append(" {");
  _builder.newLineIfNotEmpty();
  _builder.newLine();
  {
   EList<EnumLiteral> _enums = context.getEnums();
   for(final EnumLiteral literal : _enums) {
    _builder.append("\t");
    _builder.append("case ");
    String _name_1 = literal.getName();
    _builder.append(_name_1, "\t");
    _builder.newLineIfNotEmpty();
   }
  }
  _builder.append("}");
  _builder.newLine();
  return _builder.toString();
 }
}

代码示例来源:origin: org.eclipse.vorto/org.eclipse.vorto.codegen.arduino

StringConcatenation _builder = new StringConcatenation();
_builder.append("// ");
String _name = dataEnum.getName();
_builder.append(_name, "");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("#ifndef __ENUM_");
String _name_1 = dataEnum.getName();
String _upperCase = _name_1.toUpperCase();
_builder.append(_upperCase, "");
_builder.newLineIfNotEmpty();
_builder.append("#define __ENUM_");
String _name_2 = dataEnum.getName();
String _upperCase_1 = _name_2.toUpperCase();
_builder.append(_upperCase_1, "");
_builder.newLine();
_builder.append("namespace ");
String _namespace = dataEnum.getNamespace();
String _replace = _namespace.replace(".", "_");
_builder.append(_replace, "");
_builder.append("    ");
_builder.append("enum ");
String _name_3 = dataEnum.getName();
_builder.append(_name_3, "    ");
_builder.append(" {");
_builder.newLineIfNotEmpty();

代码示例来源:origin: org.eclipse.vorto/org.eclipse.vorto.codegen.examples.prosystfi

private void generateForEnum(InformationModel infomodel, InvocationContext ctx, Enum en,
    IGeneratedWriter outputter) {
  ChainedCodeGeneratorTask<Enum> generator = new ChainedCodeGeneratorTask<Enum>();
  generator.addTask(new JavaEnumGeneratorTask(JAVA_FILE_EXTENSION, SOURCE, en.getNamespace()));
  generator.generate(en, ctx, outputter);
}

代码示例来源:origin: org.eclipse.vorto/org.eclipse.vorto.codegen.arduino

for (final org.eclipse.vorto.core.api.model.datatype.Enum enum_ : _referencedEnums_1) {
 boolean _and_1 = false;
 String _displayname = enum_.getDisplayname();
 Type _type = ((ObjectPropertyType) type).getType();
 String _name = _type.getName();
  _and_1 = false;
 } else {
  String _namespace = enum_.getNamespace();
  Type _type_1 = ((ObjectPropertyType) type).getType();
  String _namespace_1 = _type_1.getNamespace();

代码示例来源:origin: org.eclipse.vorto/org.eclipse.vorto.codegen.templates.java

_builder.newLine();
_builder.append("* Name:\t\t\t");
String _name = en.getName();
_builder.append(_name, "");
_builder.newLineIfNotEmpty();
_builder.append("* Namespace:\t");
String _namespace = en.getNamespace();
_builder.append(_namespace, "");
_builder.newLineIfNotEmpty();
_builder.append("* Version:\t\t");
String _version = en.getVersion();
_builder.append(_version, "");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("* ");
String _description = en.getDescription();
_builder.append(_description, "");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("public enum ");
String _name_1 = en.getName();
String _firstUpper = StringExtensions.toFirstUpper(_name_1);
_builder.append(_firstUpper, "");
 EList<EnumLiteral> _enums = en.getEnums();
 boolean _hasElements = false;
 for(final EnumLiteral literal : _enums) {

代码示例来源:origin: org.eclipse.vorto/org.eclipse.vorto.codegen.examples.prosystfi

_builder.append("private ");
 Type _type_8 = objectProperty.getType();
 String _name_9 = ((org.eclipse.vorto.core.api.model.datatype.Enum) _type_8).getName();
 _builder.append(_name_9, "\t");
 _builder.append(" ");
 _builder.append("private ");
 Type _type_17 = objectProperty_1.getType();
 String _name_15 = ((org.eclipse.vorto.core.api.model.datatype.Enum) _type_17).getName();
 _builder.append(_name_15, "\t");
 _builder.append(" ");
 _builder.append("private ");
 Type _type_26 = objectProperty_2.getType();
 String _name_21 = ((org.eclipse.vorto.core.api.model.datatype.Enum) _type_26).getName();
 _builder.append(_name_21, "\t");
 _builder.append(" ");
_builder.append("\t");
_builder.append("public ");
String _name_31 = ((org.eclipse.vorto.core.api.model.datatype.Enum) type).getName();
_builder.append(_name_31, "\t");
_builder.append(" ");
_builder.append("\t");
_builder.append("return ");
String _name_33 = ((org.eclipse.vorto.core.api.model.datatype.Enum) type).getName();
_builder.append(_name_33, "\t\t");
_builder.append(".");

代码示例来源:origin: org.eclipse.vorto/org.eclipse.vorto.codegen.examples.prosystfi

visited.add(en);
imports.add(en.getNamespace());
exports.add(en.getNamespace());

代码示例来源:origin: org.eclipse.vorto/org.eclipse.vorto.codegen.examples.coap

@Override
public String getFileName(Enum en) {
  return en.getName() + javaFileExtension;
}

代码示例来源:origin: org.eclipse.vorto/generator-templates-java

_builder.newLine();
_builder.append("* Name:\t\t\t");
String _name = en.getName();
_builder.append(_name, "");
_builder.newLineIfNotEmpty();
_builder.append("* Namespace:\t");
String _namespace = en.getNamespace();
_builder.append(_namespace, "");
_builder.newLineIfNotEmpty();
_builder.append("* Version:\t\t");
String _version = en.getVersion();
_builder.append(_version, "");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("* ");
String _description = en.getDescription();
_builder.append(_description, "");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("public enum ");
String _name_1 = en.getName();
String _firstUpper = StringExtensions.toFirstUpper(_name_1);
_builder.append(_firstUpper, "");
 EList<EnumLiteral> _enums = en.getEnums();
 boolean _hasElements = false;
 for(final EnumLiteral literal : _enums) {

代码示例来源:origin: org.eclipse.vorto/boschiotsuite-gateway

_builder.append("private ");
 Type _type_8 = objectProperty.getType();
 String _name_9 = ((org.eclipse.vorto.core.api.model.datatype.Enum) _type_8).getName();
 _builder.append(_name_9, "\t");
 _builder.append(" ");
 _builder.append("private ");
 Type _type_17 = objectProperty_1.getType();
 String _name_15 = ((org.eclipse.vorto.core.api.model.datatype.Enum) _type_17).getName();
 _builder.append(_name_15, "\t");
 _builder.append(" ");
 _builder.append("private ");
 Type _type_26 = objectProperty_2.getType();
 String _name_21 = ((org.eclipse.vorto.core.api.model.datatype.Enum) _type_26).getName();
 _builder.append(_name_21, "\t");
 _builder.append(" ");
_builder.append("\t");
_builder.append("public ");
String _name_31 = ((org.eclipse.vorto.core.api.model.datatype.Enum) type).getName();
_builder.append(_name_31, "\t");
_builder.append(" ");
_builder.append("\t");
_builder.append("return ");
String _name_33 = ((org.eclipse.vorto.core.api.model.datatype.Enum) type).getName();
_builder.append(_name_33, "\t\t");
_builder.append(".");

代码示例来源:origin: org.eclipse.vorto/org.eclipse.vorto.editor.datatype

@Check
public void checkDuplicatedLiteral(final org.eclipse.vorto.core.api.model.datatype.Enum enu) {
 EList<EnumLiteral> list = enu.getEnums();
 HashSet<String> set = new HashSet<String>();
 for (int i = 0; (i < ((Object[])Conversions.unwrapArray(list, Object.class)).length); i++) {
  EnumLiteral _get = list.get(i);
  String _name = _get.getName();
  boolean _add = set.add(_name);
  boolean _not = (!_add);
  if (_not) {
   EnumLiteral _get_1 = list.get(i);
   this.error(DatatypeSystemMessage.ERROR_DUPLICATED_ENUM_LITERAL, _get_1, 
    DatatypePackage.Literals.ENUM_LITERAL__NAME);
  }
 }
}

代码示例来源:origin: org.eclipse.vorto/boschiotsuite-gateway

private void generateForEnum(InvocationContext ctx, Enum en,
  IGeneratedWriter outputter) {
 ChainedCodeGeneratorTask<Enum> generator = new ChainedCodeGeneratorTask<Enum>();
 generator.addTask(new JavaEnumGeneratorTask(JAVA_FILE_EXTENSION, SOURCE, en.getNamespace()));
 generator.generate(en, ctx, outputter);
}

代码示例来源:origin: org.eclipse.vorto/org.eclipse.vorto.codegen.aws

@Override
public String getFileName(final org.eclipse.vorto.core.api.model.datatype.Enum context) {
 String _name = context.getName();
 return (_name + "_CustomSlotType.txt");
}

代码示例来源:origin: org.eclipse.vorto/org.eclipse.vorto.codegen.aws

@Override
 public String getContent(final org.eclipse.vorto.core.api.model.datatype.Enum element, final InvocationContext context) {
  StringConcatenation _builder = new StringConcatenation();
  {
   EList<EnumLiteral> _enums = element.getEnums();
   for(final EnumLiteral literal : _enums) {
    String _name = literal.getName();
    _builder.append(_name, "");
    _builder.newLineIfNotEmpty();
   }
  }
  return _builder.toString();
 }
}

代码示例来源:origin: org.eclipse.vorto/boschiotsuite-gateway

visited.add(en);
imports.add(en.getNamespace());
exports.add(en.getNamespace());

代码示例来源:origin: org.eclipse.vorto/org.eclipse.vorto.codegen.arduino

@Override
public String getFileName(final org.eclipse.vorto.core.api.model.datatype.Enum dataEnum) {
 String _name = dataEnum.getName();
 return (_name + ".h");
}

相关文章