private static void ensureValidConfig(CorsDecorators conf) {
        requireNonNull(conf, "conf");
        final CorsDecorator[] policies = conf.value();
        checkState(policies.length > 0, "value() should not be empty.");
        final boolean anyOrigin = Arrays.stream(policies).anyMatch(
                c -> Arrays.asList(c.origins()).contains("*"));
        checkState(!anyOrigin || (policies.length == 1 && policies[0].origins().length == 1),
                   "the policy that support any origin (*) has been already included." +
                   " You cannot have an additional policy or origin.");
        checkState(Arrays.stream(policies).noneMatch(c -> c.origins().length == 0),
                   "origins should not be empty.");
    }
A factory which creates a {@link CorsService} decorator when two or more {@link CorsDecorator}s are added.
core/src/main/java/com/linecorp/armeria/server/cors/CorsDecoratorsFactoryFunction.java