Ejemplo n.º 1
0
  @NotNull
  public static MavenDomDependency createDomDependency(
      MavenDomDependencies dependencies, @Nullable Editor editor, @NotNull final MavenId id) {
    MavenDomDependency dep = createDomDependency(dependencies, editor);

    dep.getGroupId().setStringValue(id.getGroupId());
    dep.getArtifactId().setStringValue(id.getArtifactId());
    dep.getVersion().setStringValue(id.getVersion());

    return dep;
  }
    @NotNull
    @Override
    public String getText() {
      StringBuffer sb = new StringBuffer();

      append(sb, myDependency.getGroupId().getStringValue());
      append(sb, myDependency.getArtifactId().getStringValue());
      append(sb, myDependency.getVersion().getStringValue());

      return sb.toString();
    }
  @Nullable
  private static String createId(MavenDomDependency coordinates) {
    String groupId = coordinates.getGroupId().getStringValue();
    String artifactId = coordinates.getArtifactId().getStringValue();

    if (StringUtil.isEmptyOrSpaces(groupId) || StringUtil.isEmptyOrSpaces(artifactId)) return null;

    String version = coordinates.getVersion().getStringValue();
    String type = coordinates.getType().getStringValue();
    String classifier = coordinates.getClassifier().getStringValue();

    return groupId + ":" + artifactId + ":" + version + ":" + type + ":" + classifier;
  }