Skip to content

Commit

Permalink
resource: Add addResource method to ResourceBuilder
Browse files Browse the repository at this point in the history
Signed-off-by: BJ Hargrave <bj@hargrave.dev>
  • Loading branch information
bjhargrave committed Sep 23, 2022
1 parent f8736e7 commit 6cd8742
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions biz.aQute.bndlib/src/aQute/bnd/osgi/resource/ResourceBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,19 @@ public class ResourceBuilder {

private boolean built = false;

public ResourceBuilder() {}

public ResourceBuilder(Resource source) {
this();
addResource(source);
}

public ResourceBuilder addResource(Resource source) {
addCapabilities(source.getCapabilities(null));
addRequirements(source.getRequirements(null));
return this;
}

public ResourceBuilder() {}

public ResourceBuilder addCapability(Capability capability) {
CapReqBuilder builder = CapReqBuilder.clone(capability);
return addCapability(builder);
Expand Down Expand Up @@ -833,6 +839,11 @@ public Resource build() {
return null;
}

@Override
public ResourceBuilder addResource(Resource source) {
return ResourceBuilder.this.addResource(source);
}

@Override
public ResourceBuilder addCapability(Capability capability) {
return ResourceBuilder.this.addCapability(capability);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@Version("4.2.0")
@Version("4.3.0")
package aQute.bnd.osgi.resource;

import org.osgi.annotation.versioning.Version;

0 comments on commit 6cd8742

Please sign in to comment.