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