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