Package com.io7m.jnoisetype.api
Class NTSampleDescription.Builder
- java.lang.Object
-
- com.io7m.jnoisetype.api.NTSampleDescription.Builder
-
- Enclosing class:
- NTSampleDescription
public static final class NTSampleDescription.Builder extends java.lang.ObjectBuilds instances of typeNTSampleDescription. Initialize attributes and then invoke thebuild()method to create an immutable instance.Builderis not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NTSampleDescriptionbuild()Builds a newNTSampleDescription.NTSampleDescription.Builderfrom(NTSampleDescriptionType instance)Fill a builder with attribute values from the providedNTSampleDescriptionTypeinstance.NTSampleDescription.BuildersetEnd(long end)Initializes the value for theendattribute.NTSampleDescription.BuildersetKind(NTSampleKind kind)Initializes the value for thekindattribute.NTSampleDescription.BuildersetLoopEnd(long loopEnd)Initializes the value for theloopEndattribute.NTSampleDescription.BuildersetLoopStart(long loopStart)Initializes the value for theloopStartattribute.NTSampleDescription.BuildersetName(NTSampleName name)Initializes the value for thenameattribute.NTSampleDescription.BuildersetOriginalPitch(NTPitch originalPitch)Initializes the value for theoriginalPitchattribute.NTSampleDescription.BuildersetPitchCorrection(int pitchCorrection)Initializes the value for thepitchCorrectionattribute.NTSampleDescription.BuildersetSampleLink(int sampleLink)Initializes the value for thesampleLinkattribute.NTSampleDescription.BuildersetSampleRate(int sampleRate)Initializes the value for thesampleRateattribute.NTSampleDescription.BuildersetStart(long start)Initializes the value for thestartattribute.
-
-
-
Method Detail
-
from
public final NTSampleDescription.Builder from(NTSampleDescriptionType instance)
Fill a builder with attribute values from the providedNTSampleDescriptionTypeinstance. 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:
thisbuilder for use in a chained invocation
-
setName
public final NTSampleDescription.Builder setName(NTSampleName name)
Initializes the value for thenameattribute.- Parameters:
name- The value for name- Returns:
thisbuilder for use in a chained invocation
-
setKind
public final NTSampleDescription.Builder setKind(NTSampleKind kind)
Initializes the value for thekindattribute.- Parameters:
kind- The value for kind- Returns:
thisbuilder for use in a chained invocation
-
setStart
public final NTSampleDescription.Builder setStart(long start)
Initializes the value for thestartattribute.- Parameters:
start- The value for start- Returns:
thisbuilder for use in a chained invocation
-
setEnd
public final NTSampleDescription.Builder setEnd(long end)
Initializes the value for theendattribute.- Parameters:
end- The value for end- Returns:
thisbuilder for use in a chained invocation
-
setLoopStart
public final NTSampleDescription.Builder setLoopStart(long loopStart)
Initializes the value for theloopStartattribute.- Parameters:
loopStart- The value for loopStart- Returns:
thisbuilder for use in a chained invocation
-
setLoopEnd
public final NTSampleDescription.Builder setLoopEnd(long loopEnd)
Initializes the value for theloopEndattribute.- Parameters:
loopEnd- The value for loopEnd- Returns:
thisbuilder for use in a chained invocation
-
setSampleRate
public final NTSampleDescription.Builder setSampleRate(int sampleRate)
Initializes the value for thesampleRateattribute.- Parameters:
sampleRate- The value for sampleRate- Returns:
thisbuilder for use in a chained invocation
-
setOriginalPitch
public final NTSampleDescription.Builder setOriginalPitch(NTPitch originalPitch)
Initializes the value for theoriginalPitchattribute.- Parameters:
originalPitch- The value for originalPitch- Returns:
thisbuilder for use in a chained invocation
-
setPitchCorrection
public final NTSampleDescription.Builder setPitchCorrection(int pitchCorrection)
Initializes the value for thepitchCorrectionattribute.- Parameters:
pitchCorrection- The value for pitchCorrection- Returns:
thisbuilder for use in a chained invocation
-
setSampleLink
public final NTSampleDescription.Builder setSampleLink(int sampleLink)
Initializes the value for thesampleLinkattribute.If not set, this attribute will have a default value as returned by the initializer of
sampleLink.- Parameters:
sampleLink- The value for sampleLink- Returns:
thisbuilder for use in a chained invocation
-
build
public NTSampleDescription build()
Builds a newNTSampleDescription.- Returns:
- An immutable instance of NTSampleDescription
- Throws:
java.lang.IllegalStateException- if any required attributes are missing
-
-