gpt4 book ai didi

com.reprezen.rapidml.ZenModel.getImports()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 02:26:49 28 4
gpt4 key购买 nike

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

ZenModel.getImports介绍

[英]Returns the value of the 'Imports' containment reference list. The list contents are of type com.reprezen.rapidml.ImportDeclaration.

If the meaning of the 'Imports' containment reference list isn't clear, there really should be more of a description here...
[中]返回“Imports”包含引用列表的值。列表内容为com类型。雷普雷岑。rapidml。进口折扣。
如果“Imports”包含引用列表的含义不清楚,这里真的应该有更多的描述。。。

代码示例

代码示例来源:origin: com.reprezen.rapidml/com.reprezen.rapidml

@Check
public void checkImportDeclarationUnique(ZenModel model) {
  HashSet<String> aliases = new HashSet<>();
  HashSet<String> namespaces = new HashSet<>();
  for (ImportDeclaration importDecl : model.getImports()) {
    if (!Strings.isNullOrEmpty(importDecl.getAlias()) && !aliases.add(importDecl.getAlias())) {
      error(NLS.bind(Messages.XtextDslJavaValidator_duplicateAlias, importDecl.getAlias()), importDecl,
          RapidmlPackage.Literals.IMPORT_DECLARATION__ALIAS);
    }
    if (!Strings.isNullOrEmpty(importDecl.getImportedNamespace())
        && !namespaces.add(importDecl.getImportedNamespace())) {
      error(NLS.bind(Messages.XtextDslJavaValidator_duplicateNamespace, importDecl.getImportedNamespace()),
          importDecl, RapidmlPackage.Literals.IMPORT_DECLARATION__IMPORTED_NAMESPACE);
    }
  }
}

代码示例来源:origin: com.reprezen.rapidml/com.reprezen.rapidml.model

/**
 * @param model
 *            model
 * @return list of resource definitions that imported using import RESTfulInterfaces
 */
static List<ResourceDefinition> getImportedResources(ZenModel model) {
  ArrayList<ResourceDefinition> result = new ArrayList<>();
  for (ImportDeclaration importDecl : model.getImports()) {
    String uri = importDecl.getImportURI();
    if (!Strings.isNullOrEmpty(uri)) {
      Resource modelResource = importDecl.eResource();
      Resource resource = getResource(modelResource, uri);
      if (resource != null && resource.getErrors().isEmpty() && !resource.getContents().isEmpty()) {
        ZenModel zenModel = (ZenModel) resource.getContents().get(0);
        String namespace = Strings.isNullOrEmpty(zenModel.getNamespace()) ? zenModel.getName() : zenModel
            .getNamespace() + "." + zenModel.getName(); //$NON-NLS-1$
        for (ResourceAPI resourceAPI : zenModel.getResourceAPIs()) {
          String ifaceFQN = namespace + "." + resourceAPI.getName(); //$NON-NLS-1$
          if (ifaceFQN.equals(importDecl.getImportedNamespace())) {
            result.addAll(resourceAPI.getOwnedResourceDefinitions());
          }
        }
      }
    }
  }
  return result;
}

代码示例来源:origin: com.reprezen.rapidml/com.reprezen.rapidml.model

public void addInheritedProperties(ZenModel model) {
  if (model == null) {
    // can be null when an import declaration is declared, but elements from it are never used
    return;
  }
  if (TagUtils.getTagWithName(model, TagUtils.DATATYPE_PROCESSED).isPresent()) {
    return;
  }
  TagUtils.addTag(model, TagUtils.DATATYPE_PROCESSED).setValue("true");
  for (Structure structure : EcoreUtil2.getAllContentsOfType(model, Structure.class)) {
    addInheritedProperties(structure);
  }
  for (ImportDeclaration import_: model.getImports()) {
    addInheritedProperties(import_.getImportedModel());
  }
}

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com