com.alibaba.dubbo.config.support.Parameter Java Examples

The following examples show how to use com.alibaba.dubbo.config.support.Parameter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractConfig.java    From dubbox with Apache License 2.0 5 votes vote down vote up
protected static void appendAttributes(Map<Object, Object> parameters, Object config, String prefix) {
    if (config == null) {
        return;
    }
    Method[] methods = config.getClass().getMethods();
    for (Method method : methods) {
        try {
            String name = method.getName();
            if ((name.startsWith("get") || name.startsWith("is")) 
                    && ! "getClass".equals(name)
                    && Modifier.isPublic(method.getModifiers()) 
                    && method.getParameterTypes().length == 0
                    && isPrimitive(method.getReturnType())) {
                Parameter parameter = method.getAnnotation(Parameter.class);
                if (parameter == null || !parameter.attribute())
                    continue;
                String key;
                if (parameter != null && parameter.key() != null && parameter.key().length() > 0) {
                    key = parameter.key();
                } else {
                    int i = name.startsWith("get") ? 3 : 2;
                    key = name.substring(i, i + 1).toLowerCase() + name.substring(i + 1);
                }
                Object value = method.invoke(config, new Object[0]);
                if (value != null) {
                    if (prefix != null && prefix.length() > 0) {
                        key = prefix + "." + key;
                    }
                    parameters.put(key, value);
                }
            }
        } catch (Exception e) {
            throw new IllegalStateException(e.getMessage(), e);
        }
    }
}
 
Example #2
Source File: AbstractConfig.java    From dubbox with Apache License 2.0 5 votes vote down vote up
protected static void appendAttributes(Map<Object, Object> parameters, Object config, String prefix) {
    if (config == null) {
        return;
    }
    Method[] methods = config.getClass().getMethods();
    for (Method method : methods) {
        try {
            String name = method.getName();
            if ((name.startsWith("get") || name.startsWith("is")) 
                    && ! "getClass".equals(name)
                    && Modifier.isPublic(method.getModifiers()) 
                    && method.getParameterTypes().length == 0
                    && isPrimitive(method.getReturnType())) {
                Parameter parameter = method.getAnnotation(Parameter.class);
                if (parameter == null || !parameter.attribute())
                    continue;
                String key;
                if (parameter != null && parameter.key() != null && parameter.key().length() > 0) {
                    key = parameter.key();
                } else {
                    int i = name.startsWith("get") ? 3 : 2;
                    key = name.substring(i, i + 1).toLowerCase() + name.substring(i + 1);
                }
                Object value = method.invoke(config, new Object[0]);
                if (value != null) {
                    if (prefix != null && prefix.length() > 0) {
                        key = prefix + "." + key;
                    }
                    parameters.put(key, value);
                }
            }
        } catch (Exception e) {
            throw new IllegalStateException(e.getMessage(), e);
        }
    }
}
 
Example #3
Source File: ModuleConfig.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Parameter(key = "module", required = true)
public String getName() {
    return name;
}
 
Example #4
Source File: MethodConfig.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Parameter(excluded = true)
public String getName() {
    return name;
}
 
Example #5
Source File: AbstractServiceConfig.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Parameter(key = Constants.EXPORTER_LISTENER_KEY, append = true)
public String getListener() {
    return super.getListener();
}
 
Example #6
Source File: MonitorConfig.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Parameter(excluded = true)
public String getProtocol() {
    return protocol;
}
 
Example #7
Source File: MonitorConfig.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Parameter(excluded = true)
public String getAddress() {
	return address;
}
 
Example #8
Source File: MethodConfig.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Parameter(key = Constants.ON_RETURN_METHOD_KEY, excluded = true, attribute = true)
public String getOnreturnMethod() {
    return onreturnMethod;
}
 
Example #9
Source File: ProviderConfig.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Parameter(excluded = true)
public String getContextpath() {
    return contextpath;
}
 
Example #10
Source File: ProviderConfig.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Deprecated
@Parameter(excluded = true)
public String getPath() {
    return getContextpath();
}
 
Example #11
Source File: ProviderConfig.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Parameter(excluded = true)
public Integer getPort() {
    return port;
}
 
Example #12
Source File: ProtocolConfig.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Parameter(excluded = true)
public String getContextpath() {
    return contextpath;
}
 
Example #13
Source File: ServiceConfig.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Parameter(excluded = true)
   public boolean isExported() {
	return exported;
}
 
Example #14
Source File: AbstractServiceConfig.java    From dubbo3 with Apache License 2.0 4 votes vote down vote up
@Parameter(key = Constants.SERVICE_FILTER_KEY, append = true)
public String getFilter() {
    return super.getFilter();
}
 
Example #15
Source File: ReferenceConfig.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Parameter(excluded = true)
public String getUrl() {
    return url;
}
 
Example #16
Source File: MethodConfig.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
@Parameter(excluded = true)
public String getName() {
    return name;
}
 
Example #17
Source File: MonitorConfig.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Parameter(excluded = true)
public String getUsername() {
    return username;
}
 
Example #18
Source File: MonitorConfig.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
@Parameter(excluded = true)
public String getUsername() {
    return username;
}
 
Example #19
Source File: MethodConfig.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Parameter(key = Constants.ON_INVOKE_METHOD_KEY, excluded = true, attribute = true)
public String getOninvokeMethod() {
    return oninvokeMethod;
}
 
Example #20
Source File: AbstractReferenceConfig.java    From dubbo-2.6.5 with Apache License 2.0 4 votes vote down vote up
@Parameter(key = Constants.CLUSTER_STICKY_KEY)
public Boolean getSticky() {
    return sticky;
}
 
Example #21
Source File: AbstractInterfaceConfig.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Parameter(key = Constants.INVOKER_LISTENER_KEY, append = true)
public String getListener() {
    checkMultiExtension(InvokerListener.class, "listener", listener);
    return listener;
}
 
Example #22
Source File: ProviderConfig.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
@Parameter(excluded = true)
public Boolean isDefault() {
    return isDefault;
}
 
Example #23
Source File: ProtocolConfig.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Deprecated
@Parameter(excluded = true)
public String getPath() {
    return getContextpath();
}
 
Example #24
Source File: MonitorConfig.java    From dubbo3 with Apache License 2.0 4 votes vote down vote up
@Parameter(excluded = true)
public String getPassword() {
    return password;
}
 
Example #25
Source File: ProviderConfig.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
/**
 * 单词拼写错误,请使用{@link #getDispatcher()}
 * @deprecated {@link #getDispatcher()}
 */
@Deprecated
@Parameter(excluded = true)
public String getDispather() {
    return getDispatcher();
}
 
Example #26
Source File: ModuleConfig.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
@Parameter(key = "module.version")
public String getVersion() {
    return version;
}
 
Example #27
Source File: ServiceConfig.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Parameter(excluded = true)
public boolean isUnexported() {
	return unexported;
}
 
Example #28
Source File: ApplicationConfig.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Parameter(key = "application.version")
public String getVersion() {
    return version;
}
 
Example #29
Source File: AbstractMethodConfig.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
@Parameter(escaped = true)
public String getMock() {
    return mock;
}
 
Example #30
Source File: MethodConfig.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
@Parameter(key = Constants.ON_RETURN_INSTANCE_KEY, excluded = true, attribute = true)
public Object getOnreturn() {
    return onreturn;
}