/** * Creates an immutable copy of a {@link SMFHeaderType} 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 SMFHeader instance */ public static SMFHeader copyOf(SMFHeaderType instance) { if (instance instanceof SMFHeader) { return (SMFHeader) instance; } return SMFHeader.builder() .from(instance) .build(); }
/** * Creates an immutable copy of a {@link SMFHeaderType} 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 SMFHeader instance */ public static SMFHeader copyOf(SMFHeaderType instance) { if (instance instanceof SMFHeader) { return (SMFHeader) instance; } return SMFHeader.builder() .from(instance) .build(); }