Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.7.6 REST Metadata #5738

Merged
merged 62 commits into from
Feb 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
201af8e
Polish /apache/dubbo#4687 : Remove the duplicated test code in dubbo-…
mercyblitz Jul 29, 2019
d549eb5
Merge remote-tracking branch 'upstream/master'
mercyblitz Sep 5, 2019
d690af1
Merge remote-tracking branch 'upstream/master'
mercyblitz Sep 6, 2019
a52f322
Merge remote-tracking branch 'upstream/master'
mercyblitz Sep 9, 2019
163e31a
Polish /apache/dubbo#4674 & /apache/dubbo#4470
mercyblitz Sep 9, 2019
150124a
Merge remote-tracking branch 'upstream/master'
mercyblitz Sep 9, 2019
e83959a
Merge remote-tracking branch 'upstream/2.7.4-release'
mercyblitz Sep 20, 2019
6eb2cb5
Polish /apache/dubbo#5093 : Revert the previous commit
mercyblitz Sep 20, 2019
3c90cb2
Polish apache/dubbo#5093 : [Feature] Dubbo Services generate the meta…
mercyblitz Sep 20, 2019
64fe3fc
Merge remote-tracking branch 'upstream/2.7.4-release'
mercyblitz Sep 23, 2019
e5c50fc
Polish apache/dubbo#5306 : [Migration] Upgrade the @since tags in Jav…
mercyblitz Nov 12, 2019
b1fe4f6
Polish apache/dubbo#5306 : [Migration] Upgrade the @since tags in Jav…
mercyblitz Nov 12, 2019
6176bf0
Polish apache/dubbo#5309 : [ISSURE] The beans of Dubbo's Config can't…
mercyblitz Nov 12, 2019
d4c8956
Polish apache/dubbo#5312 : Resolve the demos' issues of zookeeper and…
mercyblitz Nov 12, 2019
4278dc1
Merge remote-tracking branch 'upstream/master' into cloud-native-2.7.5
mercyblitz Nov 12, 2019
3734800
Polish apache/dubbo#5313 : [Migration] migrate the code in common mod…
mercyblitz Nov 12, 2019
5d74025
Polish apache/dubbo#5316 : [Refactor] Replace @EnableDubboConfigBindi…
mercyblitz Nov 13, 2019
2f56570
Polish apache/dubbo#5317 : [Refactor] Refactor ReferenceAnnotationBea…
mercyblitz Nov 13, 2019
5afb058
Polish apache/dubbo#5321 : Remove BeanFactoryUtils
mercyblitz Nov 13, 2019
92af95e
Polish apache/dubbo#5321 : Remove AnnotatedBeanDefinitionRegistryUtils
mercyblitz Nov 13, 2019
2bbabf6
Polish apache/dubbo#5321 : Remove AnnotationUtils
mercyblitz Nov 13, 2019
8596072
Polish apache/dubbo#5321 : Remove ClassUtils
mercyblitz Nov 13, 2019
256ee6e
Polish apache/dubbo#5321 : Remove BeanRegistrar
mercyblitz Nov 13, 2019
96276f4
Polish apache/dubbo#5321 : Remove ObjectUtils
mercyblitz Nov 13, 2019
ed0f920
Polish apache/dubbo#5321 : Remove PropertySourcesUtils
mercyblitz Nov 13, 2019
0da7e27
Merge remote-tracking branch 'upstream/master' into cloud-native-2.7.5
mercyblitz Nov 14, 2019
e97abee
Sync commit
mercyblitz Nov 14, 2019
14c116d
Polish apache/dubbo#5325 : [Migration] To migrate dubbo-metadata-api …
mercyblitz Nov 14, 2019
b1eb630
Polish apache/dubbo#5326 : [Migration] To migrate dubbo-metadata-proc…
mercyblitz Nov 14, 2019
4c72e2c
Sync
mercyblitz Nov 14, 2019
2827278
Polish apache/dubbo#5329 : [Feature] To add the default metadata into…
mercyblitz Nov 14, 2019
8f39074
Merge remote-tracking branch 'upstream/master' into cloud-native-2.7.5
mercyblitz Nov 14, 2019
348e31d
Merge remote-tracking branch 'upstream/master' into cloud-native-2.7.5
mercyblitz Nov 15, 2019
60ba484
Merge remote-tracking branch 'upstream/master' into cloud-native-2.7.5
mercyblitz Nov 15, 2019
b669ec0
Merge remote-tracking branch 'upstream/master' into cloud-native-2.7.5
mercyblitz Nov 18, 2019
2eeee77
Polish apache/dubbo#5339 : [Refactor] Refactor the DynamicConfigurati…
mercyblitz Nov 18, 2019
d8f4fa4
Merge pull request #29 from mercyblitz/cloud-native-2.7.5
mercyblitz Nov 18, 2019
5cffbc2
Polish bugfix
mercyblitz Nov 19, 2019
95c2068
Fixes test cases
mercyblitz Nov 19, 2019
a29555c
Merge remote-tracking branch 'upstream/master' into cloud-native-2.7.5
mercyblitz Nov 19, 2019
721d25a
Merge remote-tracking branch 'upstream/master' into cloud-native-2.7.5
mercyblitz Nov 19, 2019
ad9ec1f
Merge remote-tracking branch 'upstream/master' into cloud-native-2.7.5
mercyblitz Nov 19, 2019
9a5a35c
Merge pull request #31 from mercyblitz/cloud-native-2.7.5
mercyblitz Nov 19, 2019
07bc009
Polish /apache/dubbo#5721 : [Enhancement] Setting the default IDs for…
mercyblitz Feb 10, 2020
676f6ae
Polish /apache/dubbo#5729 : [Optimization] To remove EnableDubboConfi…
mercyblitz Feb 11, 2020
4fa9c84
Merge remote-tracking branch 'upstream/master' into 2.7.6-config-refa…
mercyblitz Feb 11, 2020
8d6846d
Merge remote-tracking branch 'upstream/master' into 2.7.6-config-refa…
mercyblitz Feb 11, 2020
7d7887a
Merge branch 'master' into 2.7.6-config-refactor
mercyblitz Feb 11, 2020
2fd3113
Merge pull request #35 from mercyblitz/2.7.6-config-refactor
mercyblitz Feb 11, 2020
d512d65
Polish /apache/dubbo#5594 : [Feature] Add the resolver of ServiceRest…
mercyblitz Feb 11, 2020
21e8935
Polish /apache/dubbo#5736 : [Feature] Introducing Conversion features
mercyblitz Feb 12, 2020
d9f3e19
Polish /apache/dubbo#5737 : [Feature] Introducing "dubbo-metadata-pro…
mercyblitz Feb 12, 2020
193d27f
Polish /apache/dubbo#5594 : Change the Metadata implementation
mercyblitz Feb 13, 2020
809fdf1
Polish /apache/dubbo#5594 : Fixed test cases
mercyblitz Feb 13, 2020
253e4c7
Merge remote-tracking branch 'upstream/master' into 2.7.6-rest-metadata
mercyblitz Feb 14, 2020
b9c7a8b
Polish /apache/dubbo#5594 : Fixed test cases
mercyblitz Feb 14, 2020
b834c96
Polish /apache/dubbo#5594 : Fixed test cases
mercyblitz Feb 14, 2020
aa88401
Polish /apache/dubbo#5594 : Fixed test cases
mercyblitz Feb 17, 2020
5ce8c6d
Polish /apache/dubbo#5594 : Fixed test cases
mercyblitz Feb 17, 2020
49a79e0
Polish /apache/dubbo#5594 : Fixed test cases
mercyblitz Feb 17, 2020
5a3edbe
Polish /apache/dubbo#5594 : Fixed test cases
mercyblitz Feb 17, 2020
38bde55
Polish /apache/dubbo#5594 : Fixed test cases
mercyblitz Feb 17, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
191 changes: 144 additions & 47 deletions dubbo-all/pom.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/*
* 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 org.apache.dubbo.common.convert;

import org.apache.dubbo.common.extension.ExtensionLoader;
import org.apache.dubbo.common.extension.SPI;
import org.apache.dubbo.common.lang.Prioritized;

import static org.apache.dubbo.common.extension.ExtensionLoader.getExtensionLoader;
import static org.apache.dubbo.common.utils.ClassUtils.isAssignableFrom;
import static org.apache.dubbo.common.utils.TypeUtils.findActualTypeArgument;

/**
* A class to convert the source-typed value to the target-typed value
*
* @param <S> The source type
* @param <T> The target type
* @since 2.7.6
*/
@SPI
@FunctionalInterface
public interface Converter<S, T> extends Prioritized {

/**
* Accept the source type and target type or not
*
* @param sourceType the source type
* @param targetType the target type
* @return if accepted, return <code>true</code>, or <code>false</code>
*/
default boolean accept(Class<?> sourceType, Class<?> targetType) {
return isAssignableFrom(sourceType, getSourceType()) && isAssignableFrom(targetType, getTargetType());
}

/**
* Convert the source-typed value to the target-typed value
*
* @param source the source-typed value
* @return the target-typed value
*/
T convert(S source);

/**
* Get the source type
*
* @return non-null
*/
default Class<S> getSourceType() {
return findActualTypeArgument(getClass(), Converter.class, 0);
}

/**
* Get the target type
*
* @return non-null
*/
default Class<T> getTargetType() {
return findActualTypeArgument(getClass(), Converter.class, 1);
}

/**
* Get the Converter instance from {@link ExtensionLoader} with the specified source and target type
*
* @param sourceType the source type
* @param targetType the target type
* @return
* @see ExtensionLoader#getSupportedExtensionInstances()
*/
static Converter<?, ?> getConverter(Class<?> sourceType, Class<?> targetType) {
return getExtensionLoader(Converter.class)
.getSupportedExtensionInstances()
.stream()
.filter(converter -> converter.accept(sourceType, targetType))
.findFirst()
.orElse(null);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* 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 org.apache.dubbo.common.convert;

/**
* A class to covert {@link String} to the target-typed value
*
* @see Converter
* @since 2.7.6
*/
@FunctionalInterface
public interface StringConverter<T> extends Converter<String, T> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* 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 org.apache.dubbo.common.convert;

import static java.lang.Boolean.valueOf;
import static org.apache.dubbo.common.utils.StringUtils.isNotEmpty;

/**
* The class to convert {@link String} to {@link Boolean}
*
* @since 2.7.6
*/
public class StringToBooleanConverter implements StringConverter<Boolean> {

@Override
public Boolean convert(String source) {
return isNotEmpty(source) ? valueOf(source) : null;
}

@Override
public int getPriority() {
return NORMAL_PRIORITY + 5;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* 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 org.apache.dubbo.common.convert;


import static org.apache.dubbo.common.utils.StringUtils.isNotEmpty;

/**
* The class to convert {@link String} to <code>char[]</code>
*
* @since 2.7.6
*/
public class StringToCharArrayConverter implements StringConverter<char[]> {

@Override
public char[] convert(String source) {
return isNotEmpty(source) ? source.toCharArray() : null;
}


@Override
public int getPriority() {
return NORMAL_PRIORITY + 7;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* 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 org.apache.dubbo.common.convert;

import static org.apache.dubbo.common.utils.StringUtils.length;

/**
* The class to convert {@link String} to {@link Character}
*
* @since 2.7.6
*/
public class StringToCharacterConverter implements StringConverter<Character> {

@Override
public Character convert(String source) {
int length = length(source);
if (length == 0) {
return null;
}
if (length > 1) {
throw new IllegalArgumentException("The source String is more than one character!");
}
return source.charAt(0);
}

@Override
public int getPriority() {
return NORMAL_PRIORITY + 8;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* 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 org.apache.dubbo.common.convert;

import static java.lang.Double.valueOf;
import static org.apache.dubbo.common.utils.StringUtils.isNotEmpty;

/**
* The class to convert {@link String} to {@link Double}
*
* @since 2.7.6
*/
public class StringToDoubleConverter implements StringConverter<Double> {

@Override
public Double convert(String source) {
return isNotEmpty(source) ? valueOf(source) : null;
}


@Override
public int getPriority() {
return NORMAL_PRIORITY + 3;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* 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 org.apache.dubbo.common.convert;

import static java.lang.Float.valueOf;
import static org.apache.dubbo.common.utils.StringUtils.isNotEmpty;

/**
* The class to convert {@link String} to {@link Float}
*
* @since 2.7.6
*/
public class StringToFloatConverter implements StringConverter<Float> {

@Override
public Float convert(String source) {
return isNotEmpty(source) ? valueOf(source) : null;
}

@Override
public int getPriority() {
return NORMAL_PRIORITY + 4;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* 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 org.apache.dubbo.common.convert;

import static java.lang.Integer.valueOf;
import static org.apache.dubbo.common.utils.StringUtils.isNotEmpty;

/**
* The class to convert {@link String} to {@link Integer}
*
* @since 2.7.6
*/
public class StringToIntegerConverter implements StringConverter<Integer> {

@Override
public Integer convert(String source) {
return isNotEmpty(source) ? valueOf(source) : null;
}

@Override
public int getPriority() {
return NORMAL_PRIORITY;
}
}
Loading