Class NTSampleDescription.Builder

java.lang.Object
com.io7m.jnoisetype.api.NTSampleDescription.Builder
Enclosing class:
NTSampleDescription

public static final class NTSampleDescription.Builder extends Object
Builds instances of type NTSampleDescription. Initialize attributes and then invoke the build() method to create an immutable instance.

Builder is not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.

  • Method Details

    • from

      Fill a builder with attribute values from the provided NTSampleDescriptionType instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • setName

      public final NTSampleDescription.Builder setName(NTSampleName name)
      Initializes the value for the name attribute.
      Parameters:
      name - The value for name
      Returns:
      this builder for use in a chained invocation
    • setKind

      public final NTSampleDescription.Builder setKind(NTSampleKind kind)
      Initializes the value for the kind attribute.
      Parameters:
      kind - The value for kind
      Returns:
      this builder for use in a chained invocation
    • setStart

      public final NTSampleDescription.Builder setStart(long start)
      Initializes the value for the start attribute.
      Parameters:
      start - The value for start
      Returns:
      this builder for use in a chained invocation
    • setEnd

      public final NTSampleDescription.Builder setEnd(long end)
      Initializes the value for the end attribute.
      Parameters:
      end - The value for end
      Returns:
      this builder for use in a chained invocation
    • setLoopStart

      public final NTSampleDescription.Builder setLoopStart(long loopStart)
      Initializes the value for the loopStart attribute.
      Parameters:
      loopStart - The value for loopStart
      Returns:
      this builder for use in a chained invocation
    • setLoopEnd

      public final NTSampleDescription.Builder setLoopEnd(long loopEnd)
      Initializes the value for the loopEnd attribute.
      Parameters:
      loopEnd - The value for loopEnd
      Returns:
      this builder for use in a chained invocation
    • setSampleRate

      public final NTSampleDescription.Builder setSampleRate(int sampleRate)
      Initializes the value for the sampleRate attribute.
      Parameters:
      sampleRate - The value for sampleRate
      Returns:
      this builder for use in a chained invocation
    • setOriginalPitch

      public final NTSampleDescription.Builder setOriginalPitch(NTPitch originalPitch)
      Initializes the value for the originalPitch attribute.
      Parameters:
      originalPitch - The value for originalPitch
      Returns:
      this builder for use in a chained invocation
    • setPitchCorrection

      public final NTSampleDescription.Builder setPitchCorrection(int pitchCorrection)
      Initializes the value for the pitchCorrection attribute.
      Parameters:
      pitchCorrection - The value for pitchCorrection
      Returns:
      this builder for use in a chained invocation
    • setSampleLink

      public final NTSampleDescription.Builder setSampleLink(int sampleLink)
      Initializes the value for the sampleLink attribute.

      If not set, this attribute will have a default value as returned by the initializer of sampleLink.

      Parameters:
      sampleLink - The value for sampleLink
      Returns:
      this builder for use in a chained invocation
    • build

      public NTSampleDescription build()
      Builds a new NTSampleDescription.
      Returns:
      An immutable instance of NTSampleDescription
      Throws:
      IllegalStateException - if any required attributes are missing