Package com.io7m.smfj.core
Class SMFAttribute.Builder
- java.lang.Object
-
- com.io7m.smfj.core.SMFAttribute.Builder
-
- Enclosing class:
- SMFAttribute
public static final class SMFAttribute.Builder extends java.lang.Object
Builds instances of typeSMFAttribute
. Initialize attributes and then invoke thebuild()
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 Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SMFAttribute
build()
Builds a newSMFAttribute
.SMFAttribute.Builder
from(SMFAttributeType instance)
Fill a builder with attribute values from the providedSMFAttributeType
instance.SMFAttribute.Builder
setComponentCount(int componentCount)
Initializes the value for thecomponentCount
attribute.SMFAttribute.Builder
setComponentSizeBits(int componentSizeBits)
Initializes the value for thecomponentSizeBits
attribute.SMFAttribute.Builder
setComponentType(SMFComponentType componentType)
Initializes the value for thecomponentType
attribute.SMFAttribute.Builder
setName(SMFAttributeName name)
Initializes the value for thename
attribute.
-
-
-
Method Detail
-
from
public final SMFAttribute.Builder from(SMFAttributeType instance)
Fill a builder with attribute values from the providedSMFAttributeType
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 SMFAttribute.Builder setName(SMFAttributeName name)
Initializes the value for thename
attribute.- Parameters:
name
- The value for name- Returns:
this
builder for use in a chained invocation
-
setComponentType
public final SMFAttribute.Builder setComponentType(SMFComponentType componentType)
Initializes the value for thecomponentType
attribute.- Parameters:
componentType
- The value for componentType- Returns:
this
builder for use in a chained invocation
-
setComponentCount
public final SMFAttribute.Builder setComponentCount(int componentCount)
Initializes the value for thecomponentCount
attribute.- Parameters:
componentCount
- The value for componentCount- Returns:
this
builder for use in a chained invocation
-
setComponentSizeBits
public final SMFAttribute.Builder setComponentSizeBits(int componentSizeBits)
Initializes the value for thecomponentSizeBits
attribute.- Parameters:
componentSizeBits
- The value for componentSizeBits- Returns:
this
builder for use in a chained invocation
-
build
public SMFAttribute build()
Builds a newSMFAttribute
.- Returns:
- An immutable instance of SMFAttribute
- Throws:
java.lang.IllegalStateException
- if any required attributes are missing
-
-