Example #1
0
  /** @param d not null */
  protected boolean match(Dependency d) {
    boolean r = true;

    /* match if not attributes given */
    if (hasattribs() == false) return r;

    if (r && this.alias != null) r = match(this.alias, d.getAlias());

    if (r && this.scope != null) {
      String[] scope;
      scope = d.getScope();
      r = false;
      for (int i = 0; !r && i < scope.length; ++i) r = match(this.scope, scope[i]);
    }

    if (r && this.bname != null) r = match(this.bname, d.basename());

    if (r && this.type != null) r = match(this.type, d.getType());

    if (r && this.gid != null) r = match(this.gid, d.getGroupId());

    if (r && this.path != null) r = match(this.path, d.m1path());

    if (r && this.version != null) r = match(this.version, d.getVersion());

    return r;
  }
Example #2
0
 private <T> void addDependency(ServiceBuilder<?> builder, Dependency<T> dependency) {
   final ServiceName name = dependency.getName();
   final Injector<T> injector = dependency.getInjector();
   if (injector != null) {
     builder.addDependency(name, dependency.getType(), injector);
   } else {
     builder.addDependency(name);
   }
 }
Example #3
0
  @Test
  public void testConstructWithCustomTypeAndScope() {
    // Set up
    final Dependency dependency =
        new Dependency(
            DEPENDENCY_GROUP_ID, DEPENDENCY_ARTIFACT_ID, DEPENDENCY_VERSION, ZIP, PROVIDED);

    // Invoke and check
    assertEquals(ZIP, dependency.getType());
    assertEquals(PROVIDED, dependency.getScope());
  }
 protected boolean matches(Dependency dep) {
   return dep.getType() == _requiredType;
 }