@Override
    public void build(T instance) {
        super.build(instance);

        if (!StringUtils.isEmpty(local)) {
            instance.setLocal(local);
        }
        if (!StringUtils.isEmpty(stub)) {
            instance.setStub(stub);
        }
        if (monitor != null) {
            instance.setMonitor(monitor);
        }
        if (!StringUtils.isEmpty(proxy)) {
            instance.setProxy(proxy);
        }
        if (!StringUtils.isEmpty(cluster)) {
            instance.setCluster(cluster);
        }
        if (!StringUtils.isEmpty(filter)) {
            instance.setFilter(filter);
        }
        if (!StringUtils.isEmpty(listener)) {
            instance.setListener(listener);
        }
        if (!StringUtils.isEmpty(owner)) {
            instance.setOwner(owner);
        }
        if (connections != null) {
            instance.setConnections(connections);
        }
        if (!StringUtils.isEmpty(layer)) {
            instance.setLayer(layer);
        }
        if (application != null) {
            instance.setApplication(application);
        }
        if (module != null) {
            instance.setModule(module);
        }
        if (registries != null) {
            instance.setRegistries(registries);
        }
        if (!StringUtils.isEmpty(registryIds)) {
            instance.setRegistryIds(registryIds);
        }
        if (!StringUtils.isEmpty(onconnect)) {
            instance.setOnconnect(onconnect);
        }
        if (!StringUtils.isEmpty(ondisconnect)) {
            instance.setOndisconnect(ondisconnect);
        }
        if (metadataReportConfig != null) {
            instance.setMetadataReportConfig(metadataReportConfig);
        }
        if (configCenter != null) {
            instance.setConfigCenter(configCenter);
        }
        if (callbacks != null) {
            instance.setCallbacks(callbacks);
        }
        if (!StringUtils.isEmpty(scope)) {
            instance.setScope(scope);
        }
        if (StringUtils.isNotEmpty(tag)) {
            instance.setTag(tag);
        }
    }
@Test
    void build() {
        MonitorConfig monitorConfig = new MonitorConfig("123");
        ApplicationConfig applicationConfig = new ApplicationConfig();
        applicationConfig.setName("appName");
        ModuleConfig moduleConfig = new ModuleConfig();
        RegistryConfig registryConfig = new RegistryConfig();
        MetadataReportConfig metadataReportConfig = new MetadataReportConfig();
        ConfigCenterConfig configCenterConfig = new ConfigCenterConfig();

        InterfaceBuilder builder = new InterfaceBuilder();
        builder.id("id")
                .local(true)
                .stub(false)
                .monitor("123")
                .proxy("mockproxyfactory")
                .cluster("mockcluster")
                .filter("mockfilter")
                .listener("mockinvokerlistener")
                .owner("owner")
                .connections(1)
                .layer("layer")
                .application(applicationConfig)
                .module(moduleConfig)
                .addRegistry(registryConfig)
                .registryIds("registryIds")
                .onconnect("onconnet")
                .ondisconnect("ondisconnect")
                .metadataReportConfig(metadataReportConfig)
                .configCenter(configCenterConfig)
                .callbacks(2)
                .scope("scope");

        InterfaceConfig config = builder.build();
        InterfaceConfig config2 = builder.build();

        Assertions.assertEquals("id", config.getId());
        Assertions.assertEquals("true", config.getLocal());
        Assertions.assertEquals("false", config.getStub());
        Assertions.assertEquals(monitorConfig, config.getMonitor());
        Assertions.assertEquals("mockproxyfactory", config.getProxy());
        Assertions.assertEquals("mockcluster", config.getCluster());
        Assertions.assertEquals("mockfilter", config.getFilter());
        Assertions.assertEquals("mockinvokerlistener", config.getListener());
        Assertions.assertEquals("owner", config.getOwner());
        Assertions.assertEquals(1, config.getConnections().intValue());
        Assertions.assertEquals("layer", config.getLayer());
        Assertions.assertEquals(applicationConfig, config.getApplication());
        Assertions.assertEquals(moduleConfig, config.getModule());
        Assertions.assertEquals(registryConfig, config.getRegistry());
        Assertions.assertEquals("registryIds", config.getRegistryIds());
        Assertions.assertEquals("onconnet", config.getOnconnect());
        Assertions.assertEquals("ondisconnect", config.getOndisconnect());
        Assertions.assertEquals(metadataReportConfig, config.getMetadataReportConfig());
        Assertions.assertEquals(configCenterConfig, config.getConfigCenter());
        Assertions.assertEquals(2, config.getCallbacks().intValue());
        Assertions.assertEquals("scope", config.getScope());

        Assertions.assertNotSame(config, config2);
    }