/** * Creates an immutable copy of a {@link ThreadFactoryProvider} 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 ThreadFactoryProvider instance */ public static ImmutableThreadFactoryProvider copyOf(ThreadFactoryProvider instance) { if (instance instanceof ImmutableThreadFactoryProvider) { return (ImmutableThreadFactoryProvider) instance; } return ((ImmutableThreadFactoryProvider.Builder) ImmutableThreadFactoryProvider.builder()) .namePrefix(instance.namePrefix()) .logger(instance.logger()) .priority(instance.priority()) .daemon(instance.daemon()) .build(); }