/** * 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 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(); }