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