/** * Builds a new {@link SMFAttribute SMFAttribute}. * @return An immutable instance of SMFAttribute * @throws java.lang.IllegalStateException if any required attributes are missing */ public SMFAttribute build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return SMFAttribute.validate(new SMFAttribute(null, name, componentType, componentCount, componentSizeBits)); }
/** * Creates an immutable copy of a {@link SMFAttributeType} value. * Uses accessors to get values to initialize the new immutable instance. * If an instance is already immutable, it is returned as is. * @param instance The instance to copy * @return A copied immutable SMFAttribute instance */ public static SMFAttribute copyOf(SMFAttributeType instance) { if (instance instanceof SMFAttribute) { return (SMFAttribute) instance; } return SMFAttribute.builder() .from(instance) .build(); }
/** * Fill a builder with attribute values from the provided {@code SMFAttributeType} instance. * Regular attribute values will be replaced with those from the given instance. * Absent optional values will not replace present values. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(SMFAttributeType instance) { Objects.requireNonNull(instance, "instance"); setName(instance.name()); setComponentType(instance.componentType()); setComponentCount(instance.componentCount()); setComponentSizeBits(instance.componentSizeBits()); return this; }
/** * Fill a builder with attribute values from the provided {@code SMFAttributeType} instance. * Regular attribute values will be replaced with those from the given instance. * Absent optional values will not replace present values. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(SMFAttributeType instance) { Objects.requireNonNull(instance, "instance"); setName(instance.name()); setComponentType(instance.componentType()); setComponentCount(instance.componentCount()); setComponentSizeBits(instance.componentSizeBits()); return this; }
/** * Creates an immutable copy of a {@link SMFAttributeType} value. * Uses accessors to get values to initialize the new immutable instance. * If an instance is already immutable, it is returned as is. * @param instance The instance to copy * @return A copied immutable SMFAttribute instance */ public static SMFAttribute copyOf(SMFAttributeType instance) { if (instance instanceof SMFAttribute) { return (SMFAttribute) instance; } return SMFAttribute.builder() .from(instance) .build(); }
/** * Creates a builder for {@link SMFAttribute SMFAttribute}. * @return A new SMFAttribute builder */ public static SMFAttribute.Builder builder() { return new SMFAttribute.Builder(); }
/** * Creates a builder for {@link SMFAttribute SMFAttribute}. * @return A new SMFAttribute builder */ public static SMFAttribute.Builder builder() { return new SMFAttribute.Builder(); }
/** * Builds a new {@link SMFAttribute SMFAttribute}. * @return An immutable instance of SMFAttribute * @throws java.lang.IllegalStateException if any required attributes are missing */ public SMFAttribute build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return SMFAttribute.validate(new SMFAttribute(null, name, componentType, componentCount, componentSizeBits)); }