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.ObjectBuilds instances of typeSMFAttribute. 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 SMFAttributebuild()Builds a newSMFAttribute.SMFAttribute.Builderfrom(SMFAttributeType instance)Fill a builder with attribute values from the providedSMFAttributeTypeinstance.SMFAttribute.BuildersetComponentCount(int componentCount)Initializes the value for thecomponentCountattribute.SMFAttribute.BuildersetComponentSizeBits(int componentSizeBits)Initializes the value for thecomponentSizeBitsattribute.SMFAttribute.BuildersetComponentType(SMFComponentType componentType)Initializes the value for thecomponentTypeattribute.SMFAttribute.BuildersetName(SMFAttributeName name)Initializes the value for thenameattribute.
-
-
-
Method Detail
-
from
public final SMFAttribute.Builder from(SMFAttributeType instance)
Fill a builder with attribute values from the providedSMFAttributeTypeinstance. 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 SMFAttribute.Builder setName(SMFAttributeName name)
Initializes the value for thenameattribute.- Parameters:
name- The value for name- Returns:
thisbuilder for use in a chained invocation
-
setComponentType
public final SMFAttribute.Builder setComponentType(SMFComponentType componentType)
Initializes the value for thecomponentTypeattribute.- Parameters:
componentType- The value for componentType- Returns:
thisbuilder for use in a chained invocation
-
setComponentCount
public final SMFAttribute.Builder setComponentCount(int componentCount)
Initializes the value for thecomponentCountattribute.- Parameters:
componentCount- The value for componentCount- Returns:
thisbuilder for use in a chained invocation
-
setComponentSizeBits
public final SMFAttribute.Builder setComponentSizeBits(int componentSizeBits)
Initializes the value for thecomponentSizeBitsattribute.- Parameters:
componentSizeBits- The value for componentSizeBits- Returns:
thisbuilder 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
-
-