Package htsjdk.beta.io.bundle

# Class BundleBuilder

java.lang.Object
htsjdk.beta.io.bundle.BundleBuilder

public final class BundleBuilder extends Object
A builder class for `Bundle`s.

## Constructor Summary

Constructors
Constructor
Description
`BundleBuilder()`
Start a new bundle builder.

## Method Summary

Modifier and Type
Method
Description
`BundleBuilder`
`addPrimary(BundleResource resource)`
Add the primary resource to the bundle.
`BundleBuilder`
`addSecondary(BundleResource resource)`
Add a (non-primary) resource to the bundle.
`Bundle`
`build()`
Create a bundle from this builder's accumulated builder state, and reset the builder state.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### BundleBuilder

public BundleBuilder()
Start a new bundle builder.

## Method Details

### addPrimary

public BundleBuilder addPrimary(BundleResource resource)
Add the primary resource to the bundle. The content type of resource will be the bundle's primary key.

Parameters:
  `resource` - the resource which will be the primary resource for the bundle
Returns:
  this `BundleBuilder`

### addSecondary

public BundleBuilder addSecondary(BundleResource resource)
Add a (non-primary) resource to the bundle.

Parameters:
  `resource` - the resource to be added
Returns:
  this `BundleBuilder`

### build

public Bundle build()
Create a bundle from this builder's accumulated builder state, and reset the builder state. At least one (primary) resource must have been previously added to create a valid bundle.

Returns:
  a `Bundle`
Throws:
  `IllegalStateException` - if no primary resource has been added