repo stringclasses 1k
values | file_url stringlengths 96 373 | file_path stringlengths 11 294 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 6
values | commit_sha stringclasses 1k
values | retrieved_at stringdate 2026-01-04 14:45:56 2026-01-04 18:30:23 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/rpc/cluster/ConfiguratorFactory.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/rpc/cluster/ConfiguratorFactory.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.rpc.cluster;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.constants.CommonConstants;
import org.apache.dubbo.common.extension.Adaptive;
import org.apache.dubbo.rpc.cluster.Configurator;
@Deprecated
public interface ConfiguratorFactory extends org.apache.dubbo.rpc.cluster.ConfiguratorFactory {
@Adaptive(CommonConstants.PROTOCOL_KEY)
com.alibaba.dubbo.rpc.cluster.Configurator getConfigurator(com.alibaba.dubbo.common.URL url);
@Override
default Configurator getConfigurator(URL url) {
return this.getConfigurator(new com.alibaba.dubbo.common.DelegateURL(url));
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/rpc/cluster/LoadBalance.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/rpc/cluster/LoadBalance.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.rpc.cluster;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.rpc.Invocation;
import org.apache.dubbo.rpc.Invoker;
import org.apache.dubbo.rpc.RpcException;
import java.util.List;
import java.util.stream.Collectors;
import com.alibaba.dubbo.common.DelegateURL;
@Deprecated
public interface LoadBalance extends org.apache.dubbo.rpc.cluster.LoadBalance {
<T> com.alibaba.dubbo.rpc.Invoker<T> select(
List<com.alibaba.dubbo.rpc.Invoker<T>> invokers,
com.alibaba.dubbo.common.URL url,
com.alibaba.dubbo.rpc.Invocation invocation)
throws RpcException;
@Override
default <T> Invoker<T> select(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException {
List<com.alibaba.dubbo.rpc.Invoker<T>> invs = invokers.stream()
.map(invoker -> new com.alibaba.dubbo.rpc.Invoker.CompatibleInvoker<T>(invoker))
.collect(Collectors.toList());
com.alibaba.dubbo.rpc.Invoker<T> selected = select(
invs, new DelegateURL(url), new com.alibaba.dubbo.rpc.Invocation.CompatibleInvocation(invocation));
return selected == null ? null : selected.getOriginal();
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/rpc/cluster/Router.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/rpc/cluster/Router.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.rpc.cluster;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.rpc.Invocation;
import org.apache.dubbo.rpc.Invoker;
import org.apache.dubbo.rpc.RpcException;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@Deprecated
public interface Router extends org.apache.dubbo.rpc.cluster.Router {
@Override
com.alibaba.dubbo.common.URL getUrl();
<T> List<com.alibaba.dubbo.rpc.Invoker<T>> route(
List<com.alibaba.dubbo.rpc.Invoker<T>> invokers,
com.alibaba.dubbo.common.URL url,
com.alibaba.dubbo.rpc.Invocation invocation)
throws com.alibaba.dubbo.rpc.RpcException;
int compareTo(Router o);
// Add since 2.7.0
@Override
default <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException {
List<com.alibaba.dubbo.rpc.Invoker<T>> invs = invokers.stream()
.map(invoker -> new com.alibaba.dubbo.rpc.Invoker.CompatibleInvoker<T>(invoker))
.collect(Collectors.toList());
List<com.alibaba.dubbo.rpc.Invoker<T>> res = this.route(
invs,
new com.alibaba.dubbo.common.DelegateURL(url),
new com.alibaba.dubbo.rpc.Invocation.CompatibleInvocation(invocation));
return res.stream()
.map(inv -> inv.getOriginal())
.filter(Objects::nonNull)
.collect(Collectors.toList());
}
@Override
default boolean isRuntime() {
return true;
}
@Override
default boolean isForce() {
return false;
}
@Override
default int getPriority() {
return 1;
}
@Override
default int compareTo(org.apache.dubbo.rpc.cluster.Router o) {
if (!(o instanceof Router)) {
return 1;
}
return this.compareTo((Router) o);
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/rpc/cluster/Merger.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/rpc/cluster/Merger.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.rpc.cluster;
@Deprecated
public interface Merger extends org.apache.dubbo.rpc.cluster.Merger {}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/rpc/cluster/Cluster.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/rpc/cluster/Cluster.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.rpc.cluster;
import org.apache.dubbo.rpc.Invoker;
import org.apache.dubbo.rpc.RpcException;
import org.apache.dubbo.rpc.cluster.Directory;
@Deprecated
public interface Cluster extends org.apache.dubbo.rpc.cluster.Cluster {
<T> com.alibaba.dubbo.rpc.Invoker<T> join(com.alibaba.dubbo.rpc.cluster.Directory<T> directory)
throws com.alibaba.dubbo.rpc.RpcException;
@Override
default <T> Invoker<T> join(Directory<T> directory, boolean buildFilterChain) throws RpcException {
return null;
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/rpc/cluster/loadbalance/AbstractLoadBalance.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/rpc/cluster/loadbalance/AbstractLoadBalance.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.rpc.cluster.loadbalance;
import org.apache.dubbo.rpc.support.RpcUtils;
import java.util.List;
import com.alibaba.dubbo.common.Constants;
import com.alibaba.dubbo.common.URL;
import com.alibaba.dubbo.rpc.Invocation;
import com.alibaba.dubbo.rpc.Invoker;
import com.alibaba.dubbo.rpc.cluster.LoadBalance;
@Deprecated
public abstract class AbstractLoadBalance implements LoadBalance {
@Override
public <T> Invoker<T> select(List<Invoker<T>> invokers, URL url, Invocation invocation) {
if (invokers == null || invokers.size() == 0) return null;
if (invokers.size() == 1) return invokers.get(0);
return doSelect(invokers, url, invocation);
}
protected abstract <T> Invoker<T> doSelect(List<Invoker<T>> invokers, URL url, Invocation invocation);
protected int getWeight(Invoker<?> invoker, Invocation invocation) {
int weight = invoker.getUrl()
.getMethodParameter(RpcUtils.getMethodName(invocation), Constants.WEIGHT_KEY, Constants.DEFAULT_WEIGHT);
if (weight > 0) {
long timestamp = invoker.getUrl().getParameter(Constants.TIMESTAMP_KEY, 0L);
if (timestamp > 0L) {
int uptime = (int) (System.currentTimeMillis() - timestamp);
int warmup = invoker.getUrl().getParameter(Constants.WARMUP_KEY, Constants.DEFAULT_WARMUP);
if (uptime > 0 && uptime < warmup) {
weight = calculateWarmupWeight(uptime, warmup, weight);
}
}
}
return weight;
}
static int calculateWarmupWeight(int uptime, int warmup, int weight) {
int ww = (int) ((float) uptime / ((float) warmup / (float) weight));
return ww < 1 ? 1 : (ww > weight ? weight : ww);
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/rpc/protocol/dubbo/FutureAdapter.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/rpc/protocol/dubbo/FutureAdapter.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.rpc.protocol.dubbo;
import org.apache.dubbo.rpc.AppResponse;
import org.apache.dubbo.rpc.Result;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.function.BiConsumer;
import com.alibaba.dubbo.remoting.RemotingException;
import com.alibaba.dubbo.remoting.exchange.ResponseCallback;
import com.alibaba.dubbo.remoting.exchange.ResponseFuture;
import com.alibaba.dubbo.rpc.RpcException;
/**
* 2019-06-20
*/
@Deprecated
public class FutureAdapter<V> implements Future<V> {
private CompletableFuture<Object> future;
public FutureAdapter(CompletableFuture<Object> future) {
this.future = future;
}
public FutureAdapter(ResponseFuture responseFuture) {
this.future = new CompletableFuture<>();
responseFuture.setCallback(new ResponseCallback() {
@Override
public void done(Object response) {
future.complete(response);
}
@Override
public void caught(Throwable exception) {
future.completeExceptionally(exception);
}
});
}
public ResponseFuture getFuture() {
return new ResponseFuture() {
@Override
public Object get() throws RemotingException {
try {
return future.get();
} catch (InterruptedException | ExecutionException e) {
throw new RemotingException(e);
}
}
@Override
public Object get(int timeoutInMillis) throws RemotingException {
try {
return future.get(timeoutInMillis, TimeUnit.MILLISECONDS);
} catch (InterruptedException | TimeoutException | ExecutionException e) {
throw new RemotingException(e);
}
}
@Override
public void setCallback(ResponseCallback callback) {
FutureAdapter.this.setCallback(callback);
}
@Override
public boolean isDone() {
return future.isDone();
}
};
}
void setCallback(ResponseCallback callback) {
BiConsumer<Object, ? super Throwable> biConsumer = new BiConsumer<Object, Throwable>() {
@Override
public void accept(Object obj, Throwable t) {
if (t != null) {
if (t instanceof CompletionException) {
t = t.getCause();
}
callback.caught(t);
} else {
AppResponse appResponse = (AppResponse) obj;
if (appResponse.hasException()) {
callback.caught(appResponse.getException());
} else {
callback.done((V) appResponse.getValue());
}
}
}
};
future.whenComplete(biConsumer);
}
@Override
public boolean cancel(boolean mayInterruptIfRunning) {
return false;
}
@Override
public boolean isCancelled() {
return false;
}
@Override
public boolean isDone() {
return future.isDone();
}
@Override
@SuppressWarnings("unchecked")
public V get() throws InterruptedException, ExecutionException {
try {
return (V) (((Result) future.get()).recreate());
} catch (InterruptedException | ExecutionException e) {
throw e;
} catch (Throwable e) {
throw new RpcException(e);
}
}
@Override
@SuppressWarnings("unchecked")
public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
try {
return (V) (((Result) future.get(timeout, unit)).recreate());
} catch (InterruptedException | ExecutionException | TimeoutException e) {
throw e;
} catch (Throwable e) {
throw new RpcException(e);
}
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/qos/command/CommandContext.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/qos/command/CommandContext.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.qos.command;
@Deprecated
public class CommandContext extends org.apache.dubbo.qos.api.CommandContext {
public CommandContext(org.apache.dubbo.qos.api.CommandContext context) {
super(context.getCommandName(), context.getArgs(), context.isHttp());
setRemote(context.getRemote());
setOriginRequest(context.getOriginRequest());
}
public CommandContext(String commandName) {
super(commandName);
}
public CommandContext(String commandName, String[] args, boolean isHttp) {
super(commandName, args, isHttp);
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/qos/command/BaseCommand.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/qos/command/BaseCommand.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.qos.command;
import org.apache.dubbo.qos.api.CommandContext;
@Deprecated
public interface BaseCommand extends org.apache.dubbo.qos.api.BaseCommand {
String execute(com.alibaba.dubbo.qos.command.CommandContext commandContext, String[] args);
@Override
default String execute(CommandContext commandContext, String[] args) {
return this.execute(new com.alibaba.dubbo.qos.command.CommandContext(commandContext), args);
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/URL.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/common/URL.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.common;
import org.apache.dubbo.common.utils.CollectionUtils;
import org.apache.dubbo.common.utils.StringUtils;
import java.net.InetSocketAddress;
import java.util.Collection;
import java.util.Map;
@Deprecated
public class URL extends org.apache.dubbo.common.URL {
protected URL() {
super();
}
public URL(org.apache.dubbo.common.URL url) {
super(
url.getProtocol(),
url.getUsername(),
url.getPassword(),
url.getHost(),
url.getPort(),
url.getPath(),
url.getParameters());
}
public URL(String protocol, String host, int port) {
super(protocol, null, null, host, port, null, (Map<String, String>) null);
}
public URL(String protocol, String host, int port, String[] pairs) {
super(protocol, null, null, host, port, null, CollectionUtils.toStringMap(pairs));
}
public URL(String protocol, String host, int port, Map<String, String> parameters) {
super(protocol, null, null, host, port, null, parameters);
}
public URL(String protocol, String host, int port, String path) {
super(protocol, null, null, host, port, path, (Map<String, String>) null);
}
public URL(String protocol, String host, int port, String path, String... pairs) {
super(protocol, null, null, host, port, path, CollectionUtils.toStringMap(pairs));
}
public URL(String protocol, String host, int port, String path, Map<String, String> parameters) {
super(protocol, null, null, host, port, path, parameters);
}
public URL(String protocol, String username, String password, String host, int port, String path) {
super(protocol, username, password, host, port, path, (Map<String, String>) null);
}
public URL(String protocol, String username, String password, String host, int port, String path, String... pairs) {
super(protocol, username, password, host, port, path, CollectionUtils.toStringMap(pairs));
}
public URL(
String protocol,
String username,
String password,
String host,
int port,
String path,
Map<String, String> parameters) {
super(protocol, username, password, host, port, path, parameters);
}
public static URL valueOf(String url) {
org.apache.dubbo.common.URL result = org.apache.dubbo.common.URL.valueOf(url);
return new DelegateURL(result);
}
public static String encode(String value) {
return org.apache.dubbo.common.URL.encode(value);
}
public static String decode(String value) {
return org.apache.dubbo.common.URL.decode(value);
}
@Override
public String getProtocol() {
return super.getProtocol();
}
@Override
public URL setProtocol(String protocol) {
return new URL(
protocol,
super.getUsername(),
super.getPassword(),
super.getHost(),
super.getPort(),
super.getPath(),
super.getParameters());
}
@Override
public String getUsername() {
return super.getUsername();
}
@Override
public URL setUsername(String username) {
return new URL(
super.getProtocol(),
username,
super.getPassword(),
super.getHost(),
super.getPort(),
super.getPath(),
super.getParameters());
}
@Override
public String getPassword() {
return super.getPassword();
}
@Override
public URL setPassword(String password) {
return new URL(
super.getProtocol(),
super.getUsername(),
password,
super.getHost(),
super.getPort(),
super.getPath(),
super.getParameters());
}
@Override
public String getAuthority() {
// Compatible with old version logic:The previous Authority only contained username and password information.
return super.getUserInformation();
}
@Override
public String getHost() {
return super.getHost();
}
@Override
public URL setHost(String host) {
return new URL(
super.getProtocol(),
super.getUsername(),
super.getPassword(),
host,
super.getPort(),
super.getPath(),
super.getParameters());
}
@Override
public String getIp() {
return super.getIp();
}
@Override
public int getPort() {
return super.getPort();
}
@Override
public URL setPort(int port) {
return new URL(
super.getProtocol(),
super.getUsername(),
super.getPassword(),
super.getHost(),
port,
super.getPath(),
super.getParameters());
}
@Override
public int getPort(int defaultPort) {
return super.getPort();
}
@Override
public String getAddress() {
return super.getAddress();
}
@Override
public URL setAddress(String address) {
org.apache.dubbo.common.URL result = super.setAddress(address);
return new URL(result);
}
@Override
public String getBackupAddress() {
return super.getBackupAddress();
}
@Override
public String getBackupAddress(int defaultPort) {
return super.getBackupAddress(defaultPort);
}
// public List<URL> getBackupUrls() {
// List<org.apache.dubbo.common.URL> res = super.getBackupUrls();
// return res.stream().map(url -> new URL(url)).collect(Collectors.toList());
// }
@Override
public String getPath() {
return super.getPath();
}
@Override
public URL setPath(String path) {
return new URL(
super.getProtocol(),
super.getUsername(),
super.getPassword(),
super.getHost(),
super.getPort(),
path,
super.getParameters());
}
@Override
public String getAbsolutePath() {
return super.getAbsolutePath();
}
@Override
public Map<String, String> getParameters() {
return super.getParameters();
}
@Override
public String getParameterAndDecoded(String key) {
return super.getParameterAndDecoded(key);
}
@Override
public String getParameterAndDecoded(String key, String defaultValue) {
return org.apache.dubbo.common.URL.decode(getParameter(key, defaultValue));
}
@Override
public String getParameter(String key) {
return super.getParameter(key);
}
@Override
public String getParameter(String key, String defaultValue) {
return super.getParameter(key, defaultValue);
}
@Override
public String[] getParameter(String key, String[] defaultValue) {
return super.getParameter(key, defaultValue);
}
@Override
public URL getUrlParameter(String key) {
org.apache.dubbo.common.URL result = super.getUrlParameter(key);
return new URL(result);
}
@Override
public double getParameter(String key, double defaultValue) {
return super.getParameter(key, defaultValue);
}
@Override
public float getParameter(String key, float defaultValue) {
return super.getParameter(key, defaultValue);
}
@Override
public long getParameter(String key, long defaultValue) {
return super.getParameter(key, defaultValue);
}
@Override
public int getParameter(String key, int defaultValue) {
return super.getParameter(key, defaultValue);
}
@Override
public short getParameter(String key, short defaultValue) {
return super.getParameter(key, defaultValue);
}
@Override
public byte getParameter(String key, byte defaultValue) {
return super.getParameter(key, defaultValue);
}
@Override
public float getPositiveParameter(String key, float defaultValue) {
return super.getPositiveParameter(key, defaultValue);
}
@Override
public double getPositiveParameter(String key, double defaultValue) {
return super.getPositiveParameter(key, defaultValue);
}
@Override
public long getPositiveParameter(String key, long defaultValue) {
return super.getPositiveParameter(key, defaultValue);
}
@Override
public int getPositiveParameter(String key, int defaultValue) {
return super.getPositiveParameter(key, defaultValue);
}
@Override
public short getPositiveParameter(String key, short defaultValue) {
return super.getPositiveParameter(key, defaultValue);
}
@Override
public byte getPositiveParameter(String key, byte defaultValue) {
return super.getPositiveParameter(key, defaultValue);
}
@Override
public char getParameter(String key, char defaultValue) {
return super.getParameter(key, defaultValue);
}
@Override
public boolean getParameter(String key, boolean defaultValue) {
return super.getParameter(key, defaultValue);
}
@Override
public boolean hasParameter(String key) {
return super.hasParameter(key);
}
@Override
public String getMethodParameterAndDecoded(String method, String key) {
return super.getMethodParameterAndDecoded(method, key);
}
@Override
public String getMethodParameterAndDecoded(String method, String key, String defaultValue) {
return super.getMethodParameterAndDecoded(method, key, defaultValue);
}
@Override
public String getMethodParameter(String method, String key) {
return super.getMethodParameter(method, key);
}
@Override
public String getMethodParameter(String method, String key, String defaultValue) {
return super.getMethodParameter(method, key, defaultValue);
}
@Override
public double getMethodParameter(String method, String key, double defaultValue) {
return super.getMethodParameter(method, key, defaultValue);
}
@Override
public float getMethodParameter(String method, String key, float defaultValue) {
return super.getMethodParameter(method, key, defaultValue);
}
@Override
public long getMethodParameter(String method, String key, long defaultValue) {
return super.getMethodParameter(method, key, defaultValue);
}
@Override
public int getMethodParameter(String method, String key, int defaultValue) {
return super.getMethodParameter(method, key, defaultValue);
}
@Override
public short getMethodParameter(String method, String key, short defaultValue) {
return super.getMethodParameter(method, key, defaultValue);
}
@Override
public byte getMethodParameter(String method, String key, byte defaultValue) {
return super.getMethodParameter(method, key, defaultValue);
}
@Override
public double getMethodPositiveParameter(String method, String key, double defaultValue) {
return super.getMethodPositiveParameter(method, key, defaultValue);
}
@Override
public float getMethodPositiveParameter(String method, String key, float defaultValue) {
return super.getMethodPositiveParameter(method, key, defaultValue);
}
@Override
public long getMethodPositiveParameter(String method, String key, long defaultValue) {
return super.getMethodPositiveParameter(method, key, defaultValue);
}
@Override
public int getMethodPositiveParameter(String method, String key, int defaultValue) {
return super.getMethodPositiveParameter(method, key, defaultValue);
}
@Override
public short getMethodPositiveParameter(String method, String key, short defaultValue) {
return super.getMethodPositiveParameter(method, key, defaultValue);
}
@Override
public byte getMethodPositiveParameter(String method, String key, byte defaultValue) {
return super.getMethodPositiveParameter(method, key, defaultValue);
}
@Override
public char getMethodParameter(String method, String key, char defaultValue) {
return super.getMethodParameter(method, key, defaultValue);
}
@Override
public boolean getMethodParameter(String method, String key, boolean defaultValue) {
return super.getMethodParameter(method, key, defaultValue);
}
@Override
public boolean hasMethodParameter(String method, String key) {
return super.hasMethodParameter(method, key);
}
@Override
public boolean isLocalHost() {
return super.isLocalHost();
}
@Override
public boolean isAnyHost() {
return super.isAnyHost();
}
@Override
public URL addParameterAndEncoded(String key, String value) {
if (StringUtils.isEmpty(value)) {
return this;
}
return addParameter(key, encode(value));
}
@Override
public URL addParameter(String key, boolean value) {
return addParameter(key, String.valueOf(value));
}
@Override
public URL addParameter(String key, char value) {
return addParameter(key, String.valueOf(value));
}
@Override
public URL addParameter(String key, byte value) {
return addParameter(key, String.valueOf(value));
}
@Override
public URL addParameter(String key, short value) {
return addParameter(key, String.valueOf(value));
}
@Override
public URL addParameter(String key, int value) {
return addParameter(key, String.valueOf(value));
}
@Override
public URL addParameter(String key, long value) {
return addParameter(key, String.valueOf(value));
}
@Override
public URL addParameter(String key, float value) {
return addParameter(key, String.valueOf(value));
}
@Override
public URL addParameter(String key, double value) {
return addParameter(key, String.valueOf(value));
}
@Override
public URL addParameter(String key, Enum<?> value) {
if (value == null) {
return this;
}
return addParameter(key, String.valueOf(value));
}
@Override
public URL addParameter(String key, Number value) {
if (value == null) {
return this;
}
return addParameter(key, String.valueOf(value));
}
@Override
public URL addParameter(String key, CharSequence value) {
if (value == null || value.length() == 0) {
return this;
}
return addParameter(key, String.valueOf(value));
}
@Override
public URL addParameter(String key, String value) {
org.apache.dubbo.common.URL result = super.addParameter(key, value);
return new URL(result);
}
@Override
public URL addParameterIfAbsent(String key, String value) {
org.apache.dubbo.common.URL result = super.addParameterIfAbsent(key, value);
return new URL(result);
}
@Override
public URL addParameters(Map<String, String> parameters) {
org.apache.dubbo.common.URL result = super.addParameters(parameters);
return new URL(result);
}
@Override
public URL addParametersIfAbsent(Map<String, String> parameters) {
org.apache.dubbo.common.URL result = super.addParametersIfAbsent(parameters);
return new URL(result);
}
@Override
public URL addParameters(String... pairs) {
org.apache.dubbo.common.URL result = super.addParameters(pairs);
return new URL(result);
}
@Override
public URL addParameterString(String query) {
org.apache.dubbo.common.URL result = super.addParameterString(query);
return new URL(result);
}
@Override
public URL removeParameter(String key) {
org.apache.dubbo.common.URL result = super.removeParameter(key);
return new URL(result);
}
@Override
public URL removeParameters(Collection<String> keys) {
org.apache.dubbo.common.URL result = super.removeParameters(keys);
return new URL(result);
}
@Override
public URL removeParameters(String... keys) {
org.apache.dubbo.common.URL result = super.removeParameters(keys);
return new URL(result);
}
@Override
public URL clearParameters() {
org.apache.dubbo.common.URL result = super.clearParameters();
return new URL(result);
}
@Override
public String getRawParameter(String key) {
return super.getRawParameter(key);
}
@Override
public Map<String, String> toMap() {
return super.toMap();
}
@Override
public String toString() {
return super.toString();
}
@Override
public String toString(String... parameters) {
return super.toString(parameters);
}
@Override
public String toIdentityString() {
return super.toIdentityString();
}
@Override
public String toIdentityString(String... parameters) {
return super.toIdentityString(parameters);
}
@Override
public String toFullString() {
return super.toFullString();
}
@Override
public String toFullString(String... parameters) {
return super.toFullString(parameters);
}
@Override
public String toParameterString() {
return super.toParameterString();
}
@Override
public String toParameterString(String... parameters) {
return super.toParameterString(parameters);
}
@Override
public java.net.URL toJavaURL() {
return super.toJavaURL();
}
@Override
public InetSocketAddress toInetSocketAddress() {
return super.toInetSocketAddress();
}
@Override
public String getServiceKey() {
return super.getServiceKey();
}
@Override
public String toServiceStringWithoutResolving() {
return super.toServiceStringWithoutResolving();
}
@Override
public String toServiceString() {
return super.toServiceString();
}
@Override
public String getServiceInterface() {
return super.getServiceInterface();
}
@Override
public URL setServiceInterface(String service) {
org.apache.dubbo.common.URL result = super.setServiceInterface(service);
return new URL(result);
}
public org.apache.dubbo.common.URL getOriginalURL() {
return new org.apache.dubbo.common.URL(
super.getProtocol(),
super.getUsername(),
super.getPassword(),
super.getHost(),
super.getPort(),
super.getPath(),
super.getParameters());
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/DelegateURL.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/common/DelegateURL.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.common;
import org.apache.dubbo.common.config.Configuration;
import org.apache.dubbo.common.url.component.URLAddress;
import org.apache.dubbo.common.url.component.URLParam;
import org.apache.dubbo.rpc.model.ApplicationModel;
import org.apache.dubbo.rpc.model.FrameworkModel;
import org.apache.dubbo.rpc.model.ModuleModel;
import org.apache.dubbo.rpc.model.ScopeModel;
import org.apache.dubbo.rpc.model.ServiceModel;
import java.net.InetSocketAddress;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.function.Predicate;
@Deprecated
public class DelegateURL extends com.alibaba.dubbo.common.URL {
protected final org.apache.dubbo.common.URL apacheUrl;
public DelegateURL(org.apache.dubbo.common.URL apacheUrl) {
this.apacheUrl = apacheUrl;
}
public static com.alibaba.dubbo.common.URL valueOf(String url) {
return new DelegateURL(org.apache.dubbo.common.URL.valueOf(url));
}
@Override
public String getProtocol() {
return apacheUrl.getProtocol();
}
@Override
public com.alibaba.dubbo.common.URL setProtocol(String protocol) {
return new DelegateURL(apacheUrl.setProtocol(protocol));
}
@Override
public String getUsername() {
return apacheUrl.getUsername();
}
@Override
public com.alibaba.dubbo.common.URL setUsername(String username) {
return new DelegateURL(apacheUrl.setUsername(username));
}
@Override
public String getPassword() {
return apacheUrl.getPassword();
}
@Override
public com.alibaba.dubbo.common.URL setPassword(String password) {
return new DelegateURL(apacheUrl.setPassword(password));
}
@Override
public String getAuthority() {
return apacheUrl.getAuthority();
}
@Override
public String getHost() {
return apacheUrl.getHost();
}
@Override
public com.alibaba.dubbo.common.URL setHost(String host) {
return new DelegateURL(apacheUrl.setHost(host));
}
@Override
public String getIp() {
return apacheUrl.getIp();
}
@Override
public int getPort() {
return apacheUrl.getPort();
}
@Override
public com.alibaba.dubbo.common.URL setPort(int port) {
return new DelegateURL(apacheUrl.setPort(port));
}
@Override
public int getPort(int defaultPort) {
return apacheUrl.getPort(defaultPort);
}
@Override
public String getAddress() {
return apacheUrl.getAddress();
}
@Override
public com.alibaba.dubbo.common.URL setAddress(String address) {
return new DelegateURL(apacheUrl.setAddress(address));
}
@Override
public String getBackupAddress() {
return apacheUrl.getBackupAddress();
}
@Override
public String getBackupAddress(int defaultPort) {
return apacheUrl.getBackupAddress(defaultPort);
}
@Override
public String getPath() {
return apacheUrl.getPath();
}
@Override
public com.alibaba.dubbo.common.URL setPath(String path) {
return new DelegateURL(apacheUrl.setPath(path));
}
@Override
public String getAbsolutePath() {
return apacheUrl.getAbsolutePath();
}
@Override
public Map<String, String> getParameters() {
return apacheUrl.getParameters();
}
@Override
public String getParameterAndDecoded(String key) {
return apacheUrl.getParameterAndDecoded(key);
}
@Override
public String getParameterAndDecoded(String key, String defaultValue) {
return apacheUrl.getParameterAndDecoded(key, defaultValue);
}
@Override
public String getParameter(String key) {
return apacheUrl.getParameter(key);
}
@Override
public String getParameter(String key, String defaultValue) {
return apacheUrl.getParameter(key, defaultValue);
}
@Override
public String[] getParameter(String key, String[] defaultValue) {
return apacheUrl.getParameter(key, defaultValue);
}
@Override
public com.alibaba.dubbo.common.URL getUrlParameter(String key) {
return new DelegateURL(apacheUrl.getUrlParameter(key));
}
@Override
public double getParameter(String key, double defaultValue) {
return apacheUrl.getParameter(key, defaultValue);
}
@Override
public float getParameter(String key, float defaultValue) {
return apacheUrl.getParameter(key, defaultValue);
}
@Override
public long getParameter(String key, long defaultValue) {
return apacheUrl.getParameter(key, defaultValue);
}
@Override
public int getParameter(String key, int defaultValue) {
return apacheUrl.getParameter(key, defaultValue);
}
@Override
public short getParameter(String key, short defaultValue) {
return apacheUrl.getParameter(key, defaultValue);
}
@Override
public byte getParameter(String key, byte defaultValue) {
return apacheUrl.getParameter(key, defaultValue);
}
@Override
public float getPositiveParameter(String key, float defaultValue) {
return apacheUrl.getPositiveParameter(key, defaultValue);
}
@Override
public double getPositiveParameter(String key, double defaultValue) {
return apacheUrl.getPositiveParameter(key, defaultValue);
}
@Override
public long getPositiveParameter(String key, long defaultValue) {
return apacheUrl.getPositiveParameter(key, defaultValue);
}
@Override
public int getPositiveParameter(String key, int defaultValue) {
return apacheUrl.getPositiveParameter(key, defaultValue);
}
@Override
public short getPositiveParameter(String key, short defaultValue) {
return apacheUrl.getPositiveParameter(key, defaultValue);
}
@Override
public byte getPositiveParameter(String key, byte defaultValue) {
return apacheUrl.getPositiveParameter(key, defaultValue);
}
@Override
public char getParameter(String key, char defaultValue) {
return apacheUrl.getParameter(key, defaultValue);
}
@Override
public boolean getParameter(String key, boolean defaultValue) {
return apacheUrl.getParameter(key, defaultValue);
}
@Override
public boolean hasParameter(String key) {
return apacheUrl.hasParameter(key);
}
@Override
public String getMethodParameterAndDecoded(String method, String key) {
return apacheUrl.getMethodParameterAndDecoded(method, key);
}
@Override
public String getMethodParameterAndDecoded(String method, String key, String defaultValue) {
return apacheUrl.getMethodParameterAndDecoded(method, key, defaultValue);
}
@Override
public String getMethodParameter(String method, String key) {
return apacheUrl.getMethodParameter(method, key);
}
@Override
public String getMethodParameter(String method, String key, String defaultValue) {
return apacheUrl.getMethodParameter(method, key, defaultValue);
}
@Override
public double getMethodParameter(String method, String key, double defaultValue) {
return apacheUrl.getMethodParameter(method, key, defaultValue);
}
@Override
public float getMethodParameter(String method, String key, float defaultValue) {
return apacheUrl.getMethodParameter(method, key, defaultValue);
}
@Override
public long getMethodParameter(String method, String key, long defaultValue) {
return apacheUrl.getMethodParameter(method, key, defaultValue);
}
@Override
public int getMethodParameter(String method, String key, int defaultValue) {
return apacheUrl.getMethodParameter(method, key, defaultValue);
}
@Override
public short getMethodParameter(String method, String key, short defaultValue) {
return apacheUrl.getMethodParameter(method, key, defaultValue);
}
@Override
public byte getMethodParameter(String method, String key, byte defaultValue) {
return apacheUrl.getMethodParameter(method, key, defaultValue);
}
@Override
public double getMethodPositiveParameter(String method, String key, double defaultValue) {
return apacheUrl.getMethodPositiveParameter(method, key, defaultValue);
}
@Override
public float getMethodPositiveParameter(String method, String key, float defaultValue) {
return apacheUrl.getMethodPositiveParameter(method, key, defaultValue);
}
@Override
public long getMethodPositiveParameter(String method, String key, long defaultValue) {
return apacheUrl.getMethodPositiveParameter(method, key, defaultValue);
}
@Override
public int getMethodPositiveParameter(String method, String key, int defaultValue) {
return apacheUrl.getMethodPositiveParameter(method, key, defaultValue);
}
@Override
public short getMethodPositiveParameter(String method, String key, short defaultValue) {
return apacheUrl.getMethodPositiveParameter(method, key, defaultValue);
}
@Override
public byte getMethodPositiveParameter(String method, String key, byte defaultValue) {
return apacheUrl.getMethodPositiveParameter(method, key, defaultValue);
}
@Override
public char getMethodParameter(String method, String key, char defaultValue) {
return apacheUrl.getMethodParameter(method, key, defaultValue);
}
@Override
public boolean getMethodParameter(String method, String key, boolean defaultValue) {
return apacheUrl.getMethodParameter(method, key, defaultValue);
}
@Override
public boolean hasMethodParameter(String method, String key) {
return apacheUrl.hasMethodParameter(method, key);
}
@Override
public boolean isLocalHost() {
return apacheUrl.isLocalHost();
}
@Override
public boolean isAnyHost() {
return apacheUrl.isAnyHost();
}
@Override
public com.alibaba.dubbo.common.URL addParameterAndEncoded(String key, String value) {
return new DelegateURL(apacheUrl.addParameterAndEncoded(key, value));
}
@Override
public com.alibaba.dubbo.common.URL addParameter(String key, boolean value) {
return new DelegateURL(apacheUrl.addParameter(key, value));
}
@Override
public com.alibaba.dubbo.common.URL addParameter(String key, char value) {
return new DelegateURL(apacheUrl.addParameter(key, value));
}
@Override
public com.alibaba.dubbo.common.URL addParameter(String key, byte value) {
return new DelegateURL(apacheUrl.addParameter(key, value));
}
@Override
public com.alibaba.dubbo.common.URL addParameter(String key, short value) {
return new DelegateURL(apacheUrl.addParameter(key, value));
}
@Override
public com.alibaba.dubbo.common.URL addParameter(String key, int value) {
return new DelegateURL(apacheUrl.addParameter(key, value));
}
@Override
public com.alibaba.dubbo.common.URL addParameter(String key, long value) {
return new DelegateURL(apacheUrl.addParameter(key, value));
}
@Override
public com.alibaba.dubbo.common.URL addParameter(String key, float value) {
return new DelegateURL(apacheUrl.addParameter(key, value));
}
@Override
public com.alibaba.dubbo.common.URL addParameter(String key, double value) {
return new DelegateURL(apacheUrl.addParameter(key, value));
}
@Override
public com.alibaba.dubbo.common.URL addParameter(String key, Enum<?> value) {
return new DelegateURL(apacheUrl.addParameter(key, value));
}
@Override
public com.alibaba.dubbo.common.URL addParameter(String key, Number value) {
return new DelegateURL(apacheUrl.addParameter(key, value));
}
@Override
public com.alibaba.dubbo.common.URL addParameter(String key, CharSequence value) {
return new DelegateURL(apacheUrl.addParameter(key, value));
}
@Override
public com.alibaba.dubbo.common.URL addParameter(String key, String value) {
return new DelegateURL(apacheUrl.addParameter(key, value));
}
@Override
public com.alibaba.dubbo.common.URL addParameterIfAbsent(String key, String value) {
return new DelegateURL(apacheUrl.addParameterIfAbsent(key, value));
}
@Override
public com.alibaba.dubbo.common.URL addParameters(Map<String, String> parameters) {
return new DelegateURL(apacheUrl.addParameters(parameters));
}
@Override
public com.alibaba.dubbo.common.URL addParametersIfAbsent(Map<String, String> parameters) {
return new DelegateURL(apacheUrl.addParametersIfAbsent(parameters));
}
@Override
public com.alibaba.dubbo.common.URL addParameters(String... pairs) {
return new DelegateURL(apacheUrl.addParameters(pairs));
}
@Override
public com.alibaba.dubbo.common.URL addParameterString(String query) {
return new DelegateURL(apacheUrl.addParameterString(query));
}
@Override
public com.alibaba.dubbo.common.URL removeParameter(String key) {
return new DelegateURL(apacheUrl.removeParameter(key));
}
@Override
public com.alibaba.dubbo.common.URL removeParameters(Collection<String> keys) {
return new DelegateURL(apacheUrl.removeParameters(keys));
}
@Override
public com.alibaba.dubbo.common.URL removeParameters(String... keys) {
return new DelegateURL(apacheUrl.removeParameters(keys));
}
@Override
public com.alibaba.dubbo.common.URL clearParameters() {
return new DelegateURL(apacheUrl.clearParameters());
}
@Override
public String getRawParameter(String key) {
return apacheUrl.getRawParameter(key);
}
@Override
public Map<String, String> toMap() {
return apacheUrl.toMap();
}
@Override
public String toString() {
return apacheUrl.toString();
}
@Override
public String toString(String... parameters) {
return apacheUrl.toString(parameters);
}
@Override
public String toIdentityString() {
return apacheUrl.toIdentityString();
}
@Override
public String toIdentityString(String... parameters) {
return apacheUrl.toIdentityString(parameters);
}
@Override
public String toFullString() {
return apacheUrl.toFullString();
}
@Override
public String toFullString(String... parameters) {
return apacheUrl.toFullString(parameters);
}
@Override
public String toParameterString() {
return apacheUrl.toParameterString();
}
@Override
public String toParameterString(String... parameters) {
return apacheUrl.toParameterString(parameters);
}
@Override
public java.net.URL toJavaURL() {
return apacheUrl.toJavaURL();
}
@Override
public InetSocketAddress toInetSocketAddress() {
return apacheUrl.toInetSocketAddress();
}
@Override
public String getServiceKey() {
return apacheUrl.getServiceKey();
}
@Override
public String toServiceStringWithoutResolving() {
return apacheUrl.toServiceStringWithoutResolving();
}
@Override
public String toServiceString() {
return apacheUrl.toServiceString();
}
@Override
public String getServiceInterface() {
return apacheUrl.getServiceInterface();
}
@Override
public com.alibaba.dubbo.common.URL setServiceInterface(String service) {
return new DelegateURL(apacheUrl.setServiceInterface(service));
}
@Override
public org.apache.dubbo.common.URL getOriginalURL() {
return apacheUrl;
}
@Override
public URLAddress getUrlAddress() {
return apacheUrl.getUrlAddress();
}
@Override
public URLParam getUrlParam() {
return apacheUrl.getUrlParam();
}
@Override
public String getUserInformation() {
return apacheUrl.getUserInformation();
}
@Override
public List<org.apache.dubbo.common.URL> getBackupUrls() {
return apacheUrl.getBackupUrls();
}
@Override
public Map<String, String> getOriginalParameters() {
return apacheUrl.getOriginalParameters();
}
@Override
public Map<String, String> getAllParameters() {
return apacheUrl.getAllParameters();
}
@Override
public Map<String, String> getParameters(Predicate<String> nameToSelect) {
return apacheUrl.getParameters(nameToSelect);
}
@Override
public String getOriginalParameter(String key) {
return apacheUrl.getOriginalParameter(key);
}
@Override
public List<String> getParameter(String key, List<String> defaultValue) {
return apacheUrl.getParameter(key, defaultValue);
}
@Override
public <T> T getParameter(String key, Class<T> valueType) {
return apacheUrl.getParameter(key, valueType);
}
@Override
public <T> T getParameter(String key, Class<T> valueType, T defaultValue) {
return apacheUrl.getParameter(key, valueType, defaultValue);
}
@Override
public org.apache.dubbo.common.URL setScopeModel(ScopeModel scopeModel) {
return apacheUrl.setScopeModel(scopeModel);
}
@Override
public ScopeModel getScopeModel() {
return apacheUrl.getScopeModel();
}
@Override
public FrameworkModel getOrDefaultFrameworkModel() {
return apacheUrl.getOrDefaultFrameworkModel();
}
@Override
public ApplicationModel getOrDefaultApplicationModel() {
return apacheUrl.getOrDefaultApplicationModel();
}
@Override
public ApplicationModel getApplicationModel() {
return apacheUrl.getApplicationModel();
}
@Override
public ModuleModel getOrDefaultModuleModel() {
return apacheUrl.getOrDefaultModuleModel();
}
@Override
public org.apache.dubbo.common.URL setServiceModel(ServiceModel serviceModel) {
return apacheUrl.setServiceModel(serviceModel);
}
@Override
public ServiceModel getServiceModel() {
return apacheUrl.getServiceModel();
}
@Override
public String getMethodParameterStrict(String method, String key) {
return apacheUrl.getMethodParameterStrict(method, key);
}
@Override
public String getAnyMethodParameter(String key) {
return apacheUrl.getAnyMethodParameter(key);
}
@Override
public boolean hasMethodParameter(String method) {
return apacheUrl.hasMethodParameter(method);
}
@Override
public Map<String, String> toOriginalMap() {
return apacheUrl.toOriginalMap();
}
@Override
public String getColonSeparatedKey() {
return apacheUrl.getColonSeparatedKey();
}
@Override
public String getDisplayServiceKey() {
return apacheUrl.getDisplayServiceKey();
}
@Override
public String getPathKey() {
return apacheUrl.getPathKey();
}
public static String buildKey(String path, String group, String version) {
return org.apache.dubbo.common.URL.buildKey(path, group, version);
}
@Override
public String getProtocolServiceKey() {
return apacheUrl.getProtocolServiceKey();
}
@Override
@Deprecated
public String getServiceName() {
return apacheUrl.getServiceName();
}
@Override
@Deprecated
public int getIntParameter(String key) {
return apacheUrl.getIntParameter(key);
}
@Override
@Deprecated
public int getIntParameter(String key, int defaultValue) {
return apacheUrl.getIntParameter(key, defaultValue);
}
@Override
@Deprecated
public int getPositiveIntParameter(String key, int defaultValue) {
return apacheUrl.getPositiveIntParameter(key, defaultValue);
}
@Override
@Deprecated
public boolean getBooleanParameter(String key) {
return apacheUrl.getBooleanParameter(key);
}
@Override
@Deprecated
public boolean getBooleanParameter(String key, boolean defaultValue) {
return apacheUrl.getBooleanParameter(key, defaultValue);
}
@Override
@Deprecated
public int getMethodIntParameter(String method, String key) {
return apacheUrl.getMethodIntParameter(method, key);
}
@Override
@Deprecated
public int getMethodIntParameter(String method, String key, int defaultValue) {
return apacheUrl.getMethodIntParameter(method, key, defaultValue);
}
@Override
@Deprecated
public int getMethodPositiveIntParameter(String method, String key, int defaultValue) {
return apacheUrl.getMethodPositiveIntParameter(method, key, defaultValue);
}
@Override
@Deprecated
public boolean getMethodBooleanParameter(String method, String key) {
return apacheUrl.getMethodBooleanParameter(method, key);
}
@Override
@Deprecated
public boolean getMethodBooleanParameter(String method, String key, boolean defaultValue) {
return apacheUrl.getMethodBooleanParameter(method, key, defaultValue);
}
@Override
public Configuration toConfiguration() {
return apacheUrl.toConfiguration();
}
@Override
public int hashCode() {
return apacheUrl.hashCode();
}
@Override
public boolean equals(Object obj) {
return apacheUrl.equals(obj);
}
public static void putMethodParameter(
String method, String key, String value, Map<String, Map<String, String>> methodParameters) {
org.apache.dubbo.common.URL.putMethodParameter(method, key, value, methodParameters);
}
@Override
public String getApplication(String defaultValue) {
return apacheUrl.getApplication(defaultValue);
}
@Override
public String getApplication() {
return apacheUrl.getApplication();
}
@Override
public String getRemoteApplication() {
return apacheUrl.getRemoteApplication();
}
@Override
public String getGroup() {
return apacheUrl.getGroup();
}
@Override
public String getGroup(String defaultValue) {
return apacheUrl.getGroup(defaultValue);
}
@Override
public String getVersion() {
return apacheUrl.getVersion();
}
@Override
public String getVersion(String defaultValue) {
return apacheUrl.getVersion(defaultValue);
}
@Override
public String getConcatenatedParameter(String key) {
return apacheUrl.getConcatenatedParameter(key);
}
@Override
public String getCategory(String defaultValue) {
return apacheUrl.getCategory(defaultValue);
}
@Override
public String[] getCategory(String[] defaultValue) {
return apacheUrl.getCategory(defaultValue);
}
@Override
public String getCategory() {
return apacheUrl.getCategory();
}
@Override
public String getSide(String defaultValue) {
return apacheUrl.getSide(defaultValue);
}
@Override
public String getSide() {
return apacheUrl.getSide();
}
@Override
public Map<String, Object> getAttributes() {
return apacheUrl.getAttributes();
}
@Override
public org.apache.dubbo.common.URL addAttributes(Map<String, Object> attributeMap) {
return apacheUrl.addAttributes(attributeMap);
}
@Override
public Object getAttribute(String key) {
return apacheUrl.getAttribute(key);
}
@Override
public Object getAttribute(String key, Object defaultValue) {
return apacheUrl.getAttribute(key, defaultValue);
}
@Override
public org.apache.dubbo.common.URL putAttribute(String key, Object obj) {
return apacheUrl.putAttribute(key, obj);
}
@Override
public org.apache.dubbo.common.URL removeAttribute(String key) {
return apacheUrl.removeAttribute(key);
}
@Override
public boolean hasAttribute(String key) {
return apacheUrl.hasAttribute(key);
}
@Override
public Map<String, String> getOriginalServiceParameters(String service) {
return apacheUrl.getOriginalServiceParameters(service);
}
@Override
public Map<String, String> getServiceParameters(String service) {
return apacheUrl.getServiceParameters(service);
}
@Override
public String getOriginalServiceParameter(String service, String key) {
return apacheUrl.getOriginalServiceParameter(service, key);
}
@Override
public String getServiceParameter(String service, String key) {
return apacheUrl.getServiceParameter(service, key);
}
@Override
public String getServiceParameter(String service, String key, String defaultValue) {
return apacheUrl.getServiceParameter(service, key, defaultValue);
}
@Override
public int getServiceParameter(String service, String key, int defaultValue) {
return apacheUrl.getServiceParameter(service, key, defaultValue);
}
@Override
public double getServiceParameter(String service, String key, double defaultValue) {
return apacheUrl.getServiceParameter(service, key, defaultValue);
}
@Override
public float getServiceParameter(String service, String key, float defaultValue) {
return apacheUrl.getServiceParameter(service, key, defaultValue);
}
@Override
public long getServiceParameter(String service, String key, long defaultValue) {
return apacheUrl.getServiceParameter(service, key, defaultValue);
}
@Override
public short getServiceParameter(String service, String key, short defaultValue) {
return apacheUrl.getServiceParameter(service, key, defaultValue);
}
@Override
public byte getServiceParameter(String service, String key, byte defaultValue) {
return apacheUrl.getServiceParameter(service, key, defaultValue);
}
@Override
public char getServiceParameter(String service, String key, char defaultValue) {
return apacheUrl.getServiceParameter(service, key, defaultValue);
}
@Override
public boolean getServiceParameter(String service, String key, boolean defaultValue) {
return apacheUrl.getServiceParameter(service, key, defaultValue);
}
@Override
public boolean hasServiceParameter(String service, String key) {
return apacheUrl.hasServiceParameter(service, key);
}
@Override
public float getPositiveServiceParameter(String service, String key, float defaultValue) {
return apacheUrl.getPositiveServiceParameter(service, key, defaultValue);
}
@Override
public double getPositiveServiceParameter(String service, String key, double defaultValue) {
return apacheUrl.getPositiveServiceParameter(service, key, defaultValue);
}
@Override
public long getPositiveServiceParameter(String service, String key, long defaultValue) {
return apacheUrl.getPositiveServiceParameter(service, key, defaultValue);
}
@Override
public int getPositiveServiceParameter(String service, String key, int defaultValue) {
return apacheUrl.getPositiveServiceParameter(service, key, defaultValue);
}
@Override
public short getPositiveServiceParameter(String service, String key, short defaultValue) {
return apacheUrl.getPositiveServiceParameter(service, key, defaultValue);
}
@Override
public byte getPositiveServiceParameter(String service, String key, byte defaultValue) {
return apacheUrl.getPositiveServiceParameter(service, key, defaultValue);
}
@Override
public String getServiceMethodParameterAndDecoded(String service, String method, String key) {
return apacheUrl.getServiceMethodParameterAndDecoded(service, method, key);
}
@Override
public String getServiceMethodParameterAndDecoded(String service, String method, String key, String defaultValue) {
return apacheUrl.getServiceMethodParameterAndDecoded(service, method, key, defaultValue);
}
@Override
public String getServiceMethodParameterStrict(String service, String method, String key) {
return apacheUrl.getServiceMethodParameterStrict(service, method, key);
}
@Override
public String getServiceMethodParameter(String service, String method, String key) {
return apacheUrl.getServiceMethodParameter(service, method, key);
}
@Override
public String getServiceMethodParameter(String service, String method, String key, String defaultValue) {
return apacheUrl.getServiceMethodParameter(service, method, key, defaultValue);
}
@Override
public double getServiceMethodParameter(String service, String method, String key, double defaultValue) {
return apacheUrl.getServiceMethodParameter(service, method, key, defaultValue);
}
@Override
public float getServiceMethodParameter(String service, String method, String key, float defaultValue) {
return apacheUrl.getServiceMethodParameter(service, method, key, defaultValue);
}
@Override
public long getServiceMethodParameter(String service, String method, String key, long defaultValue) {
return apacheUrl.getServiceMethodParameter(service, method, key, defaultValue);
}
@Override
public int getServiceMethodParameter(String service, String method, String key, int defaultValue) {
return apacheUrl.getServiceMethodParameter(service, method, key, defaultValue);
}
@Override
public short getServiceMethodParameter(String service, String method, String key, short defaultValue) {
return apacheUrl.getServiceMethodParameter(service, method, key, defaultValue);
}
@Override
public byte getServiceMethodParameter(String service, String method, String key, byte defaultValue) {
return apacheUrl.getServiceMethodParameter(service, method, key, defaultValue);
}
@Override
public boolean hasServiceMethodParameter(String service, String method, String key) {
return apacheUrl.hasServiceMethodParameter(service, method, key);
}
@Override
public boolean hasServiceMethodParameter(String service, String method) {
return apacheUrl.hasServiceMethodParameter(service, method);
}
@Override
public org.apache.dubbo.common.URL toSerializableURL() {
return apacheUrl.toSerializableURL();
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/Constants.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/common/Constants.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.common;
import org.apache.dubbo.common.constants.CommonConstants;
import org.apache.dubbo.common.constants.FilterConstants;
import org.apache.dubbo.common.constants.QosConstants;
import org.apache.dubbo.common.constants.RegistryConstants;
import org.apache.dubbo.common.constants.RemotingConstants;
import java.util.concurrent.ExecutorService;
import java.util.regex.Pattern;
@Deprecated
public class Constants
implements CommonConstants,
QosConstants,
FilterConstants,
RegistryConstants,
RemotingConstants,
org.apache.dubbo.config.Constants,
org.apache.dubbo.remoting.Constants,
org.apache.dubbo.rpc.cluster.Constants,
org.apache.dubbo.monitor.Constants,
org.apache.dubbo.rpc.Constants,
org.apache.dubbo.rpc.protocol.dubbo.Constants,
org.apache.dubbo.common.serialize.Constants,
org.apache.dubbo.common.config.configcenter.Constants,
org.apache.dubbo.metadata.report.support.Constants,
org.apache.dubbo.registry.Constants {
public static final String PROVIDER = "provider";
public static final String CONSUMER = "consumer";
public static final String REGISTER = "register";
public static final String UNREGISTER = "unregister";
public static final String SUBSCRIBE = "subscribe";
public static final String UNSUBSCRIBE = "unsubscribe";
public static final String CATEGORY_KEY = "category";
public static final String PROVIDERS_CATEGORY = "providers";
public static final String CONSUMERS_CATEGORY = "consumers";
public static final String ROUTERS_CATEGORY = "routers";
public static final String CONFIGURATORS_CATEGORY = "configurators";
public static final String DEFAULT_CATEGORY = PROVIDERS_CATEGORY;
public static final String ENABLED_KEY = "enabled";
public static final String DISABLED_KEY = "disabled";
public static final String VALIDATION_KEY = "validation";
public static final String CACHE_KEY = "cache";
public static final String DYNAMIC_KEY = "dynamic";
public static final String DUBBO_PROPERTIES_KEY = "dubbo.properties.file";
public static final String DEFAULT_DUBBO_PROPERTIES = "dubbo.properties";
public static final String SENT_KEY = "sent";
public static final boolean DEFAULT_SENT = false;
public static final String REGISTRY_PROTOCOL = "registry";
public static final String $INVOKE = "$invoke";
public static final String $ECHO = "$echo";
public static final int DEFAULT_IO_THREADS = Runtime.getRuntime().availableProcessors() + 1;
public static final String DEFAULT_PROXY = "javassist";
public static final int DEFAULT_PAYLOAD = 8 * 1024 * 1024;
public static final String DEFAULT_CLUSTER = "failover";
public static final String DEFAULT_DIRECTORY = "dubbo";
public static final String DEFAULT_LOADBALANCE = "random";
public static final String DEFAULT_PROTOCOL = "dubbo";
public static final String DEFAULT_EXCHANGER = "header";
public static final String DEFAULT_TRANSPORTER = "netty";
public static final String DEFAULT_REMOTING_SERVER = "netty";
public static final String DEFAULT_REMOTING_CLIENT = "netty";
public static final String DEFAULT_REMOTING_CODEC = "dubbo";
public static final String DEFAULT_REMOTING_SERIALIZATION = "hessian2";
public static final String DEFAULT_HTTP_SERVER = "servlet";
public static final String DEFAULT_HTTP_CLIENT = "jdk";
public static final String DEFAULT_HTTP_SERIALIZATION = "json";
public static final String DEFAULT_CHARSET = "UTF-8";
public static final int DEFAULT_WEIGHT = 100;
public static final int DEFAULT_FORKS = 2;
public static final String DEFAULT_THREAD_NAME = "Dubbo";
public static final int DEFAULT_CORE_THREADS = 0;
public static final int DEFAULT_THREADS = 200;
public static final int DEFAULT_QUEUES = 0;
public static final int DEFAULT_ALIVE = 60 * 1000;
public static final int DEFAULT_CONNECTIONS = 0;
public static final int DEFAULT_ACCEPTS = 0;
public static final int DEFAULT_IDLE_TIMEOUT = 600 * 1000;
public static final int DEFAULT_HEARTBEAT = 60 * 1000;
public static final int DEFAULT_TIMEOUT = 1000;
public static final int DEFAULT_CONNECT_TIMEOUT = 3000;
public static final int DEFAULT_RETRIES = 2;
public static final int DEFAULT_BUFFER_SIZE = 8 * 1024;
public static final int MAX_BUFFER_SIZE = 16 * 1024;
public static final int MIN_BUFFER_SIZE = 1 * 1024;
public static final String REMOVE_VALUE_PREFIX = "-";
public static final String HIDE_KEY_PREFIX = ".";
public static final String DEFAULT_KEY_PREFIX = "default.";
public static final String DEFAULT_KEY = "default";
public static final String LOADBALANCE_KEY = "loadbalance";
public static final String ROUTER_KEY = "router";
public static final String CLUSTER_KEY = "cluster";
public static final String REGISTRY_KEY = "registry";
public static final String MONITOR_KEY = "monitor";
public static final String SIDE_KEY = "side";
public static final String PROVIDER_SIDE = "provider";
public static final String CONSUMER_SIDE = "consumer";
public static final String DEFAULT_REGISTRY = "dubbo";
public static final String BACKUP_KEY = "backup";
public static final String DIRECTORY_KEY = "directory";
public static final String DEPRECATED_KEY = "deprecated";
public static final String ANYHOST_KEY = "anyhost";
public static final String ANYHOST_VALUE = "0.0.0.0";
public static final String LOCALHOST_KEY = "localhost";
public static final String LOCALHOST_VALUE = "127.0.0.1";
public static final String APPLICATION_KEY = "application";
public static final String LOCAL_KEY = "local";
public static final String STUB_KEY = "stub";
public static final String MOCK_KEY = "mock";
public static final String PROTOCOL_KEY = "protocol";
public static final String PROXY_KEY = "proxy";
public static final String WEIGHT_KEY = "weight";
public static final String FORKS_KEY = "forks";
public static final String DEFAULT_THREADPOOL = "limited";
public static final String DEFAULT_CLIENT_THREADPOOL = "cached";
public static final String THREADPOOL_KEY = "threadpool";
public static final String THREAD_NAME_KEY = "threadname";
public static final String IO_THREADS_KEY = "iothreads";
public static final String CORE_THREADS_KEY = "corethreads";
public static final String THREADS_KEY = "threads";
public static final String QUEUES_KEY = "queues";
public static final String ALIVE_KEY = "alive";
public static final String EXECUTES_KEY = "executes";
public static final String BUFFER_KEY = "buffer";
public static final String PAYLOAD_KEY = "payload";
public static final String REFERENCE_FILTER_KEY = "reference.filter";
public static final String INVOKER_LISTENER_KEY = "invoker.listener";
public static final String SERVICE_FILTER_KEY = "service.filter";
public static final String EXPORTER_LISTENER_KEY = "exporter.listener";
public static final String ACCESS_LOG_KEY = "accesslog";
public static final String ACTIVES_KEY = "actives";
public static final String CONNECTIONS_KEY = "connections";
public static final String ACCEPTS_KEY = "accepts";
public static final String IDLE_TIMEOUT_KEY = "idle.timeout";
public static final String HEARTBEAT_KEY = "heartbeat";
public static final String HEARTBEAT_TIMEOUT_KEY = "heartbeat.timeout";
public static final String CONNECT_TIMEOUT_KEY = "connect.timeout";
public static final String TIMEOUT_KEY = "timeout";
public static final String RETRIES_KEY = "retries";
public static final String PROMPT_KEY = "prompt";
public static final String DEFAULT_PROMPT = "dubbo>";
public static final String CODEC_KEY = "codec";
public static final String SERIALIZATION_KEY = "serialization";
public static final String EXCHANGER_KEY = "exchanger";
public static final String TRANSPORTER_KEY = "transporter";
public static final String SERVER_KEY = "server";
public static final String CLIENT_KEY = "client";
public static final String ID_KEY = "id";
public static final String ASYNC_KEY = "async";
public static final String RETURN_KEY = "return";
public static final String TOKEN_KEY = "token";
public static final String METHOD_KEY = "method";
public static final String METHODS_KEY = "methods";
public static final String CHARSET_KEY = "charset";
public static final String RECONNECT_KEY = "reconnect";
public static final String SEND_RECONNECT_KEY = "send.reconnect";
public static final int DEFAULT_RECONNECT_PERIOD = 2000;
public static final String SHUTDOWN_TIMEOUT_KEY = "shutdown.timeout";
public static final int DEFAULT_SHUTDOWN_TIMEOUT = 1000 * 60 * 15;
public static final String PID_KEY = "pid";
public static final String TIMESTAMP_KEY = "timestamp";
public static final String WARMUP_KEY = "warmup";
public static final int DEFAULT_WARMUP = 10 * 60 * 1000;
public static final String CHECK_KEY = "check";
public static final String REGISTER_KEY = "register";
public static final String SUBSCRIBE_KEY = "subscribe";
public static final String GROUP_KEY = "group";
public static final String PATH_KEY = "path";
public static final String INTERFACE_KEY = "interface";
public static final String GENERIC_KEY = "generic";
public static final String FILE_KEY = "file";
public static final String WAIT_KEY = "wait";
public static final String CLASSIFIER_KEY = "classifier";
public static final String VERSION_KEY = "version";
public static final String REVISION_KEY = "revision";
public static final String DUBBO_VERSION_KEY = "dubbo";
public static final String HESSIAN_VERSION_KEY = "hessian.version";
public static final String DISPATCHER_KEY = "dispatcher";
public static final String CHANNEL_HANDLER_KEY = "channel.handler";
public static final String DEFAULT_CHANNEL_HANDLER = "default";
public static final String ANY_VALUE = "*";
public static final String COMMA_SEPARATOR = ",";
public static final Pattern COMMA_SPLIT_PATTERN = Pattern.compile("\\s*[,]+\\s*");
public static final String PATH_SEPARATOR = "/";
public static final String REGISTRY_SEPARATOR = "|";
public static final Pattern REGISTRY_SPLIT_PATTERN = Pattern.compile("\\s*[|;]+\\s*");
public static final String SEMICOLON_SEPARATOR = ";";
public static final Pattern SEMICOLON_SPLIT_PATTERN = Pattern.compile("\\s*[;]+\\s*");
public static final String CONNECT_QUEUE_CAPACITY = "connect.queue.capacity";
public static final String CONNECT_QUEUE_WARNING_SIZE = "connect.queue.warning.size";
public static final int DEFAULT_CONNECT_QUEUE_WARNING_SIZE = 1000;
public static final String CHANNEL_ATTRIBUTE_READONLY_KEY = "channel.readonly";
public static final String CHANNEL_READONLYEVENT_SENT_KEY = "channel.readonly.sent";
public static final String CHANNEL_SEND_READONLYEVENT_KEY = "channel.readonly.send";
public static final String COUNT_PROTOCOL = "count";
public static final String TRACE_PROTOCOL = "trace";
public static final String EMPTY_PROTOCOL = "empty";
public static final String ADMIN_PROTOCOL = "admin";
public static final String PROVIDER_PROTOCOL = "provider";
public static final String CONSUMER_PROTOCOL = "consumer";
public static final String ROUTE_PROTOCOL = "route";
public static final String SCRIPT_PROTOCOL = "script";
public static final String CONDITION_PROTOCOL = "condition";
public static final String MOCK_PROTOCOL = "mock";
public static final String RETURN_PREFIX = "return ";
public static final String THROW_PREFIX = "throw";
public static final String FAIL_PREFIX = "fail:";
public static final String FORCE_PREFIX = "force:";
public static final String FORCE_KEY = "force";
public static final String MERGER_KEY = "merger";
public static final String CLUSTER_AVAILABLE_CHECK_KEY = "cluster.availablecheck";
public static final boolean DEFAULT_CLUSTER_AVAILABLE_CHECK = true;
public static final String CLUSTER_STICKY_KEY = "sticky";
public static final boolean DEFAULT_CLUSTER_STICKY = false;
public static final String LAZY_CONNECT_KEY = "lazy";
public static final String LAZY_CONNECT_INITIAL_STATE_KEY = "connect.lazy.initial.state";
public static final boolean DEFAULT_LAZY_CONNECT_INITIAL_STATE = true;
public static final String REGISTRY_FILESAVE_SYNC_KEY = "save.file";
public static final String REGISTRY_RETRY_PERIOD_KEY = "retry.period";
public static final int DEFAULT_REGISTRY_RETRY_PERIOD = 5 * 1000;
public static final String REGISTRY_RECONNECT_PERIOD_KEY = "reconnect.period";
public static final int DEFAULT_REGISTRY_RECONNECT_PERIOD = 3 * 1000;
public static final String SESSION_TIMEOUT_KEY = "session";
public static final int DEFAULT_SESSION_TIMEOUT = 60 * 1000;
public static final String EXPORT_KEY = "export";
public static final String REFER_KEY = "refer";
public static final String CALLBACK_SERVICE_KEY = "callback.service.instid";
public static final String CALLBACK_INSTANCES_LIMIT_KEY = "callbacks";
public static final int DEFAULT_CALLBACK_INSTANCES = 1;
public static final String CALLBACK_SERVICE_PROXY_KEY = "callback.service.proxy";
public static final String IS_CALLBACK_SERVICE = "is_callback_service";
public static final String CHANNEL_CALLBACK_KEY = "channel.callback.invokers.key";
@Deprecated
public static final String SHUTDOWN_WAIT_SECONDS_KEY = "dubbo.service.shutdown.wait.seconds";
public static final String SHUTDOWN_WAIT_KEY = "dubbo.service.shutdown.wait";
public static final String IS_SERVER_KEY = "isserver";
public static final int DEFAULT_SERVER_SHUTDOWN_TIMEOUT = 10000;
public static final String ON_CONNECT_KEY = "onconnect";
public static final String ON_DISCONNECT_KEY = "ondisconnect";
public static final String ON_INVOKE_METHOD_KEY = "oninvoke.method";
public static final String ON_RETURN_METHOD_KEY = "onreturn.method";
public static final String ON_THROW_METHOD_KEY = "onthrow.method";
public static final String ON_INVOKE_INSTANCE_KEY = "oninvoke.instance";
public static final String ON_RETURN_INSTANCE_KEY = "onreturn.instance";
public static final String ON_THROW_INSTANCE_KEY = "onthrow.instance";
public static final String OVERRIDE_PROTOCOL = "override";
public static final String PRIORITY_KEY = "priority";
public static final String RULE_KEY = "rule";
public static final String TYPE_KEY = "type";
public static final String RUNTIME_KEY = "runtime";
public static final String ROUTER_TYPE_CLEAR = "clean";
public static final String DEFAULT_SCRIPT_TYPE_KEY = "javascript";
public static final String STUB_EVENT_KEY = "dubbo.stub.event";
public static final boolean DEFAULT_STUB_EVENT = false;
public static final String STUB_EVENT_METHODS_KEY = "dubbo.stub.event.methods";
public static final String INVOCATION_NEED_MOCK = "invocation.need.mock";
public static final String LOCAL_PROTOCOL = "injvm";
public static final String AUTO_ATTACH_INVOCATIONID_KEY = "invocationid.autoattach";
public static final String SCOPE_KEY = "scope";
public static final String SCOPE_LOCAL = "local";
public static final String SCOPE_REMOTE = "remote";
public static final String SCOPE_NONE = "none";
public static final String RELIABLE_PROTOCOL = "napoli";
public static final String TPS_LIMIT_RATE_KEY = "tps";
public static final String TPS_LIMIT_INTERVAL_KEY = "tps.interval";
public static final long DEFAULT_TPS_LIMIT_INTERVAL = 60 * 1000;
public static final String DECODE_IN_IO_THREAD_KEY = "decode.in.io";
public static final boolean DEFAULT_DECODE_IN_IO_THREAD = true;
public static final String INPUT_KEY = "input";
public static final String OUTPUT_KEY = "output";
public static final String EXECUTOR_SERVICE_COMPONENT_KEY = ExecutorService.class.getName();
public static final String GENERIC_SERIALIZATION_NATIVE_JAVA = "nativejava";
public static final String GENERIC_SERIALIZATION_DEFAULT = "true";
public static final String INVOKER_CONNECTED_KEY = "connected";
public static final String INVOKER_INSIDE_INVOKERS_KEY = "inside.invokers";
public static final String INVOKER_INSIDE_INVOKER_COUNT_KEY = "inside.invoker.count";
public static final String CLUSTER_SWITCH_FACTOR = "cluster.switch.factor";
public static final String CLUSTER_SWITCH_LOG_ERROR = "cluster.switch.log.error";
public static final double DEFAULT_CLUSTER_SWITCH_FACTOR = 2;
public static final String DISPATHER_KEY = "dispather";
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/serialize/ObjectInput.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/common/serialize/ObjectInput.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.common.serialize;
@Deprecated
public interface ObjectInput extends org.apache.dubbo.common.serialize.ObjectInput {}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/serialize/ObjectOutput.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/common/serialize/ObjectOutput.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.common.serialize;
@Deprecated
public interface ObjectOutput extends org.apache.dubbo.common.serialize.ObjectOutput {}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/serialize/Serialization.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/common/serialize/Serialization.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.common.serialize;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import com.alibaba.dubbo.common.DelegateURL;
import com.alibaba.dubbo.common.URL;
@Deprecated
public interface Serialization extends org.apache.dubbo.common.serialize.Serialization {
ObjectOutput serialize(URL url, OutputStream output) throws IOException;
ObjectInput deserialize(URL url, InputStream input) throws IOException;
@Override
default org.apache.dubbo.common.serialize.ObjectOutput serialize(
org.apache.dubbo.common.URL url, OutputStream output) throws IOException {
return this.serialize(new DelegateURL(url), output);
}
@Override
default org.apache.dubbo.common.serialize.ObjectInput deserialize(
org.apache.dubbo.common.URL url, InputStream input) throws IOException {
return this.deserialize(new DelegateURL(url), input);
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/extension/Activate.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/common/extension/Activate.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.common.extension;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* See @org.apache.dubbo.common.extension.Activate
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD})
@Deprecated
public @interface Activate {
String[] group() default {};
String[] value() default {};
@Deprecated
String[] before() default {};
@Deprecated
String[] after() default {};
int order() default 0;
/**
* Activate loadClass when the current extension when the specified className all match
* @return className names to all match
*/
String[] onClass() default {};
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/extension/ExtensionFactory.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/common/extension/ExtensionFactory.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.common.extension;
import org.apache.dubbo.common.extension.ExtensionScope;
import org.apache.dubbo.common.extension.SPI;
@Deprecated
@SPI(scope = ExtensionScope.FRAMEWORK)
public interface ExtensionFactory extends org.apache.dubbo.common.extension.ExtensionFactory {}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/logger/LoggerAdapter.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/common/logger/LoggerAdapter.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.common.logger;
@Deprecated
public interface LoggerAdapter extends org.apache.dubbo.common.logger.LoggerAdapter {}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/store/DataStore.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/common/store/DataStore.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.common.store;
@Deprecated
public interface DataStore extends org.apache.dubbo.common.store.DataStore {}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/utils/UrlUtils.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/common/utils/UrlUtils.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.common.utils;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import com.alibaba.dubbo.common.DelegateURL;
import com.alibaba.dubbo.common.URL;
/**
* 2019-04-17
*/
@Deprecated
public class UrlUtils {
public static URL parseURL(String address, Map<String, String> defaults) {
return new DelegateURL(org.apache.dubbo.common.utils.UrlUtils.parseURL(address, defaults));
}
public static List<URL> parseURLs(String address, Map<String, String> defaults) {
return org.apache.dubbo.common.utils.UrlUtils.parseURLs(address, defaults).stream()
.map(e -> new DelegateURL(e))
.collect(Collectors.toList());
}
public static Map<String, Map<String, String>> convertRegister(Map<String, Map<String, String>> register) {
return org.apache.dubbo.common.utils.UrlUtils.convertRegister(register);
}
public static Map<String, String> convertSubscribe(Map<String, String> subscribe) {
return org.apache.dubbo.common.utils.UrlUtils.convertSubscribe(subscribe);
}
public static Map<String, Map<String, String>> revertRegister(Map<String, Map<String, String>> register) {
return org.apache.dubbo.common.utils.UrlUtils.revertRegister(register);
}
public static Map<String, String> revertSubscribe(Map<String, String> subscribe) {
return org.apache.dubbo.common.utils.UrlUtils.revertSubscribe(subscribe);
}
public static Map<String, Map<String, String>> revertNotify(Map<String, Map<String, String>> notify) {
return org.apache.dubbo.common.utils.UrlUtils.revertNotify(notify);
}
// compatible for dubbo-2.0.0
public static List<String> revertForbid(List<String> forbid, Set<URL> subscribed) {
Set<org.apache.dubbo.common.URL> urls =
subscribed.stream().map(e -> e.getOriginalURL()).collect(Collectors.toSet());
return org.apache.dubbo.common.utils.UrlUtils.revertForbid(forbid, urls);
}
public static URL getEmptyUrl(String service, String category) {
return new DelegateURL(org.apache.dubbo.common.utils.UrlUtils.getEmptyUrl(service, category));
}
public static boolean isMatchCategory(String category, String categories) {
return org.apache.dubbo.common.utils.UrlUtils.isMatchCategory(category, categories);
}
public static boolean isMatch(URL consumerUrl, URL providerUrl) {
return org.apache.dubbo.common.utils.UrlUtils.isMatch(
consumerUrl.getOriginalURL(), providerUrl.getOriginalURL());
}
public static boolean isMatchGlobPattern(String pattern, String value, URL param) {
return org.apache.dubbo.common.utils.UrlUtils.isMatchGlobPattern(pattern, value, param.getOriginalURL());
}
public static boolean isMatchGlobPattern(String pattern, String value) {
return org.apache.dubbo.common.utils.UrlUtils.isMatchGlobPattern(pattern, value);
}
public static boolean isServiceKeyMatch(URL pattern, URL value) {
return org.apache.dubbo.common.utils.UrlUtils.isServiceKeyMatch(
pattern.getOriginalURL(), value.getOriginalURL());
}
public static boolean isConfigurator(URL url) {
return org.apache.dubbo.common.utils.UrlUtils.isConfigurator(url.getOriginalURL());
}
public static boolean isRoute(URL url) {
return org.apache.dubbo.common.utils.UrlUtils.isRoute(url.getOriginalURL());
}
public static boolean isProvider(URL url) {
return org.apache.dubbo.common.utils.UrlUtils.isProvider(url.getOriginalURL());
}
public static int getHeartbeat(URL url) {
return org.apache.dubbo.remoting.utils.UrlUtils.getHeartbeat(url.getOriginalURL());
}
public static int getIdleTimeout(URL url) {
return org.apache.dubbo.remoting.utils.UrlUtils.getIdleTimeout(url.getOriginalURL());
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/threadpool/ThreadPool.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/common/threadpool/ThreadPool.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.common.threadpool;
import org.apache.dubbo.common.URL;
import java.util.concurrent.Executor;
@Deprecated
public interface ThreadPool extends org.apache.dubbo.common.threadpool.ThreadPool {
Executor getExecutor(com.alibaba.dubbo.common.URL url);
@Override
default Executor getExecutor(URL url) {
return getExecutor(new com.alibaba.dubbo.common.DelegateURL(url));
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/status/Status.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/common/status/Status.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.common.status;
@Deprecated
public class Status extends org.apache.dubbo.common.status.Status {
public Status(Level level) {
super(level);
}
public Status(Level level, String message) {
super(level, message);
}
public Status(Level level, String message, String description) {
super(level, message, description);
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/status/StatusChecker.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/common/status/StatusChecker.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.common.status;
@Deprecated
public interface StatusChecker extends org.apache.dubbo.common.status.StatusChecker {
@Override
Status check();
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/compiler/Compiler.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/common/compiler/Compiler.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.common.compiler;
@Deprecated
public interface Compiler extends org.apache.dubbo.common.compiler.Compiler {}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/monitor/Monitor.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/monitor/Monitor.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.monitor;
import org.apache.dubbo.common.URL;
import java.util.List;
import java.util.stream.Collectors;
@Deprecated
public interface Monitor extends org.apache.dubbo.monitor.Monitor {
@Override
com.alibaba.dubbo.common.URL getUrl();
void collect(com.alibaba.dubbo.common.URL statistics);
List<com.alibaba.dubbo.common.URL> lookup(com.alibaba.dubbo.common.URL query);
@Override
default void collect(URL statistics) {
this.collect(new com.alibaba.dubbo.common.DelegateURL(statistics));
}
@Override
default List<URL> lookup(URL query) {
return this.lookup(new com.alibaba.dubbo.common.DelegateURL(query)).stream()
.map(url -> url.getOriginalURL())
.collect(Collectors.toList());
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/monitor/MonitorFactory.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/monitor/MonitorFactory.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.monitor;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.monitor.Monitor;
@Deprecated
public interface MonitorFactory extends org.apache.dubbo.monitor.MonitorFactory {
com.alibaba.dubbo.monitor.Monitor getMonitor(com.alibaba.dubbo.common.URL url);
@Override
default Monitor getMonitor(URL url) {
return this.getMonitor(new com.alibaba.dubbo.common.DelegateURL(url));
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/MethodConfig.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/config/MethodConfig.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.config;
@Deprecated
public class MethodConfig extends org.apache.dubbo.config.MethodConfig {
public void addArgument(com.alibaba.dubbo.config.ArgumentConfig argumentConfig) {
super.addArgument(argumentConfig);
}
public void setMock(Boolean mock) {
if (mock == null) {
setMock((String) null);
} else {
setMock(String.valueOf(mock));
}
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ArgumentConfig.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ArgumentConfig.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.config;
@Deprecated
public class ArgumentConfig extends org.apache.dubbo.config.ArgumentConfig {}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ProtocolConfig.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ProtocolConfig.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.config;
@Deprecated
public class ProtocolConfig extends org.apache.dubbo.config.ProtocolConfig {
public ProtocolConfig() {}
public ProtocolConfig(String name) {
super(name);
}
public ProtocolConfig(String name, int port) {
super(name, port);
}
public void mergeProtocol(ProtocolConfig sourceConfig) {
super.mergeProtocol(sourceConfig);
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ReferenceConfig.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ReferenceConfig.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.config;
import org.apache.dubbo.config.annotation.Reference;
@Deprecated
public class ReferenceConfig<T> extends org.apache.dubbo.config.ReferenceConfig<T> {
public ReferenceConfig() {}
public ReferenceConfig(Reference reference) {
super(reference);
}
public void setConsumer(com.alibaba.dubbo.config.ConsumerConfig consumer) {
super.setConsumer(consumer);
}
public void setApplication(com.alibaba.dubbo.config.ApplicationConfig application) {
super.setApplication(application);
}
public void setModule(com.alibaba.dubbo.config.ModuleConfig module) {
super.setModule(module);
}
public void setRegistry(com.alibaba.dubbo.config.RegistryConfig registry) {
super.setRegistry(registry);
}
public void addMethod(com.alibaba.dubbo.config.MethodConfig methodConfig) {
super.addMethod(methodConfig);
}
public void setMonitor(com.alibaba.dubbo.config.MonitorConfig monitor) {
super.setMonitor(monitor);
}
public void setMock(Boolean mock) {
if (mock == null) {
setMock((String) null);
} else {
setMock(String.valueOf(mock));
}
}
public void setInterfaceClass(Class<?> interfaceClass) {
setInterface(interfaceClass);
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.config;
import org.apache.dubbo.config.annotation.Service;
import java.util.ArrayList;
import java.util.List;
@Deprecated
public class ServiceConfig<T> extends org.apache.dubbo.config.ServiceConfig<T> {
public ServiceConfig() {}
public ServiceConfig(Service service) {
super(service);
}
public void setProvider(com.alibaba.dubbo.config.ProviderConfig provider) {
super.setProvider(provider);
}
public void setApplication(com.alibaba.dubbo.config.ApplicationConfig application) {
super.setApplication(application);
}
public void setModule(com.alibaba.dubbo.config.ModuleConfig module) {
super.setModule(module);
}
public void setRegistry(com.alibaba.dubbo.config.RegistryConfig registry) {
super.setRegistry(registry);
}
public void addMethod(com.alibaba.dubbo.config.MethodConfig methodConfig) {
super.addMethod(methodConfig);
}
public com.alibaba.dubbo.config.MonitorConfig getMonitor() {
org.apache.dubbo.config.MonitorConfig monitorConfig = super.getMonitor();
if (monitorConfig == null) {
return null;
}
if (monitorConfig instanceof com.alibaba.dubbo.config.MonitorConfig) {
return (com.alibaba.dubbo.config.MonitorConfig) monitorConfig;
}
throw new IllegalArgumentException("Monitor has not been set with type com.alibaba.dubbo.config.MonitorConfig. "
+ "Found " + monitorConfig.getClass().getName() + " instead.");
}
public void setMonitor(com.alibaba.dubbo.config.MonitorConfig monitor) {
super.setMonitor(monitor);
}
public void setProtocol(com.alibaba.dubbo.config.ProtocolConfig protocol) {
super.setProtocol(protocol);
}
public void setMock(Boolean mock) {
if (mock == null) {
setMock((String) null);
} else {
setMock(String.valueOf(mock));
}
}
public void setProviders(List<ProviderConfig> providers) {
setProtocols(convertProviderToProtocol(providers));
}
private static List<ProtocolConfig> convertProviderToProtocol(List<ProviderConfig> providers) {
if (providers == null || providers.isEmpty()) {
return null;
}
List<ProtocolConfig> protocols = new ArrayList<>(providers.size());
for (ProviderConfig provider : providers) {
protocols.add(convertProviderToProtocol(provider));
}
return protocols;
}
private static ProtocolConfig convertProviderToProtocol(ProviderConfig provider) {
ProtocolConfig protocol = new ProtocolConfig();
protocol.setName(provider.getProtocol().getName());
protocol.setServer(provider.getServer());
protocol.setClient(provider.getClient());
protocol.setCodec(provider.getCodec());
protocol.setHost(provider.getHost());
protocol.setPort(provider.getPort());
protocol.setPath(provider.getPath());
protocol.setPayload(provider.getPayload());
protocol.setThreads(provider.getThreads());
protocol.setParameters(provider.getParameters());
return protocol;
}
private static ProviderConfig convertProtocolToProvider(ProtocolConfig protocol) {
ProviderConfig provider = new ProviderConfig();
provider.setProtocol(protocol);
provider.setServer(protocol.getServer());
provider.setClient(protocol.getClient());
provider.setCodec(protocol.getCodec());
provider.setHost(protocol.getHost());
provider.setPort(protocol.getPort());
provider.setPath(protocol.getPath());
provider.setPayload(protocol.getPayload());
provider.setThreads(protocol.getThreads());
provider.setParameters(protocol.getParameters());
return provider;
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ModuleConfig.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ModuleConfig.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.config;
@Deprecated
public class ModuleConfig extends org.apache.dubbo.config.ModuleConfig {
public ModuleConfig() {}
public ModuleConfig(String name) {
super(name);
}
public void setRegistry(com.alibaba.dubbo.config.RegistryConfig registry) {
super.setRegistry(registry);
}
public void setMonitor(com.alibaba.dubbo.config.MonitorConfig monitor) {
super.setMonitor(monitor);
}
@Override
public void setMonitor(String monitor) {
setMonitor(new com.alibaba.dubbo.config.MonitorConfig(monitor));
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ProviderConfig.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ProviderConfig.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.config;
@Deprecated
public class ProviderConfig extends org.apache.dubbo.config.ProviderConfig {
public void setApplication(com.alibaba.dubbo.config.ApplicationConfig application) {
super.setApplication(application);
}
public void setModule(com.alibaba.dubbo.config.ModuleConfig module) {
super.setModule(module);
}
public void setRegistry(com.alibaba.dubbo.config.RegistryConfig registry) {
super.setRegistry(registry);
}
public void addMethod(com.alibaba.dubbo.config.MethodConfig methodConfig) {
super.addMethod(methodConfig);
}
public void setMonitor(com.alibaba.dubbo.config.MonitorConfig monitor) {
super.setMonitor(monitor);
}
public void setProtocol(com.alibaba.dubbo.config.ProtocolConfig protocol) {
super.setProtocol(protocol);
}
@Override
public void setProtocol(String protocol) {
setProtocol(new com.alibaba.dubbo.config.ProtocolConfig(protocol));
}
public void setMock(Boolean mock) {
if (mock == null) {
setMock((String) null);
} else {
setMock(String.valueOf(mock));
}
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ConsumerConfig.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ConsumerConfig.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.config;
@Deprecated
public class ConsumerConfig extends org.apache.dubbo.config.ConsumerConfig {
public void setApplication(com.alibaba.dubbo.config.ApplicationConfig application) {
super.setApplication(application);
}
public void setModule(com.alibaba.dubbo.config.ModuleConfig module) {
super.setModule(module);
}
public void setRegistry(com.alibaba.dubbo.config.RegistryConfig registry) {
super.setRegistry(registry);
}
public void addMethod(com.alibaba.dubbo.config.MethodConfig methodConfig) {
super.addMethod(methodConfig);
}
public void setMonitor(com.alibaba.dubbo.config.MonitorConfig monitor) {
super.setMonitor(monitor);
}
public void setMock(Boolean mock) {
if (mock == null) {
setMock((String) null);
} else {
setMock(String.valueOf(mock));
}
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/MonitorConfig.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/config/MonitorConfig.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.config;
@Deprecated
public class MonitorConfig extends org.apache.dubbo.config.MonitorConfig {
public MonitorConfig() {}
public MonitorConfig(String address) {
super(address);
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ApplicationConfig.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ApplicationConfig.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.config;
@Deprecated
public class ApplicationConfig extends org.apache.dubbo.config.ApplicationConfig {
public ApplicationConfig() {
super();
}
public ApplicationConfig(String name) {
super(name);
}
public void setRegistry(com.alibaba.dubbo.config.RegistryConfig registry) {
super.setRegistry(registry);
}
public void setMonitor(com.alibaba.dubbo.config.MonitorConfig monitor) {
super.setMonitor(monitor);
}
@Override
public void setMonitor(String monitor) {
setMonitor(new com.alibaba.dubbo.config.MonitorConfig(monitor));
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/RegistryConfig.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/config/RegistryConfig.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.config;
@Deprecated
public class RegistryConfig extends org.apache.dubbo.config.RegistryConfig {
public RegistryConfig() {}
public RegistryConfig(String address) {
super(address);
}
public RegistryConfig(String address, String protocol) {
super(address, protocol);
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/annotation/Service.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/config/annotation/Service.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.config.annotation;
import org.apache.dubbo.config.annotation.DubboService;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Service annotation
*
* @see DubboService
* @deprecated Recommend {@link DubboService} as the substitute
*/
@Deprecated
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD})
@Inherited
public @interface Service {
Class<?> interfaceClass() default void.class;
String interfaceName() default "";
String version() default "";
String group() default "";
String path() default "";
boolean export() default false;
String token() default "";
boolean deprecated() default false;
boolean dynamic() default true;
String accesslog() default "";
int executes() default -1;
boolean register() default false;
int weight() default -1;
String document() default "";
int delay() default -1;
String local() default "";
String stub() default "";
String cluster() default "";
String proxy() default "";
int connections() default -1;
int callbacks() default -1;
String onconnect() default "";
String ondisconnect() default "";
String owner() default "";
String layer() default "";
int retries() default -1;
String loadbalance() default "";
boolean async() default false;
int actives() default -1;
boolean sent() default false;
String mock() default "";
String validation() default "";
int timeout() default -1;
String cache() default "";
String[] filter() default {};
String[] listener() default {};
String[] parameters() default {};
/**
* Application associated name
* @deprecated Do not set it and use the global Application Config
*/
@Deprecated
String application() default "";
String module() default "";
String provider() default "";
String[] protocol() default {};
String monitor() default "";
String[] registry() default {};
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/annotation/Reference.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/config/annotation/Reference.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.config.annotation;
import org.apache.dubbo.config.annotation.DubboReference;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Reference
* <p>
*
* @see DubboReference
* @deprecated Recommend {@link DubboReference} as the substitute
*/
@Deprecated
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.ANNOTATION_TYPE})
public @interface Reference {
Class<?> interfaceClass() default void.class;
String interfaceName() default "";
String version() default "";
String group() default "";
String url() default "";
String client() default "";
/**
* Whether to enable generic invocation, default value is false
* @deprecated Do not need specify generic value, judge by injection type and interface class
*/
@Deprecated
boolean generic() default false;
boolean injvm() default true;
boolean check() default true;
boolean init() default true;
boolean lazy() default false;
boolean stubevent() default false;
String reconnect() default "";
boolean sticky() default false;
String proxy() default "";
String stub() default "";
String cluster() default "";
int connections() default -1;
int callbacks() default -1;
String onconnect() default "";
String ondisconnect() default "";
String owner() default "";
String layer() default "";
int retries() default -1;
String loadbalance() default "";
boolean async() default false;
int actives() default -1;
boolean sent() default false;
String mock() default "";
String validation() default "";
int timeout() default -1;
String cache() default "";
String[] filter() default {};
String[] listener() default {};
String[] parameters() default {};
/**
* Application associated name
* @deprecated Do not set it and use the global Application Config
*/
@Deprecated
String application() default "";
String module() default "";
String consumer() default "";
String monitor() default "";
String[] registry() default {};
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/spring/context/annotation/EnableDubbo.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/config/spring/context/annotation/EnableDubbo.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.config.spring.context.annotation;
import org.apache.dubbo.config.AbstractConfig;
import org.apache.dubbo.config.spring.context.annotation.DubboComponentScan;
import org.apache.dubbo.config.spring.context.annotation.EnableDubboConfig;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.core.annotation.AliasFor;
@Deprecated
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Documented
@EnableDubboConfig
@DubboComponentScan
public @interface EnableDubbo {
/**
* Base packages to scan for annotated @Service classes.
* <p>
* Use {@link #scanBasePackageClasses()} for a type-safe alternative to String-based
* package names.
*
* @return the base packages to scan
* @see DubboComponentScan#basePackages()
*/
@AliasFor(annotation = DubboComponentScan.class, attribute = "basePackages")
String[] scanBasePackages() default {};
/**
* Type-safe alternative to {@link #scanBasePackages()} for specifying the packages to
* scan for annotated @Service classes. The package of each class specified will be
* scanned.
*
* @return classes from the base packages to scan
* @see DubboComponentScan#basePackageClasses
*/
@AliasFor(annotation = DubboComponentScan.class, attribute = "basePackageClasses")
Class<?>[] scanBasePackageClasses() default {};
/**
* It indicates whether {@link AbstractConfig} binding to multiple Spring Beans.
*
* @return the default value is <code>false</code>
* @see EnableDubboConfig#multiple()
*/
@AliasFor(annotation = EnableDubboConfig.class, attribute = "multiple")
boolean multipleConfig() default false;
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/remoting/Dispatcher.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/remoting/Dispatcher.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.remoting;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.remoting.ChannelHandler;
@Deprecated
public interface Dispatcher extends org.apache.dubbo.remoting.Dispatcher {
com.alibaba.dubbo.remoting.ChannelHandler dispatch(
com.alibaba.dubbo.remoting.ChannelHandler handler, com.alibaba.dubbo.common.URL url);
@Override
default ChannelHandler dispatch(ChannelHandler handler, URL url) {
return null;
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/remoting/Server.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/remoting/Server.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.remoting;
import org.apache.dubbo.remoting.RemotingServer;
@Deprecated
public interface Server extends RemotingServer {}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/remoting/Channel.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/remoting/Channel.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.remoting;
@Deprecated
public interface Channel extends org.apache.dubbo.remoting.Channel {
@Override
com.alibaba.dubbo.common.URL getUrl();
@Override
com.alibaba.dubbo.remoting.ChannelHandler getChannelHandler();
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/remoting/Codec.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/remoting/Codec.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.remoting;
@Deprecated
public interface Codec extends org.apache.dubbo.remoting.Codec {}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/remoting/Transporter.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/remoting/Transporter.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.remoting;
import org.apache.dubbo.common.extension.Adaptive;
import org.apache.dubbo.remoting.Constants;
import org.apache.dubbo.remoting.RemotingServer;
import com.alibaba.dubbo.common.DelegateURL;
import com.alibaba.dubbo.common.URL;
@Deprecated
public interface Transporter extends org.apache.dubbo.remoting.Transporter {
@Adaptive({Constants.SERVER_KEY, Constants.TRANSPORTER_KEY})
Server bind(URL url, ChannelHandler handler) throws RemotingException;
@Override
default RemotingServer bind(org.apache.dubbo.common.URL url, org.apache.dubbo.remoting.ChannelHandler handler)
throws org.apache.dubbo.remoting.RemotingException {
return bind(new DelegateURL(url), new ChannelHandler() {
@Override
public void connected(Channel channel) throws RemotingException {
try {
handler.connected(channel);
} catch (org.apache.dubbo.remoting.RemotingException e) {
throw new RemotingException(e);
}
}
@Override
public void disconnected(Channel channel) throws RemotingException {
try {
handler.disconnected(channel);
} catch (org.apache.dubbo.remoting.RemotingException e) {
throw new RemotingException(e);
}
}
@Override
public void sent(Channel channel, Object message) throws RemotingException {
try {
handler.sent(channel, message);
} catch (org.apache.dubbo.remoting.RemotingException e) {
throw new RemotingException(e);
}
}
@Override
public void received(Channel channel, Object message) throws RemotingException {
try {
handler.received(channel, message);
} catch (org.apache.dubbo.remoting.RemotingException e) {
throw new RemotingException(e);
}
}
@Override
public void caught(Channel channel, Throwable exception) throws RemotingException {
try {
handler.caught(channel, exception);
} catch (org.apache.dubbo.remoting.RemotingException e) {
throw new RemotingException(e);
}
}
});
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/remoting/ChannelHandler.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/remoting/ChannelHandler.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.remoting;
import org.apache.dubbo.remoting.Channel;
import org.apache.dubbo.remoting.RemotingException;
@Deprecated
public interface ChannelHandler extends org.apache.dubbo.remoting.ChannelHandler {
void connected(com.alibaba.dubbo.remoting.Channel channel) throws com.alibaba.dubbo.remoting.RemotingException;
void disconnected(com.alibaba.dubbo.remoting.Channel channel) throws com.alibaba.dubbo.remoting.RemotingException;
void sent(com.alibaba.dubbo.remoting.Channel channel, Object message)
throws com.alibaba.dubbo.remoting.RemotingException;
void received(com.alibaba.dubbo.remoting.Channel channel, Object message)
throws com.alibaba.dubbo.remoting.RemotingException;
void caught(com.alibaba.dubbo.remoting.Channel channel, Throwable exception)
throws com.alibaba.dubbo.remoting.RemotingException;
@Override
default void connected(Channel channel) throws RemotingException {}
@Override
default void disconnected(Channel channel) throws RemotingException {}
@Override
default void sent(Channel channel, Object message) throws RemotingException {}
@Override
default void received(Channel channel, Object message) throws RemotingException {}
@Override
default void caught(Channel channel, Throwable exception) throws RemotingException {}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/remoting/RemotingException.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/remoting/RemotingException.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.remoting;
import org.apache.dubbo.remoting.Channel;
import java.net.InetSocketAddress;
@Deprecated
public class RemotingException extends org.apache.dubbo.remoting.RemotingException {
public RemotingException(Channel channel, String msg) {
super(channel, msg);
}
public RemotingException(InetSocketAddress localAddress, InetSocketAddress remoteAddress, String message) {
super(localAddress, remoteAddress, message);
}
public RemotingException(Channel channel, Throwable cause) {
super(channel, cause);
}
public RemotingException(InetSocketAddress localAddress, InetSocketAddress remoteAddress, Throwable cause) {
super(localAddress, remoteAddress, cause);
}
public RemotingException(Channel channel, String message, Throwable cause) {
super(channel, message, cause);
}
public RemotingException(
InetSocketAddress localAddress, InetSocketAddress remoteAddress, String message, Throwable cause) {
super(localAddress, remoteAddress, message, cause);
}
public RemotingException(Exception e) {
super(null, e.getMessage());
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/remoting/Codec2.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/remoting/Codec2.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.remoting;
@Deprecated
public interface Codec2 extends org.apache.dubbo.remoting.Codec2 {}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/remoting/exchange/ResponseCallback.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/remoting/exchange/ResponseCallback.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.remoting.exchange;
/**
* 2019-06-20
*/
@Deprecated
public interface ResponseCallback {
/**
* done.
*
* @param response
*/
void done(Object response);
/**
* caught exception.
*
* @param exception
*/
void caught(Throwable exception);
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/remoting/exchange/Exchanger.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/remoting/exchange/Exchanger.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.remoting.exchange;
@Deprecated
public interface Exchanger extends org.apache.dubbo.remoting.exchange.Exchanger {}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/remoting/exchange/ResponseFuture.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/remoting/exchange/ResponseFuture.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.remoting.exchange;
import com.alibaba.dubbo.remoting.RemotingException;
/**
* 2019-06-20
*/
@Deprecated
public interface ResponseFuture {
/**
* get result.
*
* @return result.
*/
Object get() throws RemotingException;
/**
* get result with the specified timeout.
*
* @param timeoutInMillis timeout.
* @return result.
*/
Object get(int timeoutInMillis) throws RemotingException;
/**
* set callback.
*
* @param callback
*/
void setCallback(ResponseCallback callback);
/**
* check is done.
*
* @return done or not.
*/
boolean isDone();
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/remoting/telnet/TelnetHandler.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/remoting/telnet/TelnetHandler.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.remoting.telnet;
import org.apache.dubbo.remoting.Channel;
import org.apache.dubbo.remoting.RemotingException;
@Deprecated
public interface TelnetHandler extends org.apache.dubbo.remoting.telnet.TelnetHandler {
String telnet(com.alibaba.dubbo.remoting.Channel channel, String message)
throws com.alibaba.dubbo.remoting.RemotingException;
@Override
default String telnet(Channel channel, String message) throws RemotingException {
return null;
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/Registry.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/Registry.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.registry;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.registry.NotifyListener;
import java.util.List;
import java.util.stream.Collectors;
@Deprecated
public interface Registry extends org.apache.dubbo.registry.Registry {
@Override
com.alibaba.dubbo.common.URL getUrl();
void register(com.alibaba.dubbo.common.URL url);
void unregister(com.alibaba.dubbo.common.URL url);
void subscribe(com.alibaba.dubbo.common.URL url, com.alibaba.dubbo.registry.NotifyListener listener);
void unsubscribe(com.alibaba.dubbo.common.URL url, com.alibaba.dubbo.registry.NotifyListener listener);
List<com.alibaba.dubbo.common.URL> lookup(com.alibaba.dubbo.common.URL url);
@Override
default void register(URL url) {
this.register(new com.alibaba.dubbo.common.DelegateURL(url));
}
@Override
default void unregister(URL url) {
this.unregister(new com.alibaba.dubbo.common.DelegateURL(url));
}
@Override
default void subscribe(URL url, NotifyListener listener) {
this.subscribe(
new com.alibaba.dubbo.common.DelegateURL(url),
new com.alibaba.dubbo.registry.NotifyListener.CompatibleNotifyListener(listener));
}
@Override
default void unsubscribe(URL url, NotifyListener listener) {
this.unsubscribe(
new com.alibaba.dubbo.common.DelegateURL(url),
new com.alibaba.dubbo.registry.NotifyListener.CompatibleNotifyListener(listener));
}
@Override
default List<URL> lookup(URL url) {
return this.lookup(new com.alibaba.dubbo.common.DelegateURL(url)).stream()
.map(u -> u.getOriginalURL())
.collect(Collectors.toList());
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/NotifyListener.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/NotifyListener.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.registry;
import java.util.List;
import java.util.stream.Collectors;
import com.alibaba.dubbo.common.DelegateURL;
import com.alibaba.dubbo.common.URL;
@Deprecated
public interface NotifyListener {
void notify(List<URL> urls);
class CompatibleNotifyListener implements NotifyListener {
private org.apache.dubbo.registry.NotifyListener listener;
public CompatibleNotifyListener(org.apache.dubbo.registry.NotifyListener listener) {
this.listener = listener;
}
@Override
public void notify(List<URL> urls) {
if (listener != null) {
listener.notify(urls.stream().map(url -> url.getOriginalURL()).collect(Collectors.toList()));
}
}
}
class ReverseCompatibleNotifyListener implements org.apache.dubbo.registry.NotifyListener {
private NotifyListener listener;
public ReverseCompatibleNotifyListener(NotifyListener listener) {
this.listener = listener;
}
@Override
public void notify(List<org.apache.dubbo.common.URL> urls) {
if (listener != null) {
listener.notify(urls.stream().map(url -> new DelegateURL(url)).collect(Collectors.toList()));
}
}
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/RegistryFactory.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/RegistryFactory.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.registry;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.registry.Registry;
@Deprecated
public interface RegistryFactory extends org.apache.dubbo.registry.RegistryFactory {
com.alibaba.dubbo.registry.Registry getRegistry(com.alibaba.dubbo.common.URL url);
@Override
default Registry getRegistry(URL url) {
return this.getRegistry(new com.alibaba.dubbo.common.DelegateURL(url));
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/support/FailbackRegistry.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/support/FailbackRegistry.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.registry.support;
import java.util.List;
import java.util.stream.Collectors;
import com.alibaba.dubbo.common.DelegateURL;
import com.alibaba.dubbo.common.URL;
import com.alibaba.dubbo.registry.NotifyListener;
import com.alibaba.dubbo.registry.Registry;
/**
* 2019-04-17
*/
@Deprecated
public abstract class FailbackRegistry implements org.apache.dubbo.registry.Registry, Registry {
private CompatibleFailbackRegistry failbackRegistry;
public FailbackRegistry(URL url) {
failbackRegistry = new CompatibleFailbackRegistry(url.getOriginalURL(), this);
}
public void removeFailedRegisteredTask(URL url) {
failbackRegistry.removeFailedRegisteredTask(url.getOriginalURL());
}
public void removeFailedUnregisteredTask(URL url) {
failbackRegistry.removeFailedUnregisteredTask(url.getOriginalURL());
}
public void removeFailedSubscribedTask(URL url, NotifyListener listener) {
failbackRegistry.removeFailedSubscribedTask(
url.getOriginalURL(), new NotifyListener.ReverseCompatibleNotifyListener(listener));
}
public void removeFailedUnsubscribedTask(URL url, NotifyListener listener) {
failbackRegistry.removeFailedUnsubscribedTask(
url.getOriginalURL(), new NotifyListener.ReverseCompatibleNotifyListener(listener));
}
@Override
public void register(URL url) {
failbackRegistry.register(url.getOriginalURL());
}
@Override
public void unregister(URL url) {
failbackRegistry.unregister(url.getOriginalURL());
}
@Override
public void subscribe(URL url, NotifyListener listener) {
failbackRegistry.subscribe(
url.getOriginalURL(),
new com.alibaba.dubbo.registry.NotifyListener.ReverseCompatibleNotifyListener(listener));
}
@Override
public void unsubscribe(URL url, NotifyListener listener) {
failbackRegistry.unsubscribe(
url.getOriginalURL(),
new com.alibaba.dubbo.registry.NotifyListener.ReverseCompatibleNotifyListener(listener));
}
protected void notify(URL url, NotifyListener listener, List<URL> urls) {
List<org.apache.dubbo.common.URL> urlResult =
urls.stream().map(URL::getOriginalURL).collect(Collectors.toList());
failbackRegistry.notify(
url.getOriginalURL(),
new com.alibaba.dubbo.registry.NotifyListener.ReverseCompatibleNotifyListener(listener),
urlResult);
}
protected void doNotify(URL url, NotifyListener listener, List<URL> urls) {
List<org.apache.dubbo.common.URL> urlResult =
urls.stream().map(URL::getOriginalURL).collect(Collectors.toList());
failbackRegistry.doNotify(
url.getOriginalURL(),
new com.alibaba.dubbo.registry.NotifyListener.ReverseCompatibleNotifyListener(listener),
urlResult);
}
protected void recover() throws Exception {
failbackRegistry.recover();
}
@Override
public List<URL> lookup(URL url) {
return failbackRegistry.lookup(url.getOriginalURL()).stream()
.map(e -> new DelegateURL(e))
.collect(Collectors.toList());
}
@Override
public URL getUrl() {
return new DelegateURL(failbackRegistry.getUrl());
}
@Override
public void destroy() {
failbackRegistry.destroy();
}
// ==== Template method ====
public abstract void doRegister(URL url);
public abstract void doUnregister(URL url);
public abstract void doSubscribe(URL url, NotifyListener listener);
public abstract void doUnsubscribe(URL url, NotifyListener listener);
@Override
public void register(org.apache.dubbo.common.URL url) {
this.register(new DelegateURL(url));
}
@Override
public void unregister(org.apache.dubbo.common.URL url) {
this.unregister(new DelegateURL(url));
}
@Override
public void subscribe(org.apache.dubbo.common.URL url, org.apache.dubbo.registry.NotifyListener listener) {
this.subscribe(new DelegateURL(url), new NotifyListener.CompatibleNotifyListener(listener));
}
@Override
public void unsubscribe(org.apache.dubbo.common.URL url, org.apache.dubbo.registry.NotifyListener listener) {
this.unsubscribe(new DelegateURL(url), new NotifyListener.CompatibleNotifyListener(listener));
}
@Override
public List<org.apache.dubbo.common.URL> lookup(org.apache.dubbo.common.URL url) {
return failbackRegistry.lookup(url);
}
static class CompatibleFailbackRegistry extends org.apache.dubbo.registry.support.FailbackRegistry {
private FailbackRegistry compatibleFailbackRegistry;
public CompatibleFailbackRegistry(
org.apache.dubbo.common.URL url, FailbackRegistry compatibleFailbackRegistry) {
super(url);
this.compatibleFailbackRegistry = compatibleFailbackRegistry;
}
@Override
public void doRegister(org.apache.dubbo.common.URL url) {
this.compatibleFailbackRegistry.doRegister(new DelegateURL(url));
}
@Override
public void doUnregister(org.apache.dubbo.common.URL url) {
this.compatibleFailbackRegistry.doUnregister(new DelegateURL(url));
}
@Override
public void doSubscribe(org.apache.dubbo.common.URL url, org.apache.dubbo.registry.NotifyListener listener) {
this.compatibleFailbackRegistry.doSubscribe(
new DelegateURL(url), new NotifyListener.CompatibleNotifyListener(listener));
}
@Override
public void doUnsubscribe(org.apache.dubbo.common.URL url, org.apache.dubbo.registry.NotifyListener listener) {
this.compatibleFailbackRegistry.doUnsubscribe(
new DelegateURL(url), new NotifyListener.CompatibleNotifyListener(listener));
}
@Override
public void notify(
org.apache.dubbo.common.URL url,
org.apache.dubbo.registry.NotifyListener listener,
List<org.apache.dubbo.common.URL> urls) {
super.notify(url, listener, urls);
}
@Override
public void doNotify(
org.apache.dubbo.common.URL url,
org.apache.dubbo.registry.NotifyListener listener,
List<org.apache.dubbo.common.URL> urls) {
super.doNotify(url, listener, urls);
}
@Override
public boolean isAvailable() {
return false;
}
@Override
public void recover() throws Exception {
super.recover();
}
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/support/AbstractRegistryFactory.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/support/AbstractRegistryFactory.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.registry.support;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.registry.Registry;
import com.alibaba.dubbo.registry.RegistryFactory;
/**
* 2019-04-16
*/
@Deprecated
public abstract class AbstractRegistryFactory extends org.apache.dubbo.registry.support.AbstractRegistryFactory
implements RegistryFactory {
@Override
public com.alibaba.dubbo.registry.Registry getRegistry(com.alibaba.dubbo.common.URL url) {
return (com.alibaba.dubbo.registry.Registry) super.getRegistry(url.getOriginalURL());
}
protected abstract com.alibaba.dubbo.registry.Registry createRegistry(com.alibaba.dubbo.common.URL url);
@Override
protected Registry createRegistry(URL url) {
return createRegistry(new com.alibaba.dubbo.common.DelegateURL(url));
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
apache/dubbo | https://github.com/apache/dubbo/blob/ac1621f9a0470054c0308c47f84c7668f6bc2868/dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/support/AbstractRegistry.java | dubbo-compatible/src/main/java/com/alibaba/dubbo/registry/support/AbstractRegistry.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.registry.support;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.registry.NotifyListener;
import org.apache.dubbo.registry.Registry;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
* 2019-04-16
*/
@Deprecated
public abstract class AbstractRegistry implements Registry {
private CompatibleAbstractRegistry abstractRegistry;
public AbstractRegistry(com.alibaba.dubbo.common.URL url) {
abstractRegistry = new CompatibleAbstractRegistry(url.getOriginalURL());
}
@Override
public com.alibaba.dubbo.common.URL getUrl() {
return new com.alibaba.dubbo.common.DelegateURL(abstractRegistry.getUrl());
}
protected void setUrl(com.alibaba.dubbo.common.URL url) {
abstractRegistry.setUrl(url.getOriginalURL());
}
public Set<com.alibaba.dubbo.common.URL> getRegistered() {
return abstractRegistry.getRegistered().stream()
.map(url -> new com.alibaba.dubbo.common.DelegateURL(url))
.collect(Collectors.toSet());
}
public Map<com.alibaba.dubbo.common.URL, Set<com.alibaba.dubbo.registry.NotifyListener>> getSubscribed() {
return abstractRegistry.getSubscribed().entrySet().stream()
.collect(Collectors.toMap(
entry -> new com.alibaba.dubbo.common.DelegateURL(entry.getKey()),
entry -> convertToNotifyListeners(entry.getValue())));
}
public Map<com.alibaba.dubbo.common.URL, Map<String, List<com.alibaba.dubbo.common.URL>>> getNotified() {
return abstractRegistry.getNotified().entrySet().stream()
.collect(Collectors.toMap(entry -> new com.alibaba.dubbo.common.DelegateURL(entry.getKey()), entry -> {
return entry.getValue().entrySet().stream().collect(Collectors.toMap(e -> e.getKey(), e -> {
return e.getValue().stream()
.map(url -> new com.alibaba.dubbo.common.DelegateURL(url))
.collect(Collectors.toList());
}));
}));
}
public List<com.alibaba.dubbo.common.URL> getCacheUrls(com.alibaba.dubbo.common.URL url) {
return abstractRegistry.lookup(url.getOriginalURL()).stream()
.map(tmpUrl -> new com.alibaba.dubbo.common.DelegateURL(tmpUrl))
.collect(Collectors.toList());
}
public List<com.alibaba.dubbo.common.URL> lookup(com.alibaba.dubbo.common.URL url) {
return abstractRegistry.lookup(url.getOriginalURL()).stream()
.map(tmpUrl -> new com.alibaba.dubbo.common.DelegateURL(tmpUrl))
.collect(Collectors.toList());
}
protected void notify(
com.alibaba.dubbo.common.URL url,
com.alibaba.dubbo.registry.NotifyListener listener,
List<com.alibaba.dubbo.common.URL> urls) {
abstractRegistry.notify(
url.getOriginalURL(),
new com.alibaba.dubbo.registry.NotifyListener.ReverseCompatibleNotifyListener(listener),
urls.stream().map(tmpUrl -> tmpUrl.getOriginalURL()).collect(Collectors.toList()));
}
public void register(com.alibaba.dubbo.common.URL url) {
abstractRegistry.register(url.getOriginalURL());
}
public void unregister(com.alibaba.dubbo.common.URL url) {
abstractRegistry.unregister(url.getOriginalURL());
}
public void subscribe(com.alibaba.dubbo.common.URL url, com.alibaba.dubbo.registry.NotifyListener listener) {
abstractRegistry.subscribe(
url.getOriginalURL(),
new com.alibaba.dubbo.registry.NotifyListener.ReverseCompatibleNotifyListener(listener));
}
public void unsubscribe(com.alibaba.dubbo.common.URL url, com.alibaba.dubbo.registry.NotifyListener listener) {
abstractRegistry.unsubscribe(
url.getOriginalURL(),
new com.alibaba.dubbo.registry.NotifyListener.ReverseCompatibleNotifyListener(listener));
}
@Override
public void register(URL url) {
this.register(new com.alibaba.dubbo.common.DelegateURL(url));
}
@Override
public void unregister(URL url) {
this.unregister(new com.alibaba.dubbo.common.DelegateURL(url));
}
@Override
public void subscribe(URL url, NotifyListener listener) {
this.subscribe(
new com.alibaba.dubbo.common.DelegateURL(url),
new com.alibaba.dubbo.registry.NotifyListener.CompatibleNotifyListener(listener));
}
@Override
public void unsubscribe(URL url, NotifyListener listener) {
this.unsubscribe(
new com.alibaba.dubbo.common.DelegateURL(url),
new com.alibaba.dubbo.registry.NotifyListener.CompatibleNotifyListener(listener));
}
final Set<com.alibaba.dubbo.registry.NotifyListener> convertToNotifyListeners(Set<NotifyListener> notifyListeners) {
return notifyListeners.stream()
.map(listener -> new com.alibaba.dubbo.registry.NotifyListener.CompatibleNotifyListener(listener))
.collect(Collectors.toSet());
}
static class CompatibleAbstractRegistry extends org.apache.dubbo.registry.support.AbstractRegistry {
public CompatibleAbstractRegistry(URL url) {
super(url);
}
@Override
public boolean isAvailable() {
return false;
}
@Override
public void notify(URL url, NotifyListener listener, List<URL> urls) {
super.notify(url, listener, urls);
}
@Override
public void setUrl(URL url) {
super.setUrl(url);
}
}
}
| java | Apache-2.0 | ac1621f9a0470054c0308c47f84c7668f6bc2868 | 2026-01-04T14:45:57.057261Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/util/TestUtil.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/util/TestUtil.java | package com.alibaba.easyexcel.test.util;
import java.text.ParseException;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
import com.alibaba.excel.util.DateUtils;
import lombok.extern.slf4j.Slf4j;
/**
* test util
*
* @author Jiaju Zhuang
*/
@Slf4j
public class TestUtil {
public static final Date TEST_DATE;
public static final LocalDate TEST_LOCAL_DATE = LocalDate.of(2020, 1, 1);
public static final LocalDateTime TEST_LOCAL_DATE_TIME = LocalDateTime.of(2020, 1, 1, 1, 1, 1);
static {
try {
TEST_DATE = DateUtils.parseDate("2020-01-01 01:01:01");
} catch (ParseException e) {
log.error("init TestUtil error.", e);
throw new RuntimeException(e);
}
}
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/util/TestFileUtil.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/util/TestFileUtil.java | package com.alibaba.easyexcel.test.util;
import java.io.File;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.collections4.CollectionUtils;
public class TestFileUtil {
public static InputStream getResourcesFileInputStream(String fileName) {
return Thread.currentThread().getContextClassLoader().getResourceAsStream("" + fileName);
}
public static String getPath() {
return TestFileUtil.class.getResource("/").getPath();
}
public static TestPathBuild pathBuild() {
return new TestPathBuild();
}
public static File createNewFile(String pathName) {
File file = new File(getPath() + pathName);
if (file.exists()) {
file.delete();
} else {
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
}
return file;
}
public static File readFile(String pathName) {
return new File(getPath() + pathName);
}
public static File readUserHomeFile(String pathName) {
return new File(System.getProperty("user.home") + File.separator + pathName);
}
/**
* build to test file path
**/
public static class TestPathBuild {
private TestPathBuild() {
subPath = new ArrayList<>();
}
private final List<String> subPath;
public TestPathBuild sub(String dirOrFile) {
subPath.add(dirOrFile);
return this;
}
public String getPath() {
if (CollectionUtils.isEmpty(subPath)) {
return TestFileUtil.class.getResource("/").getPath();
}
if (subPath.size() == 1) {
return TestFileUtil.class.getResource("/").getPath() + subPath.get(0);
}
StringBuilder path = new StringBuilder(TestFileUtil.class.getResource("/").getPath());
path.append(subPath.get(0));
for (int i = 1; i < subPath.size(); i++) {
path.append(File.separator).append(subPath.get(i));
}
return path.toString();
}
}
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/StyleTestUtils.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/StyleTestUtils.java | package com.alibaba.easyexcel.test.core;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFCell;
public class StyleTestUtils {
public static byte[] getFillForegroundColor(Cell cell) {
if (cell instanceof XSSFCell) {
return ((XSSFCell)cell).getCellStyle().getFillForegroundColorColor().getRGB();
} else {
return short2byte(((HSSFCell)cell).getCellStyle().getFillForegroundColorColor().getTriplet());
}
}
public static byte[] getFontColor(Cell cell, Workbook workbook) {
if (cell instanceof XSSFCell) {
return ((XSSFCell)cell).getCellStyle().getFont().getXSSFColor().getRGB();
} else {
return short2byte(((HSSFCell)cell).getCellStyle().getFont(workbook).getHSSFColor((HSSFWorkbook)workbook)
.getTriplet());
}
}
public static short getFontHeightInPoints(Cell cell, Workbook workbook) {
if (cell instanceof XSSFCell) {
return ((XSSFCell)cell).getCellStyle().getFont().getFontHeightInPoints();
} else {
return ((HSSFCell)cell).getCellStyle().getFont(workbook).getFontHeightInPoints();
}
}
private static byte[] short2byte(short[] shorts) {
byte[] bytes = new byte[shorts.length];
for (int i = 0; i < shorts.length; i++) {
bytes[i] = (byte)shorts[i];
}
return bytes;
}
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/sort/SortDataTest.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/sort/SortDataTest.java | package com.alibaba.easyexcel.test.core.sort;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import com.alibaba.easyexcel.test.util.TestFileUtil;
import com.alibaba.excel.EasyExcel;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
/**
* @author Jiaju Zhuang
*/
@TestMethodOrder(MethodOrderer.MethodName.class)
public class SortDataTest {
private static File file07;
private static File file03;
private static File fileCsv;
private static File sortNoHead07;
private static File sortNoHead03;
private static File sortNoHeadCsv;
@BeforeAll
public static void init() {
file07 = TestFileUtil.createNewFile("sort.xlsx");
file03 = TestFileUtil.createNewFile("sort.xls");
fileCsv = TestFileUtil.createNewFile("sort.csv");
sortNoHead07 = TestFileUtil.createNewFile("sortNoHead.xlsx");
sortNoHead03 = TestFileUtil.createNewFile("sortNoHead.xls");
sortNoHeadCsv = TestFileUtil.createNewFile("sortNoHead.csv");
}
@Test
public void t01ReadAndWrite07() {
readAndWrite(file07);
}
@Test
public void t02ReadAndWrite03() {
readAndWrite(file03);
}
@Test
public void t03ReadAndWriteCsv() {
readAndWrite(fileCsv);
}
@Test
public void t11ReadAndWriteNoHead07() {
readAndWriteNoHead(sortNoHead07);
}
@Test
public void t12ReadAndWriteNoHead03() {
readAndWriteNoHead(sortNoHead03);
}
@Test
public void t13ReadAndWriteNoHeadCsv() {
readAndWriteNoHead(sortNoHeadCsv);
}
private void readAndWrite(File file) {
EasyExcel.write(file, SortData.class).sheet().doWrite(data());
List<Map<Integer, String>> dataMap = EasyExcel.read(file).sheet().doReadSync();
Assertions.assertEquals(1, dataMap.size());
Map<Integer, String> record = dataMap.get(0);
Assertions.assertEquals("column1", record.get(0));
Assertions.assertEquals("column2", record.get(1));
Assertions.assertEquals("column3", record.get(2));
Assertions.assertEquals("column4", record.get(3));
Assertions.assertEquals("column5", record.get(4));
Assertions.assertEquals("column6", record.get(5));
EasyExcel.read(file, SortData.class, new SortDataListener()).sheet().doRead();
}
private void readAndWriteNoHead(File file) {
EasyExcel.write(file).head(head()).sheet().doWrite(data());
List<Map<Integer, String>> dataMap = EasyExcel.read(file).sheet().doReadSync();
Assertions.assertEquals(1, dataMap.size());
Map<Integer, String> record = dataMap.get(0);
Assertions.assertEquals("column1", record.get(0));
Assertions.assertEquals("column2", record.get(1));
Assertions.assertEquals("column3", record.get(2));
Assertions.assertEquals("column4", record.get(3));
Assertions.assertEquals("column5", record.get(4));
Assertions.assertEquals("column6", record.get(5));
EasyExcel.read(file, SortData.class, new SortDataListener()).sheet().doRead();
}
private List<List<String>> head() {
List<List<String>> head = new ArrayList<List<String>>();
head.add(Collections.singletonList("column1"));
head.add(Collections.singletonList("column2"));
head.add(Collections.singletonList("column3"));
head.add(Collections.singletonList("column4"));
head.add(Collections.singletonList("column5"));
head.add(Collections.singletonList("column6"));
return head;
}
private List<SortData> data() {
List<SortData> list = new ArrayList<SortData>();
SortData sortData = new SortData();
sortData.setColumn1("column1");
sortData.setColumn2("column2");
sortData.setColumn3("column3");
sortData.setColumn4("column4");
sortData.setColumn5("column5");
sortData.setColumn6("column6");
list.add(sortData);
return list;
}
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/sort/SortData.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/sort/SortData.java | package com.alibaba.easyexcel.test.core.sort;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
/**
* @author Jiaju Zhuang
*/
@Getter
@Setter
@EqualsAndHashCode
public class SortData {
private String column5;
private String column6;
@ExcelProperty(order = 100)
private String column4;
@ExcelProperty(order = 99)
private String column3;
@ExcelProperty(value = "column2", index = 1)
private String column2;
@ExcelProperty(value = "column1", index = 0)
private String column1;
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/sort/SortDataListener.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/sort/SortDataListener.java | package com.alibaba.easyexcel.test.core.sort;
import java.util.ArrayList;
import java.util.List;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import org.junit.jupiter.api.Assertions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Jiaju Zhuang
*/
public class SortDataListener extends AnalysisEventListener<SortData> {
private static final Logger LOGGER = LoggerFactory.getLogger(SortDataListener.class);
List<SortData> list = new ArrayList<SortData>();
@Override
public void invoke(SortData data, AnalysisContext context) {
list.add(data);
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
Assertions.assertEquals(list.size(), 1);
SortData sortData = list.get(0);
Assertions.assertEquals("column1", sortData.getColumn1());
Assertions.assertEquals("column2", sortData.getColumn2());
Assertions.assertEquals("column3", sortData.getColumn3());
Assertions.assertEquals("column4", sortData.getColumn4());
Assertions.assertEquals("column5", sortData.getColumn5());
Assertions.assertEquals("column6", sortData.getColumn6());
}
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/charset/CharsetData.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/charset/CharsetData.java | package com.alibaba.easyexcel.test.core.charset;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@EqualsAndHashCode
public class CharsetData {
@ExcelProperty("姓名")
private String name;
@ExcelProperty("年纪")
private Integer age;
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/charset/CharsetDataTest.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/charset/CharsetDataTest.java | package com.alibaba.easyexcel.test.core.charset;
import java.io.File;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Map;
import com.alibaba.easyexcel.test.util.TestFileUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.metadata.data.ReadCellData;
import com.alibaba.excel.read.listener.ReadListener;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.compress.utils.Lists;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
/**
* charset
*
* @author Jiaju Zhuang
*/
@Slf4j
@TestMethodOrder(MethodOrderer.MethodName.class)
public class CharsetDataTest {
private static final Charset GBK = Charset.forName("GBK");
private static File fileCsvGbk;
private static File fileCsvUtf8;
private static File fileCsvError;
@BeforeAll
public static void init() {
fileCsvGbk = TestFileUtil.createNewFile("charset" + File.separator + "fileCsvGbk.csv");
fileCsvUtf8 = TestFileUtil.createNewFile("charset" + File.separator + "fileCsvUtf8.csv");
fileCsvError = TestFileUtil.createNewFile("charset" + File.separator + "fileCsvError.csv");
}
@Test
public void t01ReadAndWriteCsv() {
readAndWrite(fileCsvGbk, GBK);
readAndWrite(fileCsvUtf8, StandardCharsets.UTF_8);
}
@Test
public void t02ReadAndWriteCsvError() {
EasyExcel.write(fileCsvError, CharsetData.class).charset(GBK).sheet().doWrite(data());
EasyExcel.read(fileCsvError, CharsetData.class, new ReadListener<CharsetData>() {
private final List<CharsetData> dataList = Lists.newArrayList();
@Override
public void invokeHead(Map<Integer, ReadCellData<?>> headMap, AnalysisContext context) {
String head = headMap.get(0).getStringValue();
Assertions.assertNotEquals("姓名", head);
}
@Override
public void invoke(CharsetData data, AnalysisContext context) {
dataList.add(data);
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
}
}).charset(StandardCharsets.UTF_8).sheet().doRead();
}
private void readAndWrite(File file, Charset charset) {
EasyExcel.write(file, CharsetData.class).charset(charset).sheet().doWrite(data());
EasyExcel.read(file, CharsetData.class, new ReadListener<CharsetData>() {
private final List<CharsetData> dataList = Lists.newArrayList();
@Override
public void invokeHead(Map<Integer, ReadCellData<?>> headMap, AnalysisContext context) {
String head = headMap.get(0).getStringValue();
Assertions.assertEquals("姓名", head);
}
@Override
public void invoke(CharsetData data, AnalysisContext context) {
dataList.add(data);
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
Assertions.assertEquals(dataList.size(), 10);
CharsetData charsetData = dataList.get(0);
Assertions.assertEquals("姓名0", charsetData.getName());
Assertions.assertEquals(0, (long)charsetData.getAge());
}
}).charset(charset).sheet().doRead();
}
private List<CharsetData> data() {
List<CharsetData> list = Lists.newArrayList();
for (int i = 0; i < 10; i++) {
CharsetData data = new CharsetData();
data.setName("姓名" + i);
data.setAge(i);
list.add(data);
}
return list;
}
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/excludeorinclude/ExcludeOrIncludeData.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/excludeorinclude/ExcludeOrIncludeData.java | package com.alibaba.easyexcel.test.core.excludeorinclude;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
/**
* @author Jiaju Zhuang
*/
@Getter
@Setter
@EqualsAndHashCode
public class ExcludeOrIncludeData {
@ExcelProperty(order = 1)
private String column1;
@ExcelProperty(order = 2)
private String column2;
@ExcelProperty(order = 3)
private String column3;
@ExcelProperty(order = 4)
private String column4;
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/excludeorinclude/ExcludeOrIncludeDataTest.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/excludeorinclude/ExcludeOrIncludeDataTest.java | package com.alibaba.easyexcel.test.core.excludeorinclude;
import com.alibaba.easyexcel.test.util.TestFileUtil;
import com.alibaba.excel.EasyExcel;
import org.junit.jupiter.api.*;
import java.io.File;
import java.util.*;
/**
* @author Jiaju Zhuang
*/
@TestMethodOrder(MethodOrderer.MethodName.class)
public class ExcludeOrIncludeDataTest {
private static File excludeIndex07;
private static File excludeIndex03;
private static File excludeIndexCsv;
private static File excludeFieldName07;
private static File excludeFieldName03;
private static File excludeFieldNameCsv;
private static File includeIndex07;
private static File includeIndex03;
private static File includeIndexCsv;
private static File includeFieldName07;
private static File includeFieldName03;
private static File includeFieldNameCsv;
private static File includeFieldNameOrder07;
private static File includeFieldNameOrder03;
private static File includeFieldNameOrderCsv;
private static File includeFieldNameOrderIndex07;
private static File includeFieldNameOrderIndex03;
private static File includeFieldNameOrderIndexCsv;
@BeforeAll
public static void init() {
excludeIndex07 = TestFileUtil.createNewFile("excludeIndex.xlsx");
excludeIndex03 = TestFileUtil.createNewFile("excludeIndex.xls");
excludeIndexCsv = TestFileUtil.createNewFile("excludeIndex.csv");
excludeFieldName07 = TestFileUtil.createNewFile("excludeFieldName.xlsx");
excludeFieldName03 = TestFileUtil.createNewFile("excludeFieldName.xls");
excludeFieldNameCsv = TestFileUtil.createNewFile("excludeFieldName.csv");
includeIndex07 = TestFileUtil.createNewFile("includeIndex.xlsx");
includeIndex03 = TestFileUtil.createNewFile("includeIndex.xls");
includeIndexCsv = TestFileUtil.createNewFile("includeIndex.csv");
includeFieldName07 = TestFileUtil.createNewFile("includeFieldName.xlsx");
includeFieldName03 = TestFileUtil.createNewFile("includeFieldName.xls");
includeFieldNameCsv = TestFileUtil.createNewFile("includeFieldName.csv");
includeFieldNameOrder07 = TestFileUtil.createNewFile("includeFieldNameOrder.xlsx");
includeFieldNameOrder03 = TestFileUtil.createNewFile("includeFieldNameOrder.xls");
includeFieldNameOrderCsv = TestFileUtil.createNewFile("includeFieldNameOrder.csv");
includeFieldNameOrderIndex07 = TestFileUtil.createNewFile("includeFieldNameOrderIndex.xlsx");
includeFieldNameOrderIndex03 = TestFileUtil.createNewFile("includeFieldNameOrderIndex.xls");
includeFieldNameOrderIndexCsv = TestFileUtil.createNewFile("includeFieldNameOrderIndex.csv");
}
@Test
public void t01ExcludeIndex07() {
excludeIndex(excludeIndex07);
}
@Test
public void t02ExcludeIndex03() {
excludeIndex(excludeIndex03);
}
@Test
public void t03ExcludeIndexCsv() {
excludeIndex(excludeIndexCsv);
}
@Test
public void t11ExcludeFieldName07() {
excludeFieldName(excludeFieldName07);
}
@Test
public void t12ExcludeFieldName03() {
excludeFieldName(excludeFieldName03);
}
@Test
public void t13ExcludeFieldNameCsv() {
excludeFieldName(excludeFieldNameCsv);
}
@Test
public void t21IncludeIndex07() {
includeIndex(includeIndex07);
}
@Test
public void t22IncludeIndex03() {
includeIndex(includeIndex03);
}
@Test
public void t23IncludeIndexCsv() {
includeIndex(includeIndexCsv);
}
@Test
public void t31IncludeFieldName07() {
includeFieldName(includeFieldName07);
}
@Test
public void t32IncludeFieldName03() {
includeFieldName(includeFieldName03);
}
@Test
public void t33IncludeFieldNameCsv() {
includeFieldName(includeFieldNameCsv);
}
@Test
public void t41IncludeFieldNameOrder07() {
includeFieldNameOrder(includeFieldNameOrder07);
}
@Test
public void t42IncludeFieldNameOrder03() {
includeFieldNameOrder(includeFieldNameOrder03);
}
@Test
public void t43IncludeFieldNameOrderCsv() {
includeFieldNameOrder(includeFieldNameOrderCsv);
}
@Test
public void t41IncludeFieldNameOrderIndex07() {
includeFieldNameOrderIndex(includeFieldNameOrderIndex07);
}
@Test
public void t42IncludeFieldNameOrderIndex03() {
includeFieldNameOrderIndex(includeFieldNameOrderIndex03);
}
@Test
public void t43IncludeFieldNameOrderIndexCsv() {
includeFieldNameOrderIndex(includeFieldNameOrderIndexCsv);
}
private void excludeIndex(File file) {
Set<Integer> excludeColumnIndexes = new HashSet<Integer>();
excludeColumnIndexes.add(0);
excludeColumnIndexes.add(3);
EasyExcel.write(file, ExcludeOrIncludeData.class).excludeColumnIndexes(excludeColumnIndexes).sheet()
.doWrite(data());
List<Map<Integer, String>> dataMap = EasyExcel.read(file).sheet().doReadSync();
Assertions.assertEquals(1, dataMap.size());
Map<Integer, String> record = dataMap.get(0);
Assertions.assertEquals(2, record.size());
Assertions.assertEquals("column2", record.get(0));
Assertions.assertEquals("column3", record.get(1));
}
private void excludeFieldName(File file) {
Set<String> excludeColumnFieldNames = new HashSet<String>();
excludeColumnFieldNames.add("column1");
excludeColumnFieldNames.add("column3");
excludeColumnFieldNames.add("column4");
EasyExcel.write(file, ExcludeOrIncludeData.class).excludeColumnFieldNames(excludeColumnFieldNames).sheet()
.doWrite(data());
List<Map<Integer, String>> dataMap = EasyExcel.read(file).sheet().doReadSync();
Assertions.assertEquals(1, dataMap.size());
Map<Integer, String> record = dataMap.get(0);
Assertions.assertEquals(1, record.size());
Assertions.assertEquals("column2", record.get(0));
}
private void includeIndex(File file) {
Set<Integer> includeColumnIndexes = new HashSet<Integer>();
includeColumnIndexes.add(1);
includeColumnIndexes.add(2);
EasyExcel.write(file, ExcludeOrIncludeData.class).includeColumnIndexes(includeColumnIndexes).sheet()
.doWrite(data());
List<Map<Integer, String>> dataMap = EasyExcel.read(file).sheet().doReadSync();
Assertions.assertEquals(1, dataMap.size());
Map<Integer, String> record = dataMap.get(0);
Assertions.assertEquals(2, record.size());
Assertions.assertEquals("column2", record.get(0));
Assertions.assertEquals("column3", record.get(1));
}
private void includeFieldName(File file) {
Set<String> includeColumnFieldNames = new HashSet<String>();
includeColumnFieldNames.add("column2");
includeColumnFieldNames.add("column3");
EasyExcel.write(file, ExcludeOrIncludeData.class)
.sheet()
.includeColumnFieldNames(includeColumnFieldNames)
.doWrite(data());
List<Map<Integer, String>> dataMap = EasyExcel.read(file).sheet().doReadSync();
Assertions.assertEquals(1, dataMap.size());
Map<Integer, String> record = dataMap.get(0);
Assertions.assertEquals(2, record.size());
Assertions.assertEquals("column2", record.get(0));
Assertions.assertEquals("column3", record.get(1));
}
private void includeFieldNameOrderIndex(File file) {
List<Integer> includeColumnIndexes = new ArrayList<>();
includeColumnIndexes.add(3);
includeColumnIndexes.add(1);
includeColumnIndexes.add(2);
includeColumnIndexes.add(0);
EasyExcel.write(file, ExcludeOrIncludeData.class)
.includeColumnIndexes(includeColumnIndexes)
.orderByIncludeColumn(true).
sheet()
.doWrite(data());
List<Map<Integer, String>> dataMap = EasyExcel.read(file).sheet().doReadSync();
Assertions.assertEquals(1, dataMap.size());
Map<Integer, String> record = dataMap.get(0);
Assertions.assertEquals(4, record.size());
Assertions.assertEquals("column4", record.get(0));
Assertions.assertEquals("column2", record.get(1));
Assertions.assertEquals("column3", record.get(2));
Assertions.assertEquals("column1", record.get(3));
}
private void includeFieldNameOrder(File file) {
List<String> includeColumnFieldNames = new ArrayList<>();
includeColumnFieldNames.add("column4");
includeColumnFieldNames.add("column2");
includeColumnFieldNames.add("column3");
EasyExcel.write(file, ExcludeOrIncludeData.class)
.includeColumnFieldNames(includeColumnFieldNames)
.orderByIncludeColumn(true).
sheet()
.doWrite(data());
List<Map<Integer, String>> dataMap = EasyExcel.read(file).sheet().doReadSync();
Assertions.assertEquals(1, dataMap.size());
Map<Integer, String> record = dataMap.get(0);
Assertions.assertEquals(3, record.size());
Assertions.assertEquals("column4", record.get(0));
Assertions.assertEquals("column2", record.get(1));
Assertions.assertEquals("column3", record.get(2));
}
private List<ExcludeOrIncludeData> data() {
List<ExcludeOrIncludeData> list = new ArrayList<ExcludeOrIncludeData>();
ExcludeOrIncludeData excludeOrIncludeData = new ExcludeOrIncludeData();
excludeOrIncludeData.setColumn1("column1");
excludeOrIncludeData.setColumn2("column2");
excludeOrIncludeData.setColumn3("column3");
excludeOrIncludeData.setColumn4("column4");
list.add(excludeOrIncludeData);
return list;
}
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/cache/CacheDataTest.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/cache/CacheDataTest.java | package com.alibaba.easyexcel.test.core.cache;
import java.io.File;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.alibaba.easyexcel.test.demo.read.DemoData;
import com.alibaba.easyexcel.test.util.TestFileUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.enums.CacheLocationEnum;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.excel.metadata.FieldCache;
import com.alibaba.excel.read.listener.PageReadListener;
import com.alibaba.excel.util.ClassUtils;
import com.alibaba.excel.util.FieldUtils;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
/**
* @author Jiaju Zhuang
*/
@TestMethodOrder(MethodOrderer.MethodName.class)
@Slf4j
public class CacheDataTest {
private static File file07;
private static File fileCacheInvoke;
private static File fileCacheInvoke2;
private static File fileCacheInvokeMemory;
private static File fileCacheInvokeMemory2;
@BeforeAll
public static void init() {
file07 = TestFileUtil.createNewFile("cache/cache.xlsx");
fileCacheInvoke = TestFileUtil.createNewFile("cache/fileCacheInvoke.xlsx");
fileCacheInvoke2 = TestFileUtil.createNewFile("cache/fileCacheInvoke2.xlsx");
fileCacheInvokeMemory = TestFileUtil.createNewFile("cache/fileCacheInvokeMemory.xlsx");
fileCacheInvokeMemory2 = TestFileUtil.createNewFile("cache/fileCacheInvokeMemory2.xlsx");
}
@Test
public void t01ReadAndWrite() throws Exception {
Field field = FieldUtils.getField(ClassUtils.class, "FIELD_THREAD_LOCAL", true);
ThreadLocal<Map<Class<?>, FieldCache>> fieldThreadLocal = (ThreadLocal<Map<Class<?>, FieldCache>>)field.get(
ClassUtils.class.newInstance());
Assertions.assertNull(fieldThreadLocal.get());
EasyExcel.write(file07, CacheData.class).sheet().doWrite(data());
EasyExcel.read(file07, CacheData.class, new PageReadListener<DemoData>(dataList -> {
Assertions.assertNotNull(fieldThreadLocal.get());
}))
.sheet()
.doRead();
Assertions.assertNull(fieldThreadLocal.get());
}
@Test
public void t02ReadAndWriteInvoke() throws Exception {
EasyExcel.write(fileCacheInvoke, CacheInvokeData.class).sheet().doWrite(dataInvoke());
EasyExcel.read(fileCacheInvoke, CacheInvokeData.class, new AnalysisEventListener<CacheInvokeData>() {
@Override
public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
Assertions.assertEquals(2, headMap.size());
Assertions.assertEquals("姓名", headMap.get(0));
Assertions.assertEquals("年龄", headMap.get(1));
}
@Override
public void invoke(CacheInvokeData data, AnalysisContext context) {
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
}
}).sheet()
.doRead();
Field name = FieldUtils.getField(CacheInvokeData.class, "name", true);
ExcelProperty annotation = name.getAnnotation(ExcelProperty.class);
InvocationHandler invocationHandler = Proxy.getInvocationHandler(annotation);
Field memberValues = invocationHandler.getClass().getDeclaredField("memberValues");
memberValues.setAccessible(true);
Map map = (Map)memberValues.get(invocationHandler);
map.put("value", new String[] {"姓名2"});
EasyExcel.write(fileCacheInvoke2, CacheInvokeData.class).sheet().doWrite(dataInvoke());
EasyExcel.read(fileCacheInvoke2, CacheInvokeData.class, new AnalysisEventListener<CacheInvokeData>() {
@Override
public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
Assertions.assertEquals(2, headMap.size());
Assertions.assertEquals("姓名2", headMap.get(0));
Assertions.assertEquals("年龄", headMap.get(1));
}
@Override
public void invoke(CacheInvokeData data, AnalysisContext context) {
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
}
}).sheet()
.doRead();
}
@Test
public void t03ReadAndWriteInvokeMemory() throws Exception {
EasyExcel.write(fileCacheInvokeMemory, CacheInvokeMemoryData.class)
.filedCacheLocation(CacheLocationEnum.MEMORY)
.sheet()
.doWrite(dataInvokeMemory());
EasyExcel.read(fileCacheInvokeMemory, CacheInvokeMemoryData.class,
new AnalysisEventListener<CacheInvokeMemoryData>() {
@Override
public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
Assertions.assertEquals(2, headMap.size());
Assertions.assertEquals("姓名", headMap.get(0));
Assertions.assertEquals("年龄", headMap.get(1));
}
@Override
public void invoke(CacheInvokeMemoryData data, AnalysisContext context) {
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
}
})
.filedCacheLocation(CacheLocationEnum.MEMORY)
.sheet()
.doRead();
Field name = FieldUtils.getField(CacheInvokeMemoryData.class, "name", true);
ExcelProperty annotation = name.getAnnotation(ExcelProperty.class);
InvocationHandler invocationHandler = Proxy.getInvocationHandler(annotation);
Field memberValues = invocationHandler.getClass().getDeclaredField("memberValues");
memberValues.setAccessible(true);
Map map = (Map)memberValues.get(invocationHandler);
map.put("value", new String[] {"姓名2"});
EasyExcel.write(fileCacheInvokeMemory2, CacheInvokeMemoryData.class)
.filedCacheLocation(CacheLocationEnum.MEMORY)
.sheet()
.doWrite(dataInvokeMemory());
EasyExcel.read(fileCacheInvokeMemory2, CacheInvokeMemoryData.class,
new AnalysisEventListener<CacheInvokeMemoryData>() {
@Override
public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
Assertions.assertEquals(2, headMap.size());
Assertions.assertEquals("姓名", headMap.get(0));
Assertions.assertEquals("年龄", headMap.get(1));
}
@Override
public void invoke(CacheInvokeMemoryData data, AnalysisContext context) {
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
}
})
.filedCacheLocation(CacheLocationEnum.MEMORY)
.sheet()
.doRead();
}
private List<CacheData> data() {
List<CacheData> list = new ArrayList<CacheData>();
for (int i = 0; i < 10; i++) {
CacheData simpleData = new CacheData();
simpleData.setName("姓名" + i);
simpleData.setAge((long)i);
list.add(simpleData);
}
return list;
}
private List<CacheInvokeData> dataInvoke() {
List<CacheInvokeData> list = new ArrayList<>();
for (int i = 0; i < 10; i++) {
CacheInvokeData simpleData = new CacheInvokeData();
simpleData.setName("姓名" + i);
simpleData.setAge((long)i);
list.add(simpleData);
}
return list;
}
private List<CacheInvokeMemoryData> dataInvokeMemory() {
List<CacheInvokeMemoryData> list = new ArrayList<>();
for (int i = 0; i < 10; i++) {
CacheInvokeMemoryData simpleData = new CacheInvokeMemoryData();
simpleData.setName("姓名" + i);
simpleData.setAge((long)i);
list.add(simpleData);
}
return list;
}
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/cache/CacheInvokeMemoryData.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/cache/CacheInvokeMemoryData.java | package com.alibaba.easyexcel.test.core.cache;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
/**
* @author Jiaju Zhuang
*/
@Getter
@Setter
@EqualsAndHashCode
public class CacheInvokeMemoryData {
@ExcelProperty("姓名")
private String name;
@ExcelProperty("年龄")
private Long age;
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/cache/CacheData.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/cache/CacheData.java | package com.alibaba.easyexcel.test.core.cache;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
/**
* @author Jiaju Zhuang
*/
@Getter
@Setter
@EqualsAndHashCode
public class CacheData {
@ExcelProperty("姓名")
private String name;
@ExcelProperty("年龄")
private Long age;
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/cache/CacheInvokeData.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/cache/CacheInvokeData.java | package com.alibaba.easyexcel.test.core.cache;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
/**
* @author Jiaju Zhuang
*/
@Getter
@Setter
@EqualsAndHashCode
public class CacheInvokeData {
@ExcelProperty("姓名")
private String name;
@ExcelProperty("年龄")
private Long age;
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/skip/SkipData.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/skip/SkipData.java | package com.alibaba.easyexcel.test.core.skip;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
/**
* @author Jiaju Zhuang
*/
@Getter
@Setter
@EqualsAndHashCode
public class SkipData {
@ExcelProperty("姓名")
private String name;
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/skip/SkipDataTest.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/skip/SkipDataTest.java | package com.alibaba.easyexcel.test.core.skip;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import com.alibaba.easyexcel.test.core.simple.SimpleData;
import com.alibaba.easyexcel.test.util.TestFileUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelReader;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.event.SyncReadListener;
import com.alibaba.excel.exception.ExcelGenerateException;
import com.alibaba.excel.read.metadata.ReadSheet;
import com.alibaba.excel.write.metadata.WriteSheet;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
/**
* @author Jiaju Zhuang
*/
@TestMethodOrder(MethodOrderer.MethodName.class)
public class SkipDataTest {
private static File file07;
private static File file03;
private static File fileCsv;
@BeforeAll
public static void init() {
file07 = TestFileUtil.createNewFile("skip.xlsx");
file03 = TestFileUtil.createNewFile("skip.xls");
fileCsv = TestFileUtil.createNewFile("skip.csv");
}
@Test
public void t01ReadAndWrite07() {
readAndWrite(file07);
}
@Test
public void t02ReadAndWrite03() {
readAndWrite(file03);
}
@Test
public void t03ReadAndWriteCsv() {
Assertions.assertThrows(ExcelGenerateException.class, () -> readAndWrite(fileCsv));
}
private void readAndWrite(File file) {
try (ExcelWriter excelWriter = EasyExcel.write(file, SimpleData.class).build();) {
WriteSheet writeSheet0 = EasyExcel.writerSheet(0, "第一个").build();
WriteSheet writeSheet1 = EasyExcel.writerSheet(1, "第二个").build();
WriteSheet writeSheet2 = EasyExcel.writerSheet(2, "第三个").build();
WriteSheet writeSheet3 = EasyExcel.writerSheet(3, "第四个").build();
excelWriter.write(data("name1"), writeSheet0);
excelWriter.write(data("name2"), writeSheet1);
excelWriter.write(data("name3"), writeSheet2);
excelWriter.write(data("name4"), writeSheet3);
}
List<SkipData> list = EasyExcel.read(file, SkipData.class, null).sheet("第二个").doReadSync();
Assertions.assertEquals(1, list.size());
Assertions.assertEquals("name2", list.get(0).getName());
SyncReadListener syncReadListener = new SyncReadListener();
try (ExcelReader excelReader = EasyExcel.read(file, SkipData.class, null).registerReadListener(syncReadListener)
.build()) {
ReadSheet readSheet1 = EasyExcel.readSheet("第二个").build();
ReadSheet readSheet3 = EasyExcel.readSheet("第四个").build();
excelReader.read(readSheet1, readSheet3);
List<Object> syncList = syncReadListener.getList();
Assertions.assertEquals(2, syncList.size());
Assertions.assertEquals("name2", ((SkipData)syncList.get(0)).getName());
Assertions.assertEquals("name4", ((SkipData)syncList.get(1)).getName());
}
}
private List<SkipData> data(String name) {
List<SkipData> list = new ArrayList<SkipData>();
SkipData data = new SkipData();
data.setName(name);
list.add(data);
return list;
}
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/head/ComplexHeadData.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/head/ComplexHeadData.java | package com.alibaba.easyexcel.test.core.head;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
/**
* @author Jiaju Zhuang
*/
@Getter
@Setter
@EqualsAndHashCode
public class ComplexHeadData {
@ExcelProperty({"顶格", "顶格", "两格"})
private String string0;
@ExcelProperty({"顶格", "顶格", "两格"})
private String string1;
@ExcelProperty({"顶格", "四联", "四联"})
private String string2;
@ExcelProperty({"顶格", "四联", "四联"})
private String string3;
@ExcelProperty({"顶格"})
private String string4;
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/head/NoHeadDataListener.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/head/NoHeadDataListener.java | package com.alibaba.easyexcel.test.core.head;
import java.util.ArrayList;
import java.util.List;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.fastjson2.JSON;
import org.junit.jupiter.api.Assertions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Jiaju Zhuang
*/
public class NoHeadDataListener extends AnalysisEventListener<NoHeadData> {
private static final Logger LOGGER = LoggerFactory.getLogger(NoHeadData.class);
List<NoHeadData> list = new ArrayList<NoHeadData>();
@Override
public void invoke(NoHeadData data, AnalysisContext context) {
list.add(data);
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
Assertions.assertEquals(list.size(), 1);
NoHeadData data = list.get(0);
Assertions.assertEquals(data.getString(), "字符串0");
LOGGER.debug("First row:{}", JSON.toJSONString(list.get(0)));
}
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/head/NoHeadDataTest.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/head/NoHeadDataTest.java | package com.alibaba.easyexcel.test.core.head;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import com.alibaba.easyexcel.test.util.TestFileUtil;
import com.alibaba.excel.EasyExcel;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
/**
* @author Jiaju Zhuang
*/
@TestMethodOrder(MethodOrderer.MethodName.class)
public class NoHeadDataTest {
private static File file07;
private static File file03;
private static File fileCsv;
@BeforeAll
public static void init() {
file07 = TestFileUtil.createNewFile("noHead07.xlsx");
file03 = TestFileUtil.createNewFile("noHead03.xls");
fileCsv = TestFileUtil.createNewFile("noHeadCsv.csv");
}
@Test
public void t01ReadAndWrite07() {
readAndWrite(file07);
}
@Test
public void t02ReadAndWrite03() {
readAndWrite(file03);
}
@Test
public void t03ReadAndWriteCsv() {
readAndWrite(fileCsv);
}
private void readAndWrite(File file) {
EasyExcel.write(file, NoHeadData.class).needHead(Boolean.FALSE).sheet().doWrite(data());
EasyExcel.read(file, NoHeadData.class, new NoHeadDataListener()).headRowNumber(0).sheet().doRead();
}
private List<NoHeadData> data() {
List<NoHeadData> list = new ArrayList<NoHeadData>();
NoHeadData data = new NoHeadData();
data.setString("字符串0");
list.add(data);
return list;
}
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/head/NoHeadData.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/head/NoHeadData.java | package com.alibaba.easyexcel.test.core.head;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
/**
* @author Jiaju Zhuang
*/
@Getter
@Setter
@EqualsAndHashCode
public class NoHeadData {
@ExcelProperty("字符串")
private String string;
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/head/ComplexHeadDataTest.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/head/ComplexHeadDataTest.java | package com.alibaba.easyexcel.test.core.head;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import com.alibaba.easyexcel.test.util.TestFileUtil;
import com.alibaba.excel.EasyExcel;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
/**
* @author Jiaju Zhuang
*/
@TestMethodOrder(MethodOrderer.MethodName.class)
public class ComplexHeadDataTest {
private static File file07;
private static File file03;
private static File fileCsv;
private static File file07AutomaticMergeHead;
private static File file03AutomaticMergeHead;
private static File fileCsvAutomaticMergeHead;
@BeforeAll
public static void init() {
file07 = TestFileUtil.createNewFile("complexHead07.xlsx");
file03 = TestFileUtil.createNewFile("complexHead03.xls");
fileCsv = TestFileUtil.createNewFile("complexHeadCsv.csv");
file07AutomaticMergeHead = TestFileUtil.createNewFile("complexHeadAutomaticMergeHead07.xlsx");
file03AutomaticMergeHead = TestFileUtil.createNewFile("complexHeadAutomaticMergeHead03.xls");
fileCsvAutomaticMergeHead = TestFileUtil.createNewFile("complexHeadAutomaticMergeHeadCsv.csv");
}
@Test
public void t01ReadAndWrite07() {
readAndWrite(file07);
}
@Test
public void t02ReadAndWrite03() {
readAndWrite(file03);
}
@Test
public void t03ReadAndWriteCsv() {
readAndWrite(fileCsv);
}
private void readAndWrite(File file) {
EasyExcel.write(file, ComplexHeadData.class).sheet().doWrite(data());
EasyExcel.read(file, ComplexHeadData.class, new ComplexDataListener())
.xlsxSAXParserFactoryName("com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl").sheet().doRead();
}
@Test
public void t11ReadAndWriteAutomaticMergeHead07() {
readAndWriteAutomaticMergeHead(file07AutomaticMergeHead);
}
@Test
public void t12ReadAndWriteAutomaticMergeHead03() {
readAndWriteAutomaticMergeHead(file03AutomaticMergeHead);
}
@Test
public void t13ReadAndWriteAutomaticMergeHeadCsv() {
readAndWriteAutomaticMergeHead(fileCsvAutomaticMergeHead);
}
private void readAndWriteAutomaticMergeHead(File file) {
EasyExcel.write(file, ComplexHeadData.class).automaticMergeHead(Boolean.FALSE).sheet().doWrite(data());
EasyExcel.read(file, ComplexHeadData.class, new ComplexDataListener()).sheet().doRead();
}
private List<ComplexHeadData> data() {
List<ComplexHeadData> list = new ArrayList<ComplexHeadData>();
ComplexHeadData data = new ComplexHeadData();
data.setString0("字符串0");
data.setString1("字符串1");
data.setString2("字符串2");
data.setString3("字符串3");
data.setString4("字符串4");
list.add(data);
return list;
}
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/head/ComplexDataListener.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/head/ComplexDataListener.java | package com.alibaba.easyexcel.test.core.head;
import java.util.ArrayList;
import java.util.List;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.fastjson2.JSON;
import org.junit.jupiter.api.Assertions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Jiaju Zhuang
*/
public class ComplexDataListener extends AnalysisEventListener<ComplexHeadData> {
private static final Logger LOGGER = LoggerFactory.getLogger(ComplexHeadData.class);
List<ComplexHeadData> list = new ArrayList<ComplexHeadData>();
@Override
public void invoke(ComplexHeadData data, AnalysisContext context) {
list.add(data);
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
Assertions.assertEquals(list.size(), 1);
ComplexHeadData data = list.get(0);
Assertions.assertEquals(data.getString4(), "字符串4");
LOGGER.debug("First row:{}", JSON.toJSONString(list.get(0)));
}
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/head/ListHeadDataListener.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/head/ListHeadDataListener.java | package com.alibaba.easyexcel.test.core.head;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.metadata.data.ReadCellData;
import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.fastjson2.JSON;
import org.junit.jupiter.api.Assertions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Jiaju Zhuang
*/
public class ListHeadDataListener implements ReadListener<Map<Integer, String>> {
private static final Logger LOGGER = LoggerFactory.getLogger(NoHeadData.class);
List<Map<Integer, String>> list = new ArrayList<Map<Integer, String>>();
@Override
public void invokeHead(Map<Integer, ReadCellData<?>> headMap, AnalysisContext context) {
Assertions.assertNotNull(context.readRowHolder().getRowIndex());
headMap.forEach((key, value) -> {
Assertions.assertEquals(value.getRowIndex(), context.readRowHolder().getRowIndex());
Assertions.assertEquals(value.getColumnIndex(), key);
});
}
@Override
public void invoke(Map<Integer, String> data, AnalysisContext context) {
list.add(data);
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
Assertions.assertEquals(list.size(), 1);
Map<Integer, String> data = list.get(0);
Assertions.assertEquals("字符串0", data.get(0));
Assertions.assertEquals("1", data.get(1));
Assertions.assertEquals("2020-01-01 01:01:01", data.get(2));
Assertions.assertEquals("额外数据", data.get(3));
LOGGER.debug("First row:{}", JSON.toJSONString(list.get(0)));
}
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/head/ListHeadDataTest.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/head/ListHeadDataTest.java | package com.alibaba.easyexcel.test.core.head;
import java.io.File;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
import com.alibaba.easyexcel.test.util.TestFileUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.util.DateUtils;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
/**
* @author Jiaju Zhuang
*/
@TestMethodOrder(MethodOrderer.MethodName.class)
public class ListHeadDataTest {
private static File file07;
private static File file03;
private static File fileCsv;
@BeforeAll
public static void init() {
file07 = TestFileUtil.createNewFile("listHead07.xlsx");
file03 = TestFileUtil.createNewFile("listHead03.xls");
fileCsv = TestFileUtil.createNewFile("listHeadCsv.csv");
}
@Test
public void t01ReadAndWrite07() throws Exception {
readAndWrite(file07);
}
@Test
public void t02ReadAndWrite03() throws Exception {
readAndWrite(file03);
}
@Test
public void t03ReadAndWriteCsv() throws Exception {
readAndWrite(fileCsv);
}
private void readAndWrite(File file) throws Exception {
EasyExcel.write(file).head(head()).sheet().doWrite(data());
EasyExcel.read(file).registerReadListener(new ListHeadDataListener()).sheet().doRead();
}
private List<List<String>> head() {
List<List<String>> list = new ArrayList<List<String>>();
List<String> head0 = new ArrayList<String>();
head0.add("字符串");
List<String> head1 = new ArrayList<String>();
head1.add("数字");
List<String> head2 = new ArrayList<String>();
head2.add("日期");
list.add(head0);
list.add(head1);
list.add(head2);
return list;
}
private List<List<Object>> data() throws ParseException {
List<List<Object>> list = new ArrayList<List<Object>>();
List<Object> data0 = new ArrayList<Object>();
data0.add("字符串0");
data0.add(1);
data0.add(DateUtils.parseDate("2020-01-01 01:01:01"));
data0.add("额外数据");
list.add(data0);
return list;
}
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/style/StyleData.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/style/StyleData.java | package com.alibaba.easyexcel.test.core.style;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.alibaba.excel.annotation.write.style.HeadStyle;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
/**
* @author Jiaju Zhuang
*/
@Getter
@Setter
@EqualsAndHashCode
@HeadStyle
@HeadFontStyle
public class StyleData {
@ExcelProperty("字符串")
private String string;
@ExcelProperty("字符串1")
private String string1;
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/style/StyleDataListener.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/style/StyleDataListener.java | package com.alibaba.easyexcel.test.core.style;
import java.util.ArrayList;
import java.util.List;
import com.alibaba.easyexcel.test.core.simple.SimpleDataListener;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.fastjson2.JSON;
import org.junit.jupiter.api.Assertions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Jiaju Zhuang
*/
public class StyleDataListener extends AnalysisEventListener<StyleData> {
private static final Logger LOGGER = LoggerFactory.getLogger(SimpleDataListener.class);
List<StyleData> list = new ArrayList<StyleData>();
@Override
public void invoke(StyleData data, AnalysisContext context) {
list.add(data);
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
Assertions.assertEquals(list.size(), 2);
Assertions.assertEquals(list.get(0).getString(), "字符串0");
Assertions.assertEquals(list.get(1).getString(), "字符串1");
LOGGER.debug("First row:{}", JSON.toJSONString(list.get(0)));
}
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/style/StyleDataTest.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/style/StyleDataTest.java | package com.alibaba.easyexcel.test.core.style;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import com.alibaba.easyexcel.test.core.StyleTestUtils;
import com.alibaba.easyexcel.test.util.TestFileUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.alibaba.excel.annotation.write.style.HeadStyle;
import com.alibaba.excel.metadata.Head;
import com.alibaba.excel.metadata.data.DataFormatData;
import com.alibaba.excel.metadata.property.FontProperty;
import com.alibaba.excel.metadata.property.StyleProperty;
import com.alibaba.excel.write.merge.LoopMergeStrategy;
import com.alibaba.excel.write.merge.OnceAbsoluteMergeStrategy;
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
import com.alibaba.excel.write.metadata.style.WriteFont;
import com.alibaba.excel.write.style.AbstractVerticalCellStyleStrategy;
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy;
import com.alibaba.excel.write.style.row.SimpleRowHeightStyleStrategy;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
/**
* @author Jiaju Zhuang
*/
@TestMethodOrder(MethodOrderer.MethodName.class)
public class StyleDataTest {
private static File file07;
private static File file03;
private static File fileVerticalCellStyleStrategy07;
private static File fileVerticalCellStyleStrategy207;
private static File fileLoopMergeStrategy;
@BeforeAll
public static void init() {
file07 = TestFileUtil.createNewFile("style07.xlsx");
file03 = TestFileUtil.createNewFile("style03.xls");
fileVerticalCellStyleStrategy07 = TestFileUtil.createNewFile("verticalCellStyle.xlsx");
fileVerticalCellStyleStrategy207 = TestFileUtil.createNewFile("verticalCellStyle2.xlsx");
fileLoopMergeStrategy = TestFileUtil.createNewFile("loopMergeStrategy.xlsx");
}
@Test
public void t01ReadAndWrite07() throws Exception {
readAndWrite(file07);
}
@Test
public void t02ReadAndWrite03() throws Exception {
readAndWrite(file03);
}
@Test
public void t03AbstractVerticalCellStyleStrategy() {
AbstractVerticalCellStyleStrategy verticalCellStyleStrategy = new AbstractVerticalCellStyleStrategy() {
@Override
protected WriteCellStyle headCellStyle(Head head) {
WriteCellStyle writeCellStyle = new WriteCellStyle();
writeCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND);
DataFormatData dataFormatData = new DataFormatData();
dataFormatData.setIndex((short)0);
writeCellStyle.setDataFormatData(dataFormatData);
writeCellStyle.setHidden(false);
writeCellStyle.setLocked(true);
writeCellStyle.setQuotePrefix(true);
writeCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
writeCellStyle.setWrapped(true);
writeCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
writeCellStyle.setRotation((short)0);
writeCellStyle.setIndent((short)10);
writeCellStyle.setBorderLeft(BorderStyle.THIN);
writeCellStyle.setBorderRight(BorderStyle.THIN);
writeCellStyle.setBorderTop(BorderStyle.THIN);
writeCellStyle.setBorderBottom(BorderStyle.THIN);
writeCellStyle.setLeftBorderColor(IndexedColors.RED.getIndex());
writeCellStyle.setRightBorderColor(IndexedColors.RED.getIndex());
writeCellStyle.setTopBorderColor(IndexedColors.RED.getIndex());
writeCellStyle.setBottomBorderColor(IndexedColors.RED.getIndex());
writeCellStyle.setFillBackgroundColor(IndexedColors.RED.getIndex());
writeCellStyle.setShrinkToFit(Boolean.TRUE);
if (head.getColumnIndex() == 0) {
writeCellStyle.setFillForegroundColor(IndexedColors.YELLOW.getIndex());
WriteFont writeFont = new WriteFont();
writeFont.setItalic(true);
writeFont.setStrikeout(true);
writeFont.setTypeOffset(Font.SS_NONE);
writeFont.setUnderline(Font.U_DOUBLE);
writeFont.setBold(true);
writeFont.setCharset((int)Font.DEFAULT_CHARSET);
} else {
writeCellStyle.setFillForegroundColor(IndexedColors.BLUE.getIndex());
}
return writeCellStyle;
}
@Override
protected WriteCellStyle contentCellStyle(Head head) {
WriteCellStyle writeCellStyle = new WriteCellStyle();
writeCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND);
if (head.getColumnIndex() == 0) {
writeCellStyle.setFillForegroundColor(IndexedColors.DARK_GREEN.getIndex());
} else {
writeCellStyle.setFillForegroundColor(IndexedColors.PINK.getIndex());
}
return writeCellStyle;
}
};
EasyExcel.write(fileVerticalCellStyleStrategy07, StyleData.class).registerWriteHandler(
verticalCellStyleStrategy).sheet()
.doWrite(data());
}
@Test
public void t04AbstractVerticalCellStyleStrategy02() {
final StyleProperty styleProperty = StyleProperty.build(StyleData.class.getAnnotation(HeadStyle.class));
final FontProperty fontProperty = FontProperty.build(StyleData.class.getAnnotation(HeadFontStyle.class));
AbstractVerticalCellStyleStrategy verticalCellStyleStrategy = new AbstractVerticalCellStyleStrategy() {
@Override
protected WriteCellStyle headCellStyle(Head head) {
WriteCellStyle writeCellStyle = WriteCellStyle.build(styleProperty, fontProperty);
if (head.getColumnIndex() == 0) {
writeCellStyle.setFillForegroundColor(IndexedColors.YELLOW.getIndex());
WriteFont writeFont = new WriteFont();
writeFont.setItalic(true);
writeFont.setStrikeout(true);
writeFont.setTypeOffset(Font.SS_NONE);
writeFont.setUnderline(Font.U_DOUBLE);
writeFont.setBold(true);
writeFont.setCharset((int)Font.DEFAULT_CHARSET);
} else {
writeCellStyle.setFillForegroundColor(IndexedColors.BLUE.getIndex());
}
return writeCellStyle;
}
@Override
protected WriteCellStyle contentCellStyle(Head head) {
WriteCellStyle writeCellStyle = new WriteCellStyle();
writeCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND);
if (head.getColumnIndex() == 0) {
writeCellStyle.setFillForegroundColor(IndexedColors.DARK_GREEN.getIndex());
} else {
writeCellStyle.setFillForegroundColor(IndexedColors.PINK.getIndex());
}
return writeCellStyle;
}
};
EasyExcel.write(fileVerticalCellStyleStrategy207, StyleData.class).registerWriteHandler(
verticalCellStyleStrategy).sheet()
.doWrite(data());
}
@Test
public void t05LoopMergeStrategy() {
EasyExcel.write(fileLoopMergeStrategy, StyleData.class).sheet().registerWriteHandler(
new LoopMergeStrategy(2, 1))
.doWrite(data10());
}
private void readAndWrite(File file) throws Exception {
SimpleColumnWidthStyleStrategy simpleColumnWidthStyleStrategy = new SimpleColumnWidthStyleStrategy(50);
SimpleRowHeightStyleStrategy simpleRowHeightStyleStrategy =
new SimpleRowHeightStyleStrategy((short)40, (short)50);
WriteCellStyle headWriteCellStyle = new WriteCellStyle();
headWriteCellStyle.setFillForegroundColor(IndexedColors.YELLOW.getIndex());
WriteFont headWriteFont = new WriteFont();
headWriteFont.setFontHeightInPoints((short)20);
headWriteFont.setColor(IndexedColors.DARK_YELLOW.getIndex());
headWriteCellStyle.setWriteFont(headWriteFont);
WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
contentWriteCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND);
contentWriteCellStyle.setFillForegroundColor(IndexedColors.TEAL.getIndex());
WriteFont contentWriteFont = new WriteFont();
contentWriteFont.setFontHeightInPoints((short)30);
contentWriteFont.setColor(IndexedColors.DARK_TEAL.getIndex());
contentWriteCellStyle.setWriteFont(contentWriteFont);
HorizontalCellStyleStrategy horizontalCellStyleStrategy =
new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle);
OnceAbsoluteMergeStrategy onceAbsoluteMergeStrategy = new OnceAbsoluteMergeStrategy(2, 2, 0, 1);
EasyExcel.write(file, StyleData.class).registerWriteHandler(simpleColumnWidthStyleStrategy)
.registerWriteHandler(simpleRowHeightStyleStrategy).registerWriteHandler(horizontalCellStyleStrategy)
.registerWriteHandler(onceAbsoluteMergeStrategy).sheet().doWrite(data());
EasyExcel.read(file, StyleData.class, new StyleDataListener()).sheet().doRead();
Workbook workbook = WorkbookFactory.create(file);
Sheet sheet = workbook.getSheetAt(0);
Assertions.assertEquals(50 * 256, sheet.getColumnWidth(0), 0);
Row row0 = sheet.getRow(0);
Assertions.assertEquals(800, row0.getHeight(), 0);
Cell cell00 = row0.getCell(0);
Assertions.assertArrayEquals(new byte[] {-1, -1, 0}, StyleTestUtils.getFillForegroundColor(cell00));
Assertions.assertArrayEquals(new byte[] {-128, -128, 0}, StyleTestUtils.getFontColor(cell00, workbook));
Assertions.assertEquals(20, StyleTestUtils.getFontHeightInPoints(cell00, workbook));
Cell cell01 = row0.getCell(1);
Assertions.assertArrayEquals(new byte[] {-1, -1, 0}, StyleTestUtils.getFillForegroundColor(cell01));
Assertions.assertArrayEquals(new byte[] {-128, -128, 0}, StyleTestUtils.getFontColor(cell01, workbook));
Assertions.assertEquals(20, StyleTestUtils.getFontHeightInPoints(cell01, workbook));
Row row1 = sheet.getRow(1);
Assertions.assertEquals(1000, row1.getHeight(), 0);
Cell cell10 = row1.getCell(0);
Assertions.assertArrayEquals(new byte[] {0, -128, -128}, StyleTestUtils.getFillForegroundColor(cell10));
Assertions.assertArrayEquals(new byte[] {0, 51, 102}, StyleTestUtils.getFontColor(cell10, workbook));
Assertions.assertEquals(30, StyleTestUtils.getFontHeightInPoints(cell10, workbook));
Cell cell11 = row1.getCell(1);
Assertions.assertArrayEquals(new byte[] {0, -128, -128}, StyleTestUtils.getFillForegroundColor(cell11));
Assertions.assertArrayEquals(new byte[] {0, 51, 102}, StyleTestUtils.getFontColor(cell11, workbook));
Assertions.assertEquals(30, StyleTestUtils.getFontHeightInPoints(cell11, workbook));
}
private List<StyleData> data() {
List<StyleData> list = new ArrayList<StyleData>();
StyleData data = new StyleData();
data.setString("字符串0");
data.setString1("字符串01");
StyleData data1 = new StyleData();
data1.setString("字符串1");
data1.setString1("字符串11");
list.add(data);
list.add(data1);
return list;
}
private List<StyleData> data10() {
List<StyleData> list = new ArrayList<StyleData>();
for (int i = 0; i < 10; i++) {
StyleData data = new StyleData();
data.setString("字符串0");
data.setString1("字符串01");
list.add(data);
}
return list;
}
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/parameter/ParameterData.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/parameter/ParameterData.java | package com.alibaba.easyexcel.test.core.parameter;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
/**
* @author Jiaju Zhuang
*/
@Getter
@Setter
@EqualsAndHashCode
public class ParameterData {
@ExcelProperty("姓名")
private String name;
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/parameter/ParameterDataTest.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/parameter/ParameterDataTest.java | package com.alibaba.easyexcel.test.core.parameter;
import java.io.File;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.List;
import com.alibaba.easyexcel.test.util.TestFileUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelReader;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.cache.MapCache;
import com.alibaba.excel.converters.string.StringStringConverter;
import com.alibaba.excel.read.metadata.ReadSheet;
import com.alibaba.excel.support.ExcelTypeEnum;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.metadata.WriteTable;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
/**
* @author Jiaju Zhuang
*/
@TestMethodOrder(MethodOrderer.MethodName.class)
public class ParameterDataTest {
private static File file07;
private static File fileCsv;
@BeforeAll
public static void init() {
file07 = TestFileUtil.createNewFile("parameter07.xlsx");
fileCsv = TestFileUtil.createNewFile("parameterCsv.csv");
}
@Test
public void t01ReadAndWrite() throws Exception {
readAndWrite1(file07, ExcelTypeEnum.XLSX);
readAndWrite2(file07, ExcelTypeEnum.XLSX);
readAndWrite3(file07, ExcelTypeEnum.XLSX);
readAndWrite4(file07, ExcelTypeEnum.XLSX);
readAndWrite5(file07, ExcelTypeEnum.XLSX);
readAndWrite6(file07, ExcelTypeEnum.XLSX);
readAndWrite7(file07, ExcelTypeEnum.XLSX);
}
@Test
public void t02ReadAndWrite() throws Exception {
readAndWrite1(fileCsv, ExcelTypeEnum.CSV);
readAndWrite2(fileCsv, ExcelTypeEnum.CSV);
readAndWrite3(fileCsv, ExcelTypeEnum.CSV);
readAndWrite4(fileCsv, ExcelTypeEnum.CSV);
readAndWrite5(fileCsv, ExcelTypeEnum.CSV);
readAndWrite6(fileCsv, ExcelTypeEnum.CSV);
readAndWrite7(fileCsv, ExcelTypeEnum.CSV);
}
private void readAndWrite1(File file, ExcelTypeEnum type) {
EasyExcel.write(file.getPath()).head(ParameterData.class).sheet().doWrite(data());
EasyExcel.read(file.getPath()).head(ParameterData.class).registerReadListener(new ParameterDataListener())
.sheet().doRead();
}
private void readAndWrite2(File file, ExcelTypeEnum type) {
EasyExcel.write(file.getPath(), ParameterData.class).sheet().doWrite(data());
EasyExcel.read(file.getPath(), ParameterData.class, new ParameterDataListener()).sheet().doRead();
}
private void readAndWrite3(File file, ExcelTypeEnum type) throws Exception {
EasyExcel.write(new FileOutputStream(file)).excelType(type).head(ParameterData.class).sheet()
.doWrite(data());
EasyExcel.read(file.getPath()).head(ParameterData.class).registerReadListener(new ParameterDataListener())
.sheet().doRead();
}
private void readAndWrite4(File file, ExcelTypeEnum type) throws Exception {
EasyExcel.write(new FileOutputStream(file), ParameterData.class).excelType(type).sheet().doWrite(data());
EasyExcel.read(file.getPath(), new ParameterDataListener()).head(ParameterData.class).sheet().doRead();
}
private void readAndWrite5(File file, ExcelTypeEnum type) throws Exception {
ExcelWriter excelWriter =
EasyExcel.write(new FileOutputStream(file)).excelType(type).head(ParameterData.class).relativeHeadRowIndex(
0).build();
WriteSheet writeSheet = EasyExcel.writerSheet(0).relativeHeadRowIndex(0).needHead(Boolean.FALSE).build();
WriteTable writeTable = EasyExcel.writerTable(0).relativeHeadRowIndex(0).needHead(Boolean.TRUE).build();
excelWriter.write(data(), writeSheet, writeTable);
excelWriter.finish();
ExcelReader excelReader = EasyExcel.read(file.getPath(), new ParameterDataListener()).head(ParameterData.class)
.mandatoryUseInputStream(Boolean.FALSE).autoCloseStream(Boolean.TRUE).readCache(new MapCache()).build();
ReadSheet readSheet = EasyExcel.readSheet().head(ParameterData.class).use1904windowing(Boolean.FALSE)
.headRowNumber(1).sheetNo(0).sheetName("0").build();
excelReader.read(readSheet);
excelReader.finish();
excelReader = EasyExcel.read(file.getPath(), new ParameterDataListener()).head(ParameterData.class)
.mandatoryUseInputStream(Boolean.FALSE).autoCloseStream(Boolean.TRUE).readCache(new MapCache()).build();
excelReader.read();
excelReader.finish();
}
private void readAndWrite6(File file, ExcelTypeEnum type) throws Exception {
ExcelWriter excelWriter =
EasyExcel.write(new FileOutputStream(file)).excelType(type).head(ParameterData.class).relativeHeadRowIndex(
0).build();
WriteSheet writeSheet = EasyExcel.writerSheet(0).relativeHeadRowIndex(0).needHead(Boolean.FALSE).build();
WriteTable writeTable = EasyExcel.writerTable(0).registerConverter(new StringStringConverter())
.relativeHeadRowIndex(0).needHead(Boolean.TRUE).build();
excelWriter.write(data(), writeSheet, writeTable);
excelWriter.finish();
ExcelReader excelReader = EasyExcel.read(file.getPath(), new ParameterDataListener()).head(ParameterData.class)
.mandatoryUseInputStream(Boolean.FALSE).autoCloseStream(Boolean.TRUE).readCache(new MapCache()).build();
ReadSheet readSheet = EasyExcel.readSheet("0").head(ParameterData.class).use1904windowing(Boolean.FALSE)
.headRowNumber(1).sheetNo(0).build();
excelReader.read(readSheet);
excelReader.finish();
excelReader = EasyExcel.read(file.getPath(), new ParameterDataListener()).head(ParameterData.class)
.mandatoryUseInputStream(Boolean.FALSE).autoCloseStream(Boolean.TRUE).readCache(new MapCache()).build();
excelReader.read();
excelReader.finish();
}
private void readAndWrite7(File file, ExcelTypeEnum type) {
EasyExcel.write(file, ParameterData.class).registerConverter(new StringStringConverter()).sheet()
.registerConverter(new StringStringConverter()).needHead(Boolean.FALSE).table(0).needHead(Boolean.TRUE)
.doWrite(data());
EasyExcel.read(file.getPath()).head(ParameterData.class).registerReadListener(new ParameterDataListener())
.sheet().registerConverter(new StringStringConverter()).doRead();
}
private List<ParameterData> data() {
List<ParameterData> list = new ArrayList<>();
for (int i = 0; i < 10; i++) {
ParameterData simpleData = new ParameterData();
simpleData.setName("姓名" + i);
list.add(simpleData);
}
return list;
}
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/parameter/ParameterDataListener.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/parameter/ParameterDataListener.java | package com.alibaba.easyexcel.test.core.parameter;
import java.util.ArrayList;
import java.util.List;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.fastjson2.JSON;
import org.junit.jupiter.api.Assertions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Jiaju Zhuang
*/
public class ParameterDataListener extends AnalysisEventListener<ParameterData> {
private static final Logger LOGGER = LoggerFactory.getLogger(ParameterDataListener.class);
List<ParameterData> list = new ArrayList<ParameterData>();
@Override
public void invoke(ParameterData data, AnalysisContext context) {
list.add(data);
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
Assertions.assertEquals(list.size(), 10);
Assertions.assertEquals(list.get(0).getName(), "姓名0");
Assertions.assertEquals((int)(context.readSheetHolder().getSheetNo()), 0);
Assertions.assertEquals(
context.readSheetHolder().getExcelReadHeadProperty().getHeadMap().get(0).getHeadNameList().get(0), "姓名");
LOGGER.debug("First row:{}", JSON.toJSONString(list.get(0)));
}
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/exception/ExceptionDataListener.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/exception/ExceptionDataListener.java | package com.alibaba.easyexcel.test.core.exception;
import java.util.ArrayList;
import java.util.List;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.fastjson2.JSON;
import org.junit.jupiter.api.Assertions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Jiaju Zhuang
*/
public class ExceptionDataListener extends AnalysisEventListener<ExceptionData> {
private static final Logger LOGGER = LoggerFactory.getLogger(ExceptionData.class);
List<ExceptionData> list = new ArrayList<ExceptionData>();
@Override
public void onException(Exception exception, AnalysisContext context) {
LOGGER.info("抛出异常,忽略:{}", exception.getMessage(), exception);
}
@Override
public boolean hasNext(AnalysisContext context) {
return list.size() != 8;
}
@Override
public void invoke(ExceptionData data, AnalysisContext context) {
list.add(data);
if (list.size() == 5) {
int i = 5 / 0;
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
Assertions.assertEquals(list.size(), 8);
Assertions.assertEquals(list.get(0).getName(), "姓名0");
Assertions.assertEquals((int)(context.readSheetHolder().getSheetNo()), 0);
Assertions.assertEquals(
context.readSheetHolder().getExcelReadHeadProperty().getHeadMap().get(0).getHeadNameList().get(0), "姓名");
LOGGER.debug("First row:{}", JSON.toJSONString(list.get(0)));
}
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/exception/ExceptionThrowDataListener.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/exception/ExceptionThrowDataListener.java | package com.alibaba.easyexcel.test.core.exception;
import java.util.ArrayList;
import java.util.List;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.read.listener.ReadListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Jiaju Zhuang
*/
public class ExceptionThrowDataListener implements ReadListener<ExceptionData> {
private static final Logger LOGGER = LoggerFactory.getLogger(ExceptionData.class);
List<ExceptionData> list = new ArrayList<ExceptionData>();
@Override
public void invoke(ExceptionData data, AnalysisContext context) {
list.add(data);
if (list.size() == 5) {
int i = 5 / 0;
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
}
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/exception/ExceptionData.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/exception/ExceptionData.java | package com.alibaba.easyexcel.test.core.exception;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
/**
* @author Jiaju Zhuang
*/
@Getter
@Setter
@EqualsAndHashCode
public class ExceptionData {
@ExcelProperty("姓名")
private String name;
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/exception/ExceptionDataTest.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/exception/ExceptionDataTest.java | package com.alibaba.easyexcel.test.core.exception;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.alibaba.easyexcel.test.demo.write.DemoData;
import com.alibaba.easyexcel.test.util.TestFileUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import org.assertj.core.util.Lists;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
/**
* @author Jiaju Zhuang
*/
@TestMethodOrder(MethodOrderer.MethodName.class)
public class ExceptionDataTest {
private static File file07;
private static File file03;
private static File fileCsv;
private static File fileExcelAnalysisStopSheetException07;
private static File fileExcelAnalysisStopSheetException03;
private static File fileExcelAnalysisStopSheetExceptionCsv;
private static File fileException07;
private static File fileException03;
@BeforeAll
public static void init() {
file07 = TestFileUtil.createNewFile("exception.xlsx");
file03 = TestFileUtil.createNewFile("exception.xls");
fileCsv = TestFileUtil.createNewFile("exception.csv");
fileExcelAnalysisStopSheetException07 = TestFileUtil.createNewFile("excelAnalysisStopSheetException.xlsx");
fileExcelAnalysisStopSheetException03 = TestFileUtil.createNewFile("excelAnalysisStopSheetException.xls");
fileException07 = TestFileUtil.createNewFile("exceptionThrow.xlsx");
fileException03 = TestFileUtil.createNewFile("exceptionThrow.xls");
}
@Test
public void t01ReadAndWrite07() throws Exception {
readAndWrite(file07);
}
@Test
public void t02ReadAndWrite03() throws Exception {
readAndWrite(file03);
}
@Test
public void t03ReadAndWriteCsv() throws Exception {
readAndWrite(fileCsv);
}
@Test
public void t11ReadAndWrite07() throws Exception {
readAndWriteException(fileException07);
}
@Test
public void t12ReadAndWrite03() throws Exception {
readAndWriteException(fileException03);
}
@Test
public void t21ReadAndWrite07() throws Exception {
readAndWriteExcelAnalysisStopSheetException(fileExcelAnalysisStopSheetException07);
}
@Test
public void t22ReadAndWrite03() throws Exception {
readAndWriteExcelAnalysisStopSheetException(fileExcelAnalysisStopSheetException03);
}
private void readAndWriteExcelAnalysisStopSheetException(File file) throws Exception {
try (ExcelWriter excelWriter = EasyExcel.write(file, ExceptionData.class).build()) {
for (int i = 0; i < 5; i++) {
String sheetName = "sheet" + i;
WriteSheet writeSheet = EasyExcel.writerSheet(i, sheetName).build();
List<ExceptionData> data = data(sheetName);
excelWriter.write(data, writeSheet);
}
}
ExcelAnalysisStopSheetExceptionDataListener excelAnalysisStopSheetExceptionDataListener
= new ExcelAnalysisStopSheetExceptionDataListener();
EasyExcel.read(file, ExceptionData.class, excelAnalysisStopSheetExceptionDataListener).doReadAll();
Map<Integer, List<String>> dataMap = excelAnalysisStopSheetExceptionDataListener.getDataMap();
Assertions.assertEquals(5, dataMap.size());
for (int i = 0; i < 5; i++) {
List<String> sheetDataList = dataMap.get(i);
Assertions.assertNotNull(sheetDataList);
Assertions.assertEquals(5, sheetDataList.size());
String sheetName = "sheet" + i;
for (String sheetData : sheetDataList) {
Assertions.assertTrue(sheetData.startsWith(sheetName));
}
}
}
private void readAndWriteException(File file) throws Exception {
EasyExcel.write(new FileOutputStream(file), ExceptionData.class).sheet().doWrite(data());
ArithmeticException exception = Assertions.assertThrows(ArithmeticException.class, () -> EasyExcel.read(
new FileInputStream(file), ExceptionData.class,
new ExceptionThrowDataListener()).sheet().doRead());
Assertions.assertEquals("/ by zero", exception.getMessage());
}
private void readAndWrite(File file) throws Exception {
EasyExcel.write(new FileOutputStream(file), ExceptionData.class).sheet().doWrite(data());
EasyExcel.read(new FileInputStream(file), ExceptionData.class, new ExceptionDataListener()).sheet().doRead();
}
private List<ExceptionData> data() {
List<ExceptionData> list = new ArrayList<ExceptionData>();
for (int i = 0; i < 10; i++) {
ExceptionData simpleData = new ExceptionData();
simpleData.setName("姓名" + i);
list.add(simpleData);
}
return list;
}
private List<ExceptionData> data(String prefix) {
List<ExceptionData> list = Lists.newArrayList();
for (int i = 0; i < 10; i++) {
ExceptionData simpleData = new ExceptionData();
simpleData.setName(prefix + "-姓名" + i);
list.add(simpleData);
}
return list;
}
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/exception/ExcelAnalysisStopSheetExceptionDataListener.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/exception/ExcelAnalysisStopSheetExceptionDataListener.java | package com.alibaba.easyexcel.test.core.exception;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.excel.exception.ExcelAnalysisStopException;
import com.alibaba.excel.exception.ExcelAnalysisStopSheetException;
import com.alibaba.excel.util.ListUtils;
import com.alibaba.excel.util.MapUtils;
import com.alibaba.fastjson2.JSON;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.SetUtils;
import org.assertj.core.internal.Maps;
import org.junit.jupiter.api.Assertions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Jiaju Zhuang
*/
@Getter
@Slf4j
public class ExcelAnalysisStopSheetExceptionDataListener extends AnalysisEventListener<ExceptionData> {
private Map<Integer, List<String>> dataMap = MapUtils.newHashMap();
@Override
public void invoke(ExceptionData data, AnalysisContext context) {
List<String> sheetDataList = dataMap.computeIfAbsent(context.readSheetHolder().getSheetNo(),
key -> ListUtils.newArrayList());
sheetDataList.add(data.getName());
if (sheetDataList.size() >= 5) {
throw new ExcelAnalysisStopSheetException();
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
List<String> sheetDataList = dataMap.get(context.readSheetHolder().getSheetNo());
Assertions.assertNotNull(sheetDataList);
Assertions.assertEquals(5, sheetDataList.size());
}
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/dataformat/DateFormatData.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/dataformat/DateFormatData.java | package com.alibaba.easyexcel.test.core.dataformat;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
/**
* @author Jiaju Zhuang
*/
@Getter
@Setter
@EqualsAndHashCode
public class DateFormatData {
private String date;
private String dateStringCn;
private String dateStringCn2;
private String dateStringUs;
private String number;
private String numberStringCn;
private String numberStringUs;
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/dataformat/DateFormatTest.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/dataformat/DateFormatTest.java | package com.alibaba.easyexcel.test.core.dataformat;
import java.io.File;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import com.alibaba.easyexcel.test.util.TestFileUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson2.JSON;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
/**
* @author Jiaju Zhuang
*/
@TestMethodOrder(MethodOrderer.MethodName.class)
@Slf4j
public class DateFormatTest {
private static File file07V2;
private static File file07;
private static File file03;
@BeforeAll
public static void init() {
file07 = TestFileUtil.readFile("dataformat" + File.separator + "dataformat.xlsx");
file03 = TestFileUtil.readFile("dataformat" + File.separator + "dataformat.xls");
file07V2 = TestFileUtil.readFile("dataformat" + File.separator + "dataformatv2.xlsx");
}
@Test
public void t01Read07() {
readCn(file07);
readUs(file07);
}
@Test
public void t02Read03() {
readCn(file03);
readUs(file03);
}
@Test
public void t03Read() {
List<Map<Integer, String>> dataMap = EasyExcel.read(file07V2).headRowNumber(0).doReadAllSync();
log.info("dataMap:{}", JSON.toJSONString(dataMap));
Assertions.assertEquals("15:00", dataMap.get(0).get(0));
Assertions.assertEquals("2023-1-01 00:00:00", dataMap.get(1).get(0));
Assertions.assertEquals("2023-1-01 00:00:00", dataMap.get(2).get(0));
Assertions.assertEquals("2023-1-01 00:00:01", dataMap.get(3).get(0));
Assertions.assertEquals("2023-1-01 00:00:00", dataMap.get(4).get(0));
Assertions.assertEquals("2023-1-01 00:00:00", dataMap.get(5).get(0));
Assertions.assertEquals("2023-1-01 00:00:01", dataMap.get(6).get(0));
}
private void readCn(File file) {
List<DateFormatData> list =
EasyExcel.read(file, DateFormatData.class, null).locale(Locale.CHINA).sheet().doReadSync();
for (DateFormatData data : list) {
if (!Objects.equals(data.getDateStringCn(), data.getDate()) && !Objects.equals(data.getDateStringCn2(),
data.getDate())) {
log.info("date:cn:{},{},{}", data.getDateStringCn(), data.getDateStringCn2(), data.getDate());
}
if (data.getNumberStringCn() != null && !data.getNumberStringCn().equals(data.getNumber())) {
log.info("number:cn{},{}", data.getNumberStringCn(), data.getNumber());
}
}
for (DateFormatData data : list) {
// The way dates are read in Chinese is different on Linux and Mac, so it is acceptable if it matches
// either one.
// For example, on Linux: 1-Jan -> 1-1月
// On Mac: 1-Jan -> 1-一月
Assertions.assertTrue(
Objects.equals(data.getDateStringCn(), data.getDate()) || Objects.equals(data.getDateStringCn2(),
data.getDate()));
Assertions.assertEquals(data.getNumberStringCn(), data.getNumber());
}
}
private void readUs(File file) {
List<DateFormatData> list =
EasyExcel.read(file, DateFormatData.class, null).locale(Locale.US).sheet().doReadSync();
for (DateFormatData data : list) {
if (data.getDateStringUs() != null && !data.getDateStringUs().equals(data.getDate())) {
log.info("date:us:{},{}", data.getDateStringUs(), data.getDate());
}
if (data.getNumberStringUs() != null && !data.getNumberStringUs().equals(data.getNumber())) {
log.info("number:us{},{}", data.getNumberStringUs(), data.getNumber());
}
}
for (DateFormatData data : list) {
Assertions.assertEquals(data.getDateStringUs(), data.getDate());
Assertions.assertEquals(data.getNumberStringUs(), data.getNumber());
}
}
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/extra/ExtraDataTest.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/extra/ExtraDataTest.java | package com.alibaba.easyexcel.test.core.extra;
import java.io.File;
import com.alibaba.easyexcel.test.util.TestFileUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.enums.CellExtraTypeEnum;
import com.alibaba.excel.metadata.CellExtra;
import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.fastjson2.JSON;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Jiaju Zhuang
*/
public class ExtraDataTest {
private static final Logger LOGGER = LoggerFactory.getLogger(ExtraDataTest.class);
private static File file03;
private static File file07;
private static File extraRelationships;
@BeforeAll
public static void init() {
file03 = TestFileUtil.readFile("extra" + File.separator + "extra.xls");
file07 = TestFileUtil.readFile("extra" + File.separator + "extra.xlsx");
extraRelationships = TestFileUtil.readFile("extra" + File.separator + "extraRelationships.xlsx");
}
@Test
public void t01Read07() {
read(file07);
}
@Test
public void t02Read03() {
read(file03);
}
@Test
public void t03Read() {
EasyExcel.read(extraRelationships, ExtraData.class, new ReadListener() {
@Override
public void invoke(Object data, AnalysisContext context) {
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
}
@Override
public void extra(CellExtra extra, AnalysisContext context) {
LOGGER.info("extra data:{}", JSON.toJSONString(extra));
switch (extra.getType()) {
case HYPERLINK:
if ("222222222".equals(extra.getText())) {
Assertions.assertEquals(1, (int)extra.getRowIndex());
Assertions.assertEquals(0, (int)extra.getColumnIndex());
} else if ("333333333333".equals(extra.getText())) {
Assertions.assertEquals(1, (int)extra.getRowIndex());
Assertions.assertEquals(1, (int)extra.getColumnIndex());
} else {
Assertions.fail("Unknown hyperlink!");
}
break;
default:
}
}
})
.extraRead(CellExtraTypeEnum.HYPERLINK)
.sheet()
.doRead();
}
private void read(File file) {
EasyExcel.read(file, ExtraData.class, new ExtraDataListener()).extraRead(CellExtraTypeEnum.COMMENT)
.extraRead(CellExtraTypeEnum.HYPERLINK).extraRead(CellExtraTypeEnum.MERGE).sheet().doRead();
}
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/extra/ExtraData.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/extra/ExtraData.java | package com.alibaba.easyexcel.test.core.extra;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
/**
* @author Jiaju Zhuang
*/
@Getter
@Setter
@EqualsAndHashCode
public class ExtraData {
private String row1;
private String row2;
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/extra/ExtraDataListener.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/extra/ExtraDataListener.java | package com.alibaba.easyexcel.test.core.extra;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.excel.metadata.CellExtra;
import com.alibaba.fastjson2.JSON;
import org.junit.jupiter.api.Assertions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Jiaju Zhuang
*/
public class ExtraDataListener extends AnalysisEventListener<ExtraData> {
private static final Logger LOGGER = LoggerFactory.getLogger(ExtraData.class);
@Override
public void invoke(ExtraData data, AnalysisContext context) {}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {}
@Override
public void extra(CellExtra extra, AnalysisContext context) {
LOGGER.info("extra data:{}", JSON.toJSONString(extra));
switch (extra.getType()) {
case COMMENT:
Assertions.assertEquals("批注的内容", extra.getText());
Assertions.assertEquals(4, (int)extra.getRowIndex());
Assertions.assertEquals(0, (int)extra.getColumnIndex());
break;
case HYPERLINK:
if ("Sheet1!A1".equals(extra.getText())) {
Assertions.assertEquals(1, (int)extra.getRowIndex());
Assertions.assertEquals(0, (int)extra.getColumnIndex());
} else if ("Sheet2!A1".equals(extra.getText())) {
Assertions.assertEquals(2, (int)extra.getFirstRowIndex());
Assertions.assertEquals(0, (int)extra.getFirstColumnIndex());
Assertions.assertEquals(3, (int)extra.getLastRowIndex());
Assertions.assertEquals(1, (int)extra.getLastColumnIndex());
} else {
Assertions.fail("Unknown hyperlink!");
}
break;
case MERGE:
Assertions.assertEquals(5, (int)extra.getFirstRowIndex());
Assertions.assertEquals(0, (int)extra.getFirstColumnIndex());
Assertions.assertEquals(6, (int)extra.getLastRowIndex());
Assertions.assertEquals(1, (int)extra.getLastColumnIndex());
break;
default:
}
}
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/bom/BomData.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/bom/BomData.java | package com.alibaba.easyexcel.test.core.bom;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@EqualsAndHashCode
public class BomData {
@ExcelProperty("姓名")
private String name;
@ExcelProperty("年纪")
private Long age;
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
alibaba/easyexcel | https://github.com/alibaba/easyexcel/blob/aae9c61ab603c04331333782eedd2896d7bc5386/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/bom/BomDataTest.java | easyexcel-test/src/test/java/com/alibaba/easyexcel/test/core/bom/BomDataTest.java | package com.alibaba.easyexcel.test.core.bom;
import java.io.File;
import java.io.FileOutputStream;
import java.nio.charset.Charset;
import java.util.List;
import java.util.Map;
import com.alibaba.easyexcel.test.util.TestFileUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.metadata.data.ReadCellData;
import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.support.ExcelTypeEnum;
import com.alibaba.excel.util.ListUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.compress.utils.Lists;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
/**
* bom test
*
* @author Jiaju Zhuang
*/
@TestMethodOrder(MethodOrderer.MethodName.class)
@Slf4j
public class BomDataTest {
@Test
public void t01ReadCsv() {
readCsv(TestFileUtil.readFile("bom" + File.separator + "no_bom.csv"));
readCsv(TestFileUtil.readFile("bom" + File.separator + "office_bom.csv"));
}
@Test
public void t02ReadAndWriteCsv() throws Exception {
readAndWriteCsv(TestFileUtil.createNewFile("bom" + File.separator + "bom_default.csv"), null, null);
readAndWriteCsv(TestFileUtil.createNewFile("bom" + File.separator + "bom_utf_8.csv"), "UTF-8", null);
readAndWriteCsv(TestFileUtil.createNewFile("bom" + File.separator + "bom_utf_8_lower_case.csv"), "utf-8", null);
readAndWriteCsv(TestFileUtil.createNewFile("bom" + File.separator + "bom_gbk.csv"), "GBK", null);
readAndWriteCsv(TestFileUtil.createNewFile("bom" + File.separator + "bom_gbk_lower_case.csv"), "gbk", null);
readAndWriteCsv(TestFileUtil.createNewFile("bom" + File.separator + "bom_utf_16be.csv"), "UTF-16BE", null);
readAndWriteCsv(TestFileUtil.createNewFile("bom" + File.separator + "bom_utf_8_not_with_bom.csv"), "UTF-8",
Boolean.FALSE);
}
private void readAndWriteCsv(File file, String charsetName, Boolean withBom) throws Exception {
Charset charset = null;
if (charsetName != null) {
charset = Charset.forName(charsetName);
}
EasyExcel.write(new FileOutputStream(file), BomData.class)
.charset(charset)
.withBom(withBom)
.excelType(ExcelTypeEnum.CSV)
.sheet()
.doWrite(data());
EasyExcel.read(file, BomData.class, new ReadListener<BomData>() {
private final List<BomData> dataList = Lists.newArrayList();
@Override
public void invokeHead(Map<Integer, ReadCellData<?>> headMap, AnalysisContext context) {
String head = headMap.get(0).getStringValue();
Assertions.assertEquals("姓名", head);
}
@Override
public void invoke(BomData data, AnalysisContext context) {
dataList.add(data);
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
Assertions.assertEquals(dataList.size(), 10);
BomData bomData = dataList.get(0);
Assertions.assertEquals("姓名0", bomData.getName());
Assertions.assertEquals(20, (long)bomData.getAge());
}
})
.charset(charset)
.sheet().doRead();
}
private void readCsv(File file) {
EasyExcel.read(file, BomData.class, new ReadListener<BomData>() {
private final List<BomData> dataList = Lists.newArrayList();
@Override
public void invokeHead(Map<Integer, ReadCellData<?>> headMap, AnalysisContext context) {
String head = headMap.get(0).getStringValue();
Assertions.assertEquals("姓名", head);
}
@Override
public void invoke(BomData data, AnalysisContext context) {
dataList.add(data);
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
Assertions.assertEquals(dataList.size(), 10);
BomData bomData = dataList.get(0);
Assertions.assertEquals("姓名0", bomData.getName());
Assertions.assertEquals(20L, (long)bomData.getAge());
}
}).sheet().doRead();
}
private List<BomData> data() {
List<BomData> list = ListUtils.newArrayList();
for (int i = 0; i < 10; i++) {
BomData data = new BomData();
data.setName("姓名" + i);
data.setAge(20L);
list.add(data);
}
return list;
}
}
| java | Apache-2.0 | aae9c61ab603c04331333782eedd2896d7bc5386 | 2026-01-04T14:46:28.604473Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.