/** * Fill a builder with attribute values from the provided {@code SMFAttributeNameType} 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(SMFAttributeNameType instance) { Objects.requireNonNull(instance, "instance"); setValue(instance.value()); return this; }
/** * Fill a builder with attribute values from the provided {@code SMFAttributeNameType} 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(SMFAttributeNameType instance) { Objects.requireNonNull(instance, "instance"); setValue(instance.value()); return this; }
/** * Check the preconditions for the type. */ @Value.Check default void checkPreconditions() { if (!SMFAttributeNames.isValid(this.value())) { throw new IllegalArgumentException( "Attribute names must match the pattern: " + SMFAttributeNames.PATTERN.pattern()); } }
/** * Check the preconditions for the type. */ @Value.Check default void checkPreconditions() { if (!SMFAttributeNames.isValid(this.value())) { throw new IllegalArgumentException( "Attribute names must match the pattern: " + SMFAttributeNames.PATTERN.pattern()); } }
private static IllegalArgumentException incompatibleType( final SMFAttributeNameType name, final SMFArrayAttributeMappingType required_attribute, final SMFAttributeType received_attribute) { final StringBuilder sb = new StringBuilder(128); sb.append("Incompatible types."); sb.append(System.lineSeparator()); sb.append(" Attribute: "); sb.append(name.value()); sb.append(System.lineSeparator()); sb.append(" Required type: "); sb.append(required_attribute.componentCount()); sb.append(" of "); sb.append(required_attribute.componentType().get()); sb.append(System.lineSeparator()); sb.append(" Received type: "); sb.append(received_attribute.componentCount()); sb.append(" of "); sb.append(received_attribute.componentType()); sb.append(System.lineSeparator()); return new IllegalArgumentException(sb.toString()); }