[SCB-1725]turn on integration tests of highway and fix known problem
diff --git a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/internal/converter/SwaggerToProtoGenerator.java b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/internal/converter/SwaggerToProtoGenerator.java
index 7f38649..c6e1cab 100644
--- a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/internal/converter/SwaggerToProtoGenerator.java
+++ b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/internal/converter/SwaggerToProtoGenerator.java
@@ -100,6 +100,13 @@
return name.replaceAll("\\.", "_");
}
+ public static boolean isValidEnum(String name) {
+ if (name.contains(".") || name.contains("-")) {
+ return false;
+ }
+ return true;
+ }
+
private void convertDefinitions() {
if (swagger.getDefinitions() == null) {
return;
@@ -250,7 +257,12 @@
appendLine(msgStringBuilder, "enum %s {", enumName);
for (int idx = 0; idx < enums.size(); idx++) {
- appendLine(msgStringBuilder, " %s =%d;", enums.get(idx), idx);
+ if (isValidEnum(enums.get(idx))) {
+ appendLine(msgStringBuilder, " %s =%d;", enums.get(idx), idx);
+ } else {
+ throw new IllegalStateException(
+ String.format("enum class [%s] name [%s] not supported by protobuffer.", enumName, enums.get(idx)));
+ }
}
appendLine(msgStringBuilder, "}");
}
diff --git a/common/common-protobuf/src/test/java/org/apache/servicecomb/codec/protobuf/internal/converter/TestSwaggerToProtoGenerator.java b/common/common-protobuf/src/test/java/org/apache/servicecomb/codec/protobuf/internal/converter/TestSwaggerToProtoGenerator.java
index 9fdc15f..03bd678 100644
--- a/common/common-protobuf/src/test/java/org/apache/servicecomb/codec/protobuf/internal/converter/TestSwaggerToProtoGenerator.java
+++ b/common/common-protobuf/src/test/java/org/apache/servicecomb/codec/protobuf/internal/converter/TestSwaggerToProtoGenerator.java
@@ -52,5 +52,8 @@
Assert.assertEquals("hello_my_service", SwaggerToProtoGenerator.escapeMessageName("hello_my_service"));
Assert.assertEquals("hello.my_service", SwaggerToProtoGenerator.escapePackageName("hello.my-service"));
Assert.assertEquals("hello.test.test", SwaggerToProtoGenerator.escapePackageName("hello.test.test"));
+ Assert.assertEquals(false, SwaggerToProtoGenerator.isValidEnum("hello.test.test"));
+ Assert.assertEquals(false, SwaggerToProtoGenerator.isValidEnum("hello.my-service"));
+ Assert.assertEquals(true, SwaggerToProtoGenerator.isValidEnum("My_ENum"));
}
}
diff --git a/core/src/main/java/org/apache/servicecomb/core/definition/OperationConfig.java b/core/src/main/java/org/apache/servicecomb/core/definition/OperationConfig.java
index c087fce..7a5b7e7 100644
--- a/core/src/main/java/org/apache/servicecomb/core/definition/OperationConfig.java
+++ b/core/src/main/java/org/apache/servicecomb/core/definition/OperationConfig.java
@@ -86,7 +86,7 @@
private long nanoRestRequestWaitInPoolTimeout;
@InjectProperty(keys = {
- "operation.${service}.transport", // Deprecated
+ "operation${op-priority}.transport", // Deprecated
"references.transport${op-priority}"
})
private String transport;
diff --git a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/LambdaMetafactoryUtils.java b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/LambdaMetafactoryUtils.java
index 910dd5e..6152f4c 100644
--- a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/LambdaMetafactoryUtils.java
+++ b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/LambdaMetafactoryUtils.java
@@ -25,25 +25,9 @@
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.servicecomb.foundation.common.utils.bean.BoolGetter;
-import org.apache.servicecomb.foundation.common.utils.bean.BoolSetter;
-import org.apache.servicecomb.foundation.common.utils.bean.ByteGetter;
-import org.apache.servicecomb.foundation.common.utils.bean.ByteSetter;
-import org.apache.servicecomb.foundation.common.utils.bean.DoubleGetter;
-import org.apache.servicecomb.foundation.common.utils.bean.DoubleSetter;
-import org.apache.servicecomb.foundation.common.utils.bean.FloatGetter;
-import org.apache.servicecomb.foundation.common.utils.bean.FloatSetter;
import org.apache.servicecomb.foundation.common.utils.bean.Getter;
-import org.apache.servicecomb.foundation.common.utils.bean.IntGetter;
-import org.apache.servicecomb.foundation.common.utils.bean.IntSetter;
-import org.apache.servicecomb.foundation.common.utils.bean.LongGetter;
-import org.apache.servicecomb.foundation.common.utils.bean.LongSetter;
import org.apache.servicecomb.foundation.common.utils.bean.Setter;
-import org.apache.servicecomb.foundation.common.utils.bean.ShortGetter;
-import org.apache.servicecomb.foundation.common.utils.bean.ShortSetter;
public final class LambdaMetafactoryUtils {
private static Field allowedModesField;
@@ -53,31 +37,8 @@
private static final Lookup LOOKUP = MethodHandles.lookup();
- private static final Map<Class<?>, Class<?>> GETTER_MAP = new HashMap<>();
-
- private static final Map<Class<?>, Class<?>> SETTER_MAP = new HashMap<>();
-
static {
enhanceLambda();
- initGetterSetterMap();
- }
-
- private static void initGetterSetterMap() {
- GETTER_MAP.put(boolean.class, BoolGetter.class);
- GETTER_MAP.put(byte.class, ByteGetter.class);
- GETTER_MAP.put(short.class, ShortGetter.class);
- GETTER_MAP.put(int.class, IntGetter.class);
- GETTER_MAP.put(long.class, LongGetter.class);
- GETTER_MAP.put(float.class, FloatGetter.class);
- GETTER_MAP.put(double.class, DoubleGetter.class);
-
- SETTER_MAP.put(boolean.class, BoolSetter.class);
- SETTER_MAP.put(byte.class, ByteSetter.class);
- SETTER_MAP.put(short.class, ShortSetter.class);
- SETTER_MAP.put(int.class, IntSetter.class);
- SETTER_MAP.put(long.class, LongSetter.class);
- SETTER_MAP.put(float.class, FloatSetter.class);
- SETTER_MAP.put(double.class, DoubleSetter.class);
}
private static void enhanceLambda() {
@@ -163,8 +124,7 @@
}
public static <T> T createGetter(Method getMethod) {
- Class<?> getterCls = GETTER_MAP.getOrDefault(getMethod.getReturnType(), Getter.class);
- return createLambda(getMethod, getterCls);
+ return createLambda(getMethod, Getter.class);
}
// slower than reflect directly
@@ -181,8 +141,7 @@
}
public static <T> T createSetter(Method setMethod) throws Throwable {
- Class<?> setterCls = SETTER_MAP.getOrDefault(setMethod.getParameterTypes()[0], Setter.class);
- return createLambda(setMethod, setterCls);
+ return createLambda(setMethod, Setter.class);
}
// slower than reflect directly
diff --git a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/BoolGetter.java b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/BoolGetter.java
deleted file mode 100644
index 11e0a3c..0000000
--- a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/BoolGetter.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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.servicecomb.foundation.common.utils.bean;
-
-public interface BoolGetter<T> {
- boolean get(T instance);
-}
diff --git a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/BoolSetter.java b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/BoolSetter.java
deleted file mode 100644
index 8cbacb5..0000000
--- a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/BoolSetter.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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.servicecomb.foundation.common.utils.bean;
-
-public interface BoolSetter<T> {
- void set(T instance, boolean value);
-}
diff --git a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/ByteGetter.java b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/ByteGetter.java
deleted file mode 100644
index c4bab67..0000000
--- a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/ByteGetter.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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.servicecomb.foundation.common.utils.bean;
-
-public interface ByteGetter<T> {
- byte get(T instance);
-}
diff --git a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/ByteSetter.java b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/ByteSetter.java
deleted file mode 100644
index 952d06b..0000000
--- a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/ByteSetter.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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.servicecomb.foundation.common.utils.bean;
-
-public interface ByteSetter<T> {
- void set(T instance, byte value);
-}
diff --git a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/DoubleGetter.java b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/DoubleGetter.java
deleted file mode 100644
index 5349c4c..0000000
--- a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/DoubleGetter.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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.servicecomb.foundation.common.utils.bean;
-
-public interface DoubleGetter<T> {
- double get(T instance);
-}
diff --git a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/DoubleSetter.java b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/DoubleSetter.java
deleted file mode 100644
index c39a802..0000000
--- a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/DoubleSetter.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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.servicecomb.foundation.common.utils.bean;
-
-public interface DoubleSetter<T> {
- void set(T instance, double value);
-}
diff --git a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/FloatGetter.java b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/FloatGetter.java
deleted file mode 100644
index 405d233..0000000
--- a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/FloatGetter.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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.servicecomb.foundation.common.utils.bean;
-
-public interface FloatGetter<T> {
- float get(T instance);
-}
diff --git a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/FloatSetter.java b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/FloatSetter.java
deleted file mode 100644
index 7d4b75a..0000000
--- a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/FloatSetter.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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.servicecomb.foundation.common.utils.bean;
-
-public interface FloatSetter<T> {
- void set(T instance, float value);
-}
diff --git a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/IntGetter.java b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/IntGetter.java
deleted file mode 100644
index b7aaf29..0000000
--- a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/IntGetter.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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.servicecomb.foundation.common.utils.bean;
-
-public interface IntGetter<T> {
- int get(T instance);
-}
diff --git a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/IntSetter.java b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/IntSetter.java
deleted file mode 100644
index 0a0425e..0000000
--- a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/IntSetter.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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.servicecomb.foundation.common.utils.bean;
-
-public interface IntSetter<T> {
- void set(T instance, int value);
-}
diff --git a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/LongGetter.java b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/LongGetter.java
deleted file mode 100644
index 8f4d68d..0000000
--- a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/LongGetter.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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.servicecomb.foundation.common.utils.bean;
-
-public interface LongGetter<T> {
- long get(T instance);
-}
diff --git a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/LongSetter.java b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/LongSetter.java
deleted file mode 100644
index a0ba4f9..0000000
--- a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/LongSetter.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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.servicecomb.foundation.common.utils.bean;
-
-public interface LongSetter<T> {
- void set(T instance, long value);
-}
diff --git a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/ShortGetter.java b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/ShortGetter.java
deleted file mode 100644
index bea64f4..0000000
--- a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/ShortGetter.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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.servicecomb.foundation.common.utils.bean;
-
-public interface ShortGetter<T> {
- short get(T instance);
-}
diff --git a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/ShortSetter.java b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/ShortSetter.java
deleted file mode 100644
index db741cb..0000000
--- a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/bean/ShortSetter.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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.servicecomb.foundation.common.utils.bean;
-
-public interface ShortSetter<T> {
- void set(T instance, short value);
-}
diff --git a/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/TestLambdaMetafactoryUtils.java b/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/TestLambdaMetafactoryUtils.java
index 40672cb..fc4f39b 100644
--- a/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/TestLambdaMetafactoryUtils.java
+++ b/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/TestLambdaMetafactoryUtils.java
@@ -25,8 +25,6 @@
import java.util.function.Supplier;
import org.apache.servicecomb.foundation.common.utils.bean.Getter;
-import org.apache.servicecomb.foundation.common.utils.bean.IntGetter;
-import org.apache.servicecomb.foundation.common.utils.bean.IntSetter;
import org.apache.servicecomb.foundation.common.utils.bean.Setter;
import org.hamcrest.Matchers;
import org.junit.Assert;
@@ -70,8 +68,8 @@
@SuppressWarnings("unchecked")
@Test
public void createGetterSetterByMethod() throws Throwable {
- IntGetter<Model> getter = LambdaMetafactoryUtils.createGetter(Model.class.getMethod("getF1"));
- IntSetter<Model> setter = LambdaMetafactoryUtils.createSetter(Model.class.getMethod("setF1", int.class));
+ Getter<Model, Integer> getter = LambdaMetafactoryUtils.createGetter(Model.class.getMethod("getF1"));
+ Setter<Model, Integer> setter = LambdaMetafactoryUtils.createSetter(Model.class.getMethod("setF1", int.class));
BiFunction<Object, Object, Object> echo = LambdaMetafactoryUtils
.createLambda(Model.class.getMethod("echo", List.class), BiFunction.class);
diff --git a/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/TestLambdaPerformance.java b/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/TestLambdaPerformance.java
index ab92c86..d60c068 100644
--- a/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/TestLambdaPerformance.java
+++ b/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/TestLambdaPerformance.java
@@ -24,7 +24,6 @@
import org.apache.servicecomb.foundation.common.utils.TestLambdaMetafactoryUtils.Model;
import org.apache.servicecomb.foundation.common.utils.bean.Getter;
-import org.apache.servicecomb.foundation.common.utils.bean.IntGetter;
public class TestLambdaPerformance {
static Model model = new Model();
@@ -38,7 +37,7 @@
static MethodHandle mh_f1_getter;
- static IntGetter<Model> lambda_f1_method_getter;
+ static Getter<Model, Integer> lambda_f1_method_getter;
static Field f1_field;
diff --git a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/deserializer/scalar/AbstractScalarReadSchemas.java b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/deserializer/scalar/AbstractScalarReadSchemas.java
index 83366a4..89bfb0d 100644
--- a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/deserializer/scalar/AbstractScalarReadSchemas.java
+++ b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/deserializer/scalar/AbstractScalarReadSchemas.java
@@ -16,8 +16,6 @@
*/
package org.apache.servicecomb.foundation.protobuf.internal.schema.deserializer.scalar;
-import org.apache.servicecomb.foundation.common.utils.bean.IntSetter;
-import org.apache.servicecomb.foundation.common.utils.bean.LongSetter;
import org.apache.servicecomb.foundation.common.utils.bean.Setter;
import org.apache.servicecomb.foundation.protobuf.internal.bean.PropertyDescriptor;
@@ -35,7 +33,7 @@
}
static abstract class AbstractIntPrimitiveSchema<T> extends FieldSchema<T> {
- protected final IntSetter<T> setter;
+ protected final Setter<T, Integer> setter;
public AbstractIntPrimitiveSchema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor.getJavaType());
@@ -53,7 +51,7 @@
}
static abstract class AbstractLongPrimitiveSchema<T> extends FieldSchema<T> {
- protected final LongSetter<T> setter;
+ protected final Setter<T, Long> setter;
public AbstractLongPrimitiveSchema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor.getJavaType());
diff --git a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/deserializer/scalar/BoolReadSchemas.java b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/deserializer/scalar/BoolReadSchemas.java
index a6b1e75..d543a7b 100644
--- a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/deserializer/scalar/BoolReadSchemas.java
+++ b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/deserializer/scalar/BoolReadSchemas.java
@@ -18,7 +18,6 @@
import java.io.IOException;
-import org.apache.servicecomb.foundation.common.utils.bean.BoolSetter;
import org.apache.servicecomb.foundation.common.utils.bean.Setter;
import org.apache.servicecomb.foundation.protobuf.internal.ProtoUtils;
import org.apache.servicecomb.foundation.protobuf.internal.bean.PropertyDescriptor;
@@ -61,7 +60,7 @@
}
private static class BooleanPrimitiveSchema<T> extends FieldSchema<T> {
- private final BoolSetter<T> setter;
+ private final Setter<T, Boolean> setter;
public BooleanPrimitiveSchema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor.getJavaType());
diff --git a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/deserializer/scalar/DoubleReadSchemas.java b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/deserializer/scalar/DoubleReadSchemas.java
index dbac060..2eb5fa1 100644
--- a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/deserializer/scalar/DoubleReadSchemas.java
+++ b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/deserializer/scalar/DoubleReadSchemas.java
@@ -18,7 +18,6 @@
import java.io.IOException;
-import org.apache.servicecomb.foundation.common.utils.bean.DoubleSetter;
import org.apache.servicecomb.foundation.common.utils.bean.Setter;
import org.apache.servicecomb.foundation.protobuf.internal.ProtoUtils;
import org.apache.servicecomb.foundation.protobuf.internal.bean.PropertyDescriptor;
@@ -61,7 +60,7 @@
}
private static class DoublePrimitiveSchema<T> extends FieldSchema<T> {
- private final DoubleSetter<T> setter;
+ private final Setter<T, Double> setter;
public DoublePrimitiveSchema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor.getJavaType());
diff --git a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/deserializer/scalar/EnumsReadSchemas.java b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/deserializer/scalar/EnumsReadSchemas.java
index 1ca9fed..2299b05 100644
--- a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/deserializer/scalar/EnumsReadSchemas.java
+++ b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/deserializer/scalar/EnumsReadSchemas.java
@@ -18,7 +18,6 @@
import java.io.IOException;
-import org.apache.servicecomb.foundation.common.utils.bean.IntSetter;
import org.apache.servicecomb.foundation.common.utils.bean.Setter;
import org.apache.servicecomb.foundation.protobuf.internal.ProtoUtils;
import org.apache.servicecomb.foundation.protobuf.internal.bean.PropertyDescriptor;
@@ -96,7 +95,7 @@
}
private static class IntPrimitiveEnumSchema<T> extends FieldSchema<T> {
- private final IntSetter<T> setter;
+ private final Setter<T, Integer> setter;
public IntPrimitiveEnumSchema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor.getJavaType());
diff --git a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/deserializer/scalar/FloatReadSchemas.java b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/deserializer/scalar/FloatReadSchemas.java
index 46879c1..971329d 100644
--- a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/deserializer/scalar/FloatReadSchemas.java
+++ b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/deserializer/scalar/FloatReadSchemas.java
@@ -18,7 +18,6 @@
import java.io.IOException;
-import org.apache.servicecomb.foundation.common.utils.bean.FloatSetter;
import org.apache.servicecomb.foundation.common.utils.bean.Setter;
import org.apache.servicecomb.foundation.protobuf.internal.ProtoUtils;
import org.apache.servicecomb.foundation.protobuf.internal.bean.PropertyDescriptor;
@@ -61,7 +60,7 @@
}
private static class FloatPrimitiveSchema<T> extends FieldSchema<T> {
- private final FloatSetter<T> setter;
+ private final Setter<T, Float> setter;
public FloatPrimitiveSchema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor.getJavaType());
diff --git a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/repeated/RepeatedWriteSchemas.java b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/repeated/RepeatedWriteSchemas.java
index 4a7702f..5d0a332 100644
--- a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/repeated/RepeatedWriteSchemas.java
+++ b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/repeated/RepeatedWriteSchemas.java
@@ -17,13 +17,10 @@
package org.apache.servicecomb.foundation.protobuf.internal.schema.serializer.repeated;
import java.io.IOException;
-import java.util.Collection;
import org.apache.servicecomb.foundation.common.utils.bean.Getter;
import org.apache.servicecomb.foundation.protobuf.internal.bean.PropertyDescriptor;
-import com.fasterxml.jackson.databind.JavaType;
-
import io.protostuff.OutputEx;
import io.protostuff.compiler.model.Field;
import io.protostuff.runtime.FieldSchema;
@@ -32,16 +29,7 @@
public static <T, ELE_TYPE> FieldSchema<T> create(Field protoField,
PropertyDescriptor propertyDescriptor,
AbstractWriters<ELE_TYPE> writers) {
- JavaType javaType = propertyDescriptor.getJavaType();
- if (writers.arrayClass.isAssignableFrom(javaType.getRawClass())) {
- return new ArraySchema<>(protoField, propertyDescriptor, writers);
- }
-
- if (Collection.class.isAssignableFrom(javaType.getRawClass())) {
- return new CollectionSchema<>(protoField, propertyDescriptor, writers);
- }
-
- return new DynamicSchema<>(protoField, propertyDescriptor, writers);
+ return new CollectionSchema<>(protoField, propertyDescriptor, writers);
}
static class DynamicSchema<T, ELE_TYPE> extends FieldSchema<T> {
@@ -62,28 +50,8 @@
}
}
- private static class ArraySchema<T, ELE_TYPE> extends DynamicSchema<T, ELE_TYPE> {
- private final Getter<T, ELE_TYPE[]> getter;
-
- public ArraySchema(Field protoField, PropertyDescriptor propertyDescriptor,
- AbstractWriters<ELE_TYPE> writers) {
- super(protoField, propertyDescriptor, writers);
- this.getter = propertyDescriptor.getGetter();
- }
-
- @Override
- public final void getAndWriteTo(OutputEx output, T message) throws IOException {
- ELE_TYPE[] value = getter.get(message);
- if (value == null) {
- return;
- }
-
- writers.arrayWriter.writeTo(output, value);
- }
- }
-
private static class CollectionSchema<T, ELE_TYPE> extends DynamicSchema<T, ELE_TYPE> {
- private final Getter<T, Collection<ELE_TYPE>> getter;
+ private final Getter<T, Object> getter;
public CollectionSchema(Field protoField, PropertyDescriptor propertyDescriptor,
AbstractWriters<ELE_TYPE> writers) {
@@ -93,12 +61,11 @@
@Override
public final void getAndWriteTo(OutputEx output, T message) throws IOException {
- Collection<ELE_TYPE> value = getter.get(message);
+ Object value = getter.get(message);
if (value == null) {
return;
}
-
- writers.collectionWriter.writeTo(output, value);
+ this.writeTo(output, value);
}
}
}
diff --git a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/BoolWriteSchemas.java b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/BoolWriteSchemas.java
index a687a82..9b5711e 100644
--- a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/BoolWriteSchemas.java
+++ b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/BoolWriteSchemas.java
@@ -18,7 +18,6 @@
import java.io.IOException;
-import org.apache.servicecomb.foundation.common.utils.bean.BoolGetter;
import org.apache.servicecomb.foundation.common.utils.bean.Getter;
import org.apache.servicecomb.foundation.protobuf.internal.ProtoUtils;
import org.apache.servicecomb.foundation.protobuf.internal.bean.PropertyDescriptor;
@@ -37,7 +36,7 @@
return new BooleanSchema<>(protoField, propertyDescriptor);
}
- return new BooleanDynamicSchema<>(protoField, propertyDescriptor);
+ return new BooleanSchema<>(protoField, propertyDescriptor);
}
private static class BooleanDynamicSchema<T> extends FieldSchema<T> {
@@ -77,25 +76,25 @@
}
private static class BooleanSchema<T> extends BooleanDynamicSchema<T> {
- protected final Getter<T, Boolean> getter;
+ protected final Getter<T, Object> getter;
public BooleanSchema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor);
- this.getter = javaType.isPrimitive() ? null : propertyDescriptor.getGetter();
+ this.getter = propertyDescriptor.getGetter();
}
@Override
public final void getAndWriteTo(OutputEx output, T message) throws IOException {
- Boolean value = getter.get(message);
+ Object value = getter.get(message);
if (value != null) {
- output.writeScalarBool(tag, tagSize, value);
+ writeTo(output, value);
}
}
}
private static class BooleanPrimitiveSchema<T> extends BooleanDynamicSchema<T> {
- private final BoolGetter<T> primitiveGetter;
+ private final Getter<T, Boolean> primitiveGetter;
public BooleanPrimitiveSchema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor);
diff --git a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/BytesWriteSchemas.java b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/BytesWriteSchemas.java
index 03352c5..865e4a7 100644
--- a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/BytesWriteSchemas.java
+++ b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/BytesWriteSchemas.java
@@ -32,7 +32,7 @@
return new BytesSchema<>(protoField, propertyDescriptor);
}
- return new BytesDynamicSchema<>(protoField, propertyDescriptor);
+ return new BytesSchema<>(protoField, propertyDescriptor);
}
private static class BytesDynamicSchema<T> extends FieldSchema<T> {
@@ -52,7 +52,7 @@
}
private static class BytesSchema<T> extends BytesDynamicSchema<T> {
- protected final Getter<T, byte[]> getter;
+ protected final Getter<T, Object> getter;
public BytesSchema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor);
@@ -62,9 +62,9 @@
@Override
public final void getAndWriteTo(OutputEx output, T message) throws IOException {
- byte[] value = getter.get(message);
+ Object value = getter.get(message);
if (value != null) {
- output.writeByteArray(tag, tagSize, value);
+ writeTo(output, value);
}
}
}
diff --git a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/DoubleWriteSchemas.java b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/DoubleWriteSchemas.java
index 5839ba0..174ed3c 100644
--- a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/DoubleWriteSchemas.java
+++ b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/DoubleWriteSchemas.java
@@ -18,7 +18,6 @@
import java.io.IOException;
-import org.apache.servicecomb.foundation.common.utils.bean.DoubleGetter;
import org.apache.servicecomb.foundation.common.utils.bean.Getter;
import org.apache.servicecomb.foundation.protobuf.internal.ProtoUtils;
import org.apache.servicecomb.foundation.protobuf.internal.bean.PropertyDescriptor;
@@ -37,7 +36,7 @@
return new DoubleSchema<>(protoField, propertyDescriptor);
}
- return new DoubleDynamicSchema<>(protoField, propertyDescriptor);
+ return new DoubleSchema<>(protoField, propertyDescriptor);
}
private static class DoubleDynamicSchema<T> extends FieldSchema<T> {
@@ -72,25 +71,25 @@
}
private static class DoubleSchema<T> extends DoubleDynamicSchema<T> {
- protected final Getter<T, Double> getter;
+ protected final Getter<T, Object> getter;
public DoubleSchema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor);
- this.getter = javaType.isPrimitive() ? null : propertyDescriptor.getGetter();
+ this.getter = propertyDescriptor.getGetter();
}
@Override
public final void getAndWriteTo(OutputEx output, T message) throws IOException {
- Double value = getter.get(message);
+ Object value = getter.get(message);
if (value != null) {
- output.writeScalarDouble(tag, tagSize, value);
+ writeTo(output, value);
}
}
}
private static class DoublePrimitiveSchema<T> extends DoubleDynamicSchema<T> {
- private final DoubleGetter<T> primitiveGetter;
+ private final Getter<T, Double> primitiveGetter;
public DoublePrimitiveSchema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor);
diff --git a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/EnumWriteSchemas.java b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/EnumWriteSchemas.java
index 09f26f4..b7d0754 100644
--- a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/EnumWriteSchemas.java
+++ b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/EnumWriteSchemas.java
@@ -34,7 +34,7 @@
return new EnumSchema<>(protoField, propertyDescriptor);
}
- return new EnumDynamicSchema<>(protoField, propertyDescriptor);
+ return new EnumSchema<>(protoField, propertyDescriptor);
}
private static class EnumDynamicSchema<T> extends FieldSchema<T> {
@@ -106,23 +106,19 @@
}
private static class EnumSchema<T> extends EnumDynamicSchema<T> {
- protected final Getter<T, Enum<?>> getter;
+ protected final Getter<T, Object> getter;
public EnumSchema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor);
- this.getter = javaType.isPrimitive() ? null : propertyDescriptor.getGetter();
+ this.getter = propertyDescriptor.getGetter();
}
@Override
public final void getAndWriteTo(OutputEx output, T message) throws IOException {
- // already be a Enum, need to check if it is a valid Enum?
- // wrong case:
- // expect a Color enum, but be a Sharp enum?, who will do this?
- // for safe, check it......
- Enum<?> value = getter.get(message);
+ Object value = getter.get(message);
if (value != null) {
- stringWrite(output, value.name());
+ writeTo(output, value);
}
}
}
diff --git a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/Fixed32WriteSchemas.java b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/Fixed32WriteSchemas.java
index f4c6f6e..546accf 100644
--- a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/Fixed32WriteSchemas.java
+++ b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/Fixed32WriteSchemas.java
@@ -19,7 +19,6 @@
import java.io.IOException;
import org.apache.servicecomb.foundation.common.utils.bean.Getter;
-import org.apache.servicecomb.foundation.common.utils.bean.IntGetter;
import org.apache.servicecomb.foundation.protobuf.internal.ProtoUtils;
import org.apache.servicecomb.foundation.protobuf.internal.bean.PropertyDescriptor;
@@ -37,7 +36,7 @@
return new Fixed32Schema<>(protoField, propertyDescriptor);
}
- return new Fixed32DynamicSchema<>(protoField, propertyDescriptor);
+ return new Fixed32Schema<>(protoField, propertyDescriptor);
}
private static class Fixed32DynamicSchema<T> extends FieldSchema<T> {
@@ -72,7 +71,7 @@
}
private static class Fixed32Schema<T> extends Fixed32DynamicSchema<T> {
- protected final Getter<T, Integer> getter;
+ protected final Getter<T, Object> getter;
public Fixed32Schema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor);
@@ -82,15 +81,15 @@
@Override
public final void getAndWriteTo(OutputEx output, T message) throws IOException {
- Integer value = getter.get(message);
+ Object value = getter.get(message);
if (value != null) {
- output.writeScalarFixed32(tag, tagSize, value);
+ writeTo(output, value);
}
}
}
private static class Fixed32PrimitiveSchema<T> extends Fixed32DynamicSchema<T> {
- private final IntGetter<T> primitiveGetter;
+ private final Getter<T, Integer> primitiveGetter;
public Fixed32PrimitiveSchema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor);
diff --git a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/Fixed64WriteSchemas.java b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/Fixed64WriteSchemas.java
index b3addeb..f4fad8b 100644
--- a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/Fixed64WriteSchemas.java
+++ b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/Fixed64WriteSchemas.java
@@ -19,7 +19,6 @@
import java.io.IOException;
import org.apache.servicecomb.foundation.common.utils.bean.Getter;
-import org.apache.servicecomb.foundation.common.utils.bean.LongGetter;
import org.apache.servicecomb.foundation.protobuf.internal.ProtoUtils;
import org.apache.servicecomb.foundation.protobuf.internal.bean.PropertyDescriptor;
@@ -37,7 +36,7 @@
return new Fixed64Schema<>(protoField, propertyDescriptor);
}
- return new Fixed64DynamicSchema<>(protoField, propertyDescriptor);
+ return new Fixed64Schema<>(protoField, propertyDescriptor);
}
private static class Fixed64DynamicSchema<T> extends FieldSchema<T> {
@@ -72,7 +71,7 @@
}
private static class Fixed64Schema<T> extends Fixed64DynamicSchema<T> {
- protected final Getter<T, Long> getter;
+ protected final Getter<T, Object> getter;
public Fixed64Schema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor);
@@ -82,15 +81,15 @@
@Override
public final void getAndWriteTo(OutputEx output, T message) throws IOException {
- Long value = getter.get(message);
+ Object value = getter.get(message);
if (value != null) {
- output.writeScalarFixed64(tag, tagSize, value);
+ writeTo(output, value);
}
}
}
private static class Fixed64PrimitiveSchema<T> extends Fixed64DynamicSchema<T> {
- private final LongGetter<T> primitiveGetter;
+ private final Getter<T, Long> primitiveGetter;
public Fixed64PrimitiveSchema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor);
diff --git a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/FloatWriteSchemas.java b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/FloatWriteSchemas.java
index 7687c4d..c721b9b 100644
--- a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/FloatWriteSchemas.java
+++ b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/FloatWriteSchemas.java
@@ -18,7 +18,6 @@
import java.io.IOException;
-import org.apache.servicecomb.foundation.common.utils.bean.FloatGetter;
import org.apache.servicecomb.foundation.common.utils.bean.Getter;
import org.apache.servicecomb.foundation.protobuf.internal.ProtoUtils;
import org.apache.servicecomb.foundation.protobuf.internal.bean.PropertyDescriptor;
@@ -37,7 +36,7 @@
return new FloatSchema<>(protoField, propertyDescriptor);
}
- return new FloatDynamicSchema<>(protoField, propertyDescriptor);
+ return new FloatSchema<>(protoField, propertyDescriptor);
}
private static class FloatDynamicSchema<T> extends FieldSchema<T> {
@@ -72,7 +71,7 @@
}
private static class FloatSchema<T> extends FloatDynamicSchema<T> {
- protected final Getter<T, Float> getter;
+ protected final Getter<T, Object> getter;
public FloatSchema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor);
@@ -82,15 +81,15 @@
@Override
public final void getAndWriteTo(OutputEx output, T message) throws IOException {
- Float value = getter.get(message);
+ Object value = getter.get(message);
if (value != null) {
- output.writeScalarFloat(tag, tagSize, value);
+ writeTo(output, value);
}
}
}
private static class FloatPrimitiveSchema<T> extends FloatDynamicSchema<T> {
- private final FloatGetter<T> primitiveGetter;
+ private final Getter<T, Float> primitiveGetter;
public FloatPrimitiveSchema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor);
diff --git a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/Int32WriteSchemas.java b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/Int32WriteSchemas.java
index 615afb6..8d202d6 100644
--- a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/Int32WriteSchemas.java
+++ b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/Int32WriteSchemas.java
@@ -19,7 +19,6 @@
import java.io.IOException;
import org.apache.servicecomb.foundation.common.utils.bean.Getter;
-import org.apache.servicecomb.foundation.common.utils.bean.IntGetter;
import org.apache.servicecomb.foundation.protobuf.internal.ProtoUtils;
import org.apache.servicecomb.foundation.protobuf.internal.bean.PropertyDescriptor;
@@ -37,7 +36,7 @@
return new Int32Schema<>(protoField, propertyDescriptor);
}
- return new Int32DynamicSchema<>(protoField, propertyDescriptor);
+ return new Int32Schema<>(protoField, propertyDescriptor);
}
private static class Int32DynamicSchema<T> extends FieldSchema<T> {
@@ -75,7 +74,7 @@
}
private static class Int32Schema<T> extends Int32DynamicSchema<T> {
- protected final Getter<T, Integer> getter;
+ protected final Getter<T, Object> getter;
public Int32Schema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor);
@@ -85,15 +84,15 @@
@Override
public final void getAndWriteTo(OutputEx output, T message) throws IOException {
- Integer value = getter.get(message);
+ Object value = getter.get(message);
if (value != null) {
- output.writeScalarInt32(tag, tagSize, value);
+ writeTo(output, value);
}
}
}
private static final class Int32PrimitiveSchema<T> extends Int32DynamicSchema<T> {
- private final IntGetter<T> primitiveGetter;
+ private final Getter<T, Integer> primitiveGetter;
public Int32PrimitiveSchema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor);
diff --git a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/Int64WriteSchemas.java b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/Int64WriteSchemas.java
index 71edff8..1856229 100644
--- a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/Int64WriteSchemas.java
+++ b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/Int64WriteSchemas.java
@@ -22,7 +22,6 @@
import java.util.Date;
import org.apache.servicecomb.foundation.common.utils.bean.Getter;
-import org.apache.servicecomb.foundation.common.utils.bean.LongGetter;
import org.apache.servicecomb.foundation.protobuf.internal.ProtoUtils;
import org.apache.servicecomb.foundation.protobuf.internal.bean.PropertyDescriptor;
@@ -40,7 +39,7 @@
return new Int64Schema<>(protoField, propertyDescriptor);
}
- return new Int64DynamicSchema<>(protoField, propertyDescriptor);
+ return new Int64Schema<>(protoField, propertyDescriptor);
}
private static class Int64DynamicSchema<T> extends FieldSchema<T> {
@@ -87,7 +86,7 @@
}
private static class Int64Schema<T> extends Int64DynamicSchema<T> {
- protected final Getter<T, Long> getter;
+ protected final Getter<T, Object> getter;
public Int64Schema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor);
@@ -97,15 +96,15 @@
@Override
public final void getAndWriteTo(OutputEx output, T message) throws IOException {
- Long value = getter.get(message);
+ Object value = getter.get(message);
if (value != null) {
- output.writeScalarInt64(tag, tagSize, value);
+ this.writeTo(output, value);
}
}
}
private static final class Int64PrimitiveSchema<T> extends Int64DynamicSchema<T> {
- private final LongGetter<T> primitiveGetter;
+ private final Getter<T, Long> primitiveGetter;
public Int64PrimitiveSchema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor);
diff --git a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/SFixed32WriteSchemas.java b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/SFixed32WriteSchemas.java
index b803b07..fe4fddc 100644
--- a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/SFixed32WriteSchemas.java
+++ b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/SFixed32WriteSchemas.java
@@ -19,7 +19,6 @@
import java.io.IOException;
import org.apache.servicecomb.foundation.common.utils.bean.Getter;
-import org.apache.servicecomb.foundation.common.utils.bean.IntGetter;
import org.apache.servicecomb.foundation.protobuf.internal.ProtoUtils;
import org.apache.servicecomb.foundation.protobuf.internal.bean.PropertyDescriptor;
@@ -37,7 +36,7 @@
return new SFixed32Schema<>(protoField, propertyDescriptor);
}
- return new SFixed32DynamicSchema<>(protoField, propertyDescriptor);
+ return new SFixed32Schema<>(protoField, propertyDescriptor);
}
private static class SFixed32DynamicSchema<T> extends FieldSchema<T> {
@@ -72,7 +71,7 @@
}
private static class SFixed32Schema<T> extends SFixed32DynamicSchema<T> {
- protected final Getter<T, Integer> getter;
+ protected final Getter<T, Object> getter;
public SFixed32Schema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor);
@@ -82,15 +81,15 @@
@Override
public final void getAndWriteTo(OutputEx output, T message) throws IOException {
- Integer value = getter.get(message);
+ Object value = getter.get(message);
if (value != null) {
- output.writeScalarSFixed32(tag, tagSize, value);
+ writeTo(output, value);
}
}
}
private static class SFixed32PrimitiveSchema<T> extends SFixed32DynamicSchema<T> {
- private final IntGetter<T> primitiveGetter;
+ private final Getter<T, Integer> primitiveGetter;
public SFixed32PrimitiveSchema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor);
diff --git a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/SFixed64WriteSchemas.java b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/SFixed64WriteSchemas.java
index 7803f55..4f1432e 100644
--- a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/SFixed64WriteSchemas.java
+++ b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/SFixed64WriteSchemas.java
@@ -19,7 +19,6 @@
import java.io.IOException;
import org.apache.servicecomb.foundation.common.utils.bean.Getter;
-import org.apache.servicecomb.foundation.common.utils.bean.LongGetter;
import org.apache.servicecomb.foundation.protobuf.internal.ProtoUtils;
import org.apache.servicecomb.foundation.protobuf.internal.bean.PropertyDescriptor;
@@ -37,7 +36,7 @@
return new SFixed64Schema<>(protoField, propertyDescriptor);
}
- return new SFixed64DynamicSchema<>(protoField, propertyDescriptor);
+ return new SFixed64Schema<>(protoField, propertyDescriptor);
}
private static class SFixed64DynamicSchema<T> extends FieldSchema<T> {
@@ -72,7 +71,7 @@
}
private static class SFixed64Schema<T> extends SFixed64DynamicSchema<T> {
- protected final Getter<T, Long> getter;
+ protected final Getter<T, Object> getter;
public SFixed64Schema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor);
@@ -82,15 +81,15 @@
@Override
public final void getAndWriteTo(OutputEx output, T message) throws IOException {
- Long value = getter.get(message);
+ Object value = getter.get(message);
if (value != null) {
- output.writeScalarSFixed64(tag, tagSize, value);
+ writeTo(output, value);
}
}
}
private static class SFixed64PrimitiveSchema<T> extends SFixed64DynamicSchema<T> {
- private final LongGetter<T> primitiveGetter;
+ private final Getter<T, Long> primitiveGetter;
public SFixed64PrimitiveSchema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor);
diff --git a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/SInt32WriteSchemas.java b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/SInt32WriteSchemas.java
index 343926d..18d5413 100644
--- a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/SInt32WriteSchemas.java
+++ b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/SInt32WriteSchemas.java
@@ -19,7 +19,6 @@
import java.io.IOException;
import org.apache.servicecomb.foundation.common.utils.bean.Getter;
-import org.apache.servicecomb.foundation.common.utils.bean.IntGetter;
import org.apache.servicecomb.foundation.protobuf.internal.ProtoUtils;
import org.apache.servicecomb.foundation.protobuf.internal.bean.PropertyDescriptor;
@@ -37,7 +36,7 @@
return new SInt32Schema<>(protoField, propertyDescriptor);
}
- return new SInt32DynamicSchema<>(protoField, propertyDescriptor);
+ return new SInt32Schema<>(protoField, propertyDescriptor);
}
private static class SInt32DynamicSchema<T> extends FieldSchema<T> {
@@ -72,7 +71,7 @@
}
private static class SInt32Schema<T> extends SInt32DynamicSchema<T> {
- protected final Getter<T, Integer> getter;
+ protected final Getter<T, Object> getter;
public SInt32Schema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor);
@@ -82,15 +81,15 @@
@Override
public final void getAndWriteTo(OutputEx output, T message) throws IOException {
- Integer value = getter.get(message);
+ Object value = getter.get(message);
if (value != null) {
- output.writeScalarSInt32(tag, tagSize, value);
+ writeTo(output, value);
}
}
}
private static class SInt32PrimitiveSchema<T> extends SInt32DynamicSchema<T> {
- private final IntGetter<T> primitiveGetter;
+ private final Getter<T, Integer> primitiveGetter;
public SInt32PrimitiveSchema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor);
diff --git a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/SInt64WriteSchemas.java b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/SInt64WriteSchemas.java
index 16a41fc..f085b2c 100644
--- a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/SInt64WriteSchemas.java
+++ b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/SInt64WriteSchemas.java
@@ -19,7 +19,6 @@
import java.io.IOException;
import org.apache.servicecomb.foundation.common.utils.bean.Getter;
-import org.apache.servicecomb.foundation.common.utils.bean.LongGetter;
import org.apache.servicecomb.foundation.protobuf.internal.ProtoUtils;
import org.apache.servicecomb.foundation.protobuf.internal.bean.PropertyDescriptor;
@@ -37,7 +36,7 @@
return new SInt64Schema<>(protoField, propertyDescriptor);
}
- return new SInt64DynamicSchema<>(protoField, propertyDescriptor);
+ return new SInt64Schema<>(protoField, propertyDescriptor);
}
private static class SInt64DynamicSchema<T> extends FieldSchema<T> {
@@ -72,7 +71,7 @@
}
private static class SInt64Schema<T> extends SInt64DynamicSchema<T> {
- protected final Getter<T, Long> getter;
+ protected final Getter<T, Object> getter;
public SInt64Schema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor);
@@ -82,15 +81,15 @@
@Override
public final void getAndWriteTo(OutputEx output, T message) throws IOException {
- Long value = getter.get(message);
+ Object value = getter.get(message);
if (value != null) {
- output.writeScalarSInt64(tag, tagSize, value);
+ writeTo(output, value);
}
}
}
private static class SInt64PrimitiveSchema<T> extends SInt64DynamicSchema<T> {
- private final LongGetter<T> primitiveGetter;
+ private final Getter<T, Long> primitiveGetter;
public SInt64PrimitiveSchema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor);
diff --git a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/StringWriteSchemas.java b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/StringWriteSchemas.java
index 8434e79..18051d6 100644
--- a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/StringWriteSchemas.java
+++ b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/StringWriteSchemas.java
@@ -32,7 +32,7 @@
return new StringSchema<>(protoField, propertyDescriptor);
}
- return new StringDynamicSchema<>(protoField, propertyDescriptor);
+ return new StringSchema<>(protoField, propertyDescriptor);
}
private static class StringDynamicSchema<T> extends FieldSchema<T> {
@@ -65,19 +65,19 @@
}
private static class StringSchema<T> extends StringDynamicSchema<T> {
- protected final Getter<T, String> getter;
+ protected final Getter<T, Object> getter;
public StringSchema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor);
- this.getter = javaType.isPrimitive() ? null : propertyDescriptor.getGetter();
+ this.getter = propertyDescriptor.getGetter();
}
@Override
public final void getAndWriteTo(OutputEx output, T message) throws IOException {
- String value = getter.get(message);
+ Object value = getter.get(message);
if (value != null) {
- output.writeScalarString(tag, tagSize, value);
+ writeTo(output, value);
}
}
}
diff --git a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/UInt32WriteSchemas.java b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/UInt32WriteSchemas.java
index 9d89b5f..9a47705 100644
--- a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/UInt32WriteSchemas.java
+++ b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/UInt32WriteSchemas.java
@@ -19,7 +19,6 @@
import java.io.IOException;
import org.apache.servicecomb.foundation.common.utils.bean.Getter;
-import org.apache.servicecomb.foundation.common.utils.bean.IntGetter;
import org.apache.servicecomb.foundation.protobuf.internal.ProtoUtils;
import org.apache.servicecomb.foundation.protobuf.internal.bean.PropertyDescriptor;
@@ -37,7 +36,7 @@
return new UInt32Schema<>(protoField, propertyDescriptor);
}
- return new UInt32DynamicSchema<>(protoField, propertyDescriptor);
+ return new UInt32Schema<>(protoField, propertyDescriptor);
}
private static class UInt32DynamicSchema<T> extends FieldSchema<T> {
@@ -72,7 +71,7 @@
}
private static class UInt32Schema<T> extends UInt32DynamicSchema<T> {
- protected final Getter<T, Integer> getter;
+ protected final Getter<T, Object> getter;
public UInt32Schema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor);
@@ -82,15 +81,15 @@
@Override
public final void getAndWriteTo(OutputEx output, T message) throws IOException {
- Integer value = getter.get(message);
+ Object value = getter.get(message);
if (value != null) {
- output.writeScalarUInt32(tag, tagSize, value);
+ writeTo(output, value);
}
}
}
private static class UInt32PrimitiveSchema<T> extends UInt32DynamicSchema<T> {
- private final IntGetter<T> primitiveGetter;
+ private final Getter<T, Integer> primitiveGetter;
public UInt32PrimitiveSchema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor);
diff --git a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/UInt64WriteSchemas.java b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/UInt64WriteSchemas.java
index 4234d46..c6ec795 100644
--- a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/UInt64WriteSchemas.java
+++ b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/serializer/scalar/UInt64WriteSchemas.java
@@ -19,7 +19,6 @@
import java.io.IOException;
import org.apache.servicecomb.foundation.common.utils.bean.Getter;
-import org.apache.servicecomb.foundation.common.utils.bean.LongGetter;
import org.apache.servicecomb.foundation.protobuf.internal.ProtoUtils;
import org.apache.servicecomb.foundation.protobuf.internal.bean.PropertyDescriptor;
@@ -37,7 +36,7 @@
return new UInt64Schema<>(protoField, propertyDescriptor);
}
- return new UInt64DynamicSchema<>(protoField, propertyDescriptor);
+ return new UInt64Schema<>(protoField, propertyDescriptor);
}
private static class UInt64DynamicSchema<T> extends FieldSchema<T> {
@@ -72,7 +71,7 @@
}
private static class UInt64Schema<T> extends UInt64DynamicSchema<T> {
- protected final Getter<T, Long> getter;
+ protected final Getter<T, Object> getter;
public UInt64Schema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor);
@@ -82,15 +81,15 @@
@Override
public final void getAndWriteTo(OutputEx output, T message) throws IOException {
- Long value = getter.get(message);
+ Object value = getter.get(message);
if (value != null) {
- output.writeScalarUInt64(tag, tagSize, value);
+ writeTo(output, value);
}
}
}
private static class UInt64PrimitiveSchema<T> extends UInt64DynamicSchema<T> {
- private final LongGetter<T> primitiveGetter;
+ private final Getter<T, Long> primitiveGetter;
public UInt64PrimitiveSchema(Field protoField, PropertyDescriptor propertyDescriptor) {
super(protoField, propertyDescriptor);
diff --git a/foundations/foundation-protobuf/src/test/java/org/apache/servicecomb/foundation/protobuf/internal/bean/TestBeanDescriptorManager.java b/foundations/foundation-protobuf/src/test/java/org/apache/servicecomb/foundation/protobuf/internal/bean/TestBeanDescriptorManager.java
index 9d2994b..bdbb714 100644
--- a/foundations/foundation-protobuf/src/test/java/org/apache/servicecomb/foundation/protobuf/internal/bean/TestBeanDescriptorManager.java
+++ b/foundations/foundation-protobuf/src/test/java/org/apache/servicecomb/foundation/protobuf/internal/bean/TestBeanDescriptorManager.java
@@ -20,8 +20,6 @@
import org.apache.servicecomb.foundation.common.utils.ReflectUtils;
import org.apache.servicecomb.foundation.common.utils.bean.Getter;
-import org.apache.servicecomb.foundation.common.utils.bean.IntGetter;
-import org.apache.servicecomb.foundation.common.utils.bean.IntSetter;
import org.apache.servicecomb.foundation.common.utils.bean.Setter;
import org.junit.Assert;
import org.junit.Test;
@@ -108,8 +106,8 @@
@Test
public void both() {
PropertyDescriptor propertyDescriptor = beanDescriptor.getPropertyDescriptors().get("both");
- ((IntSetter<Model>) propertyDescriptor.getSetter()).set(model, 1);
- Assert.assertEquals(1, ((IntGetter<Model>) propertyDescriptor.getGetter()).get(model));
+ ((Setter<Model, Integer>) propertyDescriptor.getSetter()).set(model, 1);
+ Assert.assertEquals(1, ((Getter<Model, Integer>) propertyDescriptor.getGetter()).get(model).intValue());
Assert.assertEquals(1, model.getBoth());
}
@@ -120,7 +118,7 @@
Assert.assertNull(propertyDescriptor.getSetter());
model.onlyGet(1);
- Assert.assertEquals(1, ((IntGetter<Model>) propertyDescriptor.getGetter()).get(model));
+ Assert.assertEquals(1, ((Getter<Model, Integer>) propertyDescriptor.getGetter()).get(model).intValue());
Assert.assertEquals(1, model.getOnlyGet());
}
@@ -130,7 +128,7 @@
PropertyDescriptor propertyDescriptor = beanDescriptor.getPropertyDescriptors().get("onlySet");
Assert.assertNull(propertyDescriptor.getGetter());
- ((IntSetter<Model>) propertyDescriptor.getSetter()).set(model, 1);
+ ((Setter<Model, Integer>) propertyDescriptor.getSetter()).set(model, 1);
Assert.assertEquals(1, model.onlySet());
}
diff --git a/integration-tests/it-common/src/main/java/org/apache/servicecomb/it/schema/objectparams/FlattenObjectRequest.java b/integration-tests/it-common/src/main/java/org/apache/servicecomb/it/schema/objectparams/FlattenObjectRequest.java
index eea3ce1..21b7b9f 100644
--- a/integration-tests/it-common/src/main/java/org/apache/servicecomb/it/schema/objectparams/FlattenObjectRequest.java
+++ b/integration-tests/it-common/src/main/java/org/apache/servicecomb/it/schema/objectparams/FlattenObjectRequest.java
@@ -20,56 +20,56 @@
import java.util.Objects;
public class FlattenObjectRequest {
- private byte aByte;
+ private byte anByte;
- private short aShort;
+ private short anShort;
private int anInt;
- private long aLong;
+ private long anLong;
- private float aFloat;
+ private float anFloat;
- private double aDouble;
+ private double anDouble;
- private boolean aBoolean;
+ private boolean anBoolean;
- private char aChar;
+ private char anChar;
- private Byte aWrappedByte;
+ private Byte anWrappedByte;
- private Short aWrappedShort;
+ private Short anWrappedShort;
- private Integer aWrappedInteger;
+ private Integer anWrappedInteger;
- private Long aWrappedLong;
+ private Long anWrappedLong;
- private Float aWrappedFloat;
+ private Float anWrappedFloat;
- private Double aWrappedDouble;
+ private Double anWrappedDouble;
- private Boolean aWrappedBoolean;
+ private Boolean anWrappedBoolean;
- private Character aWrappedCharacter;
+ private Character anWrappedCharacter;
private String string;
private Color color;
- public byte getaByte() {
- return aByte;
+ public byte getAnByte() {
+ return anByte;
}
- public void setaByte(byte aByte) {
- this.aByte = aByte;
+ public void setAnByte(byte anByte) {
+ this.anByte = anByte;
}
- public short getaShort() {
- return aShort;
+ public short getAnShort() {
+ return anShort;
}
- public void setaShort(short aShort) {
- this.aShort = aShort;
+ public void setAnShort(short anShort) {
+ this.anShort = anShort;
}
public int getAnInt() {
@@ -80,108 +80,108 @@
this.anInt = anInt;
}
- public long getaLong() {
- return aLong;
+ public long getAnLong() {
+ return anLong;
}
- public void setaLong(long aLong) {
- this.aLong = aLong;
+ public void setAnLong(long anLong) {
+ this.anLong = anLong;
}
- public float getaFloat() {
- return aFloat;
+ public float getAnFloat() {
+ return anFloat;
}
- public void setaFloat(float aFloat) {
- this.aFloat = aFloat;
+ public void setAnFloat(float anFloat) {
+ this.anFloat = anFloat;
}
- public double getaDouble() {
- return aDouble;
+ public double getAnDouble() {
+ return anDouble;
}
- public void setaDouble(double aDouble) {
- this.aDouble = aDouble;
+ public void setAnDouble(double anDouble) {
+ this.anDouble = anDouble;
}
- public boolean isaBoolean() {
- return aBoolean;
+ public boolean isAnBoolean() {
+ return anBoolean;
}
- public void setaBoolean(boolean aBoolean) {
- this.aBoolean = aBoolean;
+ public void setAnBoolean(boolean anBoolean) {
+ this.anBoolean = anBoolean;
}
- public char getaChar() {
- return aChar;
+ public char getAnChar() {
+ return anChar;
}
- public void setaChar(char aChar) {
- this.aChar = aChar;
+ public void setAnChar(char anChar) {
+ this.anChar = anChar;
}
- public Byte getaWrappedByte() {
- return aWrappedByte;
+ public Byte getAnWrappedByte() {
+ return anWrappedByte;
}
- public void setaWrappedByte(Byte aWrappedByte) {
- this.aWrappedByte = aWrappedByte;
+ public void setAnWrappedByte(Byte anWrappedByte) {
+ this.anWrappedByte = anWrappedByte;
}
- public Short getaWrappedShort() {
- return aWrappedShort;
+ public Short getAnWrappedShort() {
+ return anWrappedShort;
}
- public void setaWrappedShort(Short aWrappedShort) {
- this.aWrappedShort = aWrappedShort;
+ public void setAnWrappedShort(Short anWrappedShort) {
+ this.anWrappedShort = anWrappedShort;
}
- public Integer getaWrappedInteger() {
- return aWrappedInteger;
+ public Integer getAnWrappedInteger() {
+ return anWrappedInteger;
}
- public void setaWrappedInteger(Integer aWrappedInteger) {
- this.aWrappedInteger = aWrappedInteger;
+ public void setAnWrappedInteger(Integer anWrappedInteger) {
+ this.anWrappedInteger = anWrappedInteger;
}
- public Long getaWrappedLong() {
- return aWrappedLong;
+ public Long getAnWrappedLong() {
+ return anWrappedLong;
}
- public void setaWrappedLong(Long aWrappedLong) {
- this.aWrappedLong = aWrappedLong;
+ public void setAnWrappedLong(Long anWrappedLong) {
+ this.anWrappedLong = anWrappedLong;
}
- public Float getaWrappedFloat() {
- return aWrappedFloat;
+ public Float getAnWrappedFloat() {
+ return anWrappedFloat;
}
- public void setaWrappedFloat(Float aWrappedFloat) {
- this.aWrappedFloat = aWrappedFloat;
+ public void setAnWrappedFloat(Float anWrappedFloat) {
+ this.anWrappedFloat = anWrappedFloat;
}
- public Double getaWrappedDouble() {
- return aWrappedDouble;
+ public Double getAnWrappedDouble() {
+ return anWrappedDouble;
}
- public void setaWrappedDouble(Double aWrappedDouble) {
- this.aWrappedDouble = aWrappedDouble;
+ public void setAnWrappedDouble(Double anWrappedDouble) {
+ this.anWrappedDouble = anWrappedDouble;
}
- public Boolean getaWrappedBoolean() {
- return aWrappedBoolean;
+ public Boolean getAnWrappedBoolean() {
+ return anWrappedBoolean;
}
- public void setaWrappedBoolean(Boolean aWrappedBoolean) {
- this.aWrappedBoolean = aWrappedBoolean;
+ public void setAnWrappedBoolean(Boolean anWrappedBoolean) {
+ this.anWrappedBoolean = anWrappedBoolean;
}
- public Character getaWrappedCharacter() {
- return aWrappedCharacter;
+ public Character getAnWrappedCharacter() {
+ return anWrappedCharacter;
}
- public void setaWrappedCharacter(Character aWrappedCharacter) {
- this.aWrappedCharacter = aWrappedCharacter;
+ public void setAnWrappedCharacter(Character anWrappedCharacter) {
+ this.anWrappedCharacter = anWrappedCharacter;
}
public String getString() {
@@ -203,22 +203,22 @@
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("FlattenObjectRequest{");
- sb.append("aByte=").append(aByte);
- sb.append(", aShort=").append(aShort);
+ sb.append("anByte=").append(anByte);
+ sb.append(", anShort=").append(anShort);
sb.append(", anInt=").append(anInt);
- sb.append(", aLong=").append(aLong);
- sb.append(", aFloat=").append(aFloat);
- sb.append(", aDouble=").append(aDouble);
- sb.append(", aBoolean=").append(aBoolean);
- sb.append(", aChar=").append(aChar);
- sb.append(", aWrappedByte=").append(aWrappedByte);
- sb.append(", aWrappedShort=").append(aWrappedShort);
- sb.append(", aWrappedInteger=").append(aWrappedInteger);
- sb.append(", aWrappedLong=").append(aWrappedLong);
- sb.append(", aWrappedFloat=").append(aWrappedFloat);
- sb.append(", aWrappedDouble=").append(aWrappedDouble);
- sb.append(", aWrappedBoolean=").append(aWrappedBoolean);
- sb.append(", aWrappedCharacter=").append(aWrappedCharacter);
+ sb.append(", anLong=").append(anLong);
+ sb.append(", anFloat=").append(anFloat);
+ sb.append(", anDouble=").append(anDouble);
+ sb.append(", anBoolean=").append(anBoolean);
+ sb.append(", anChar=").append(anChar);
+ sb.append(", anWrappedByte=").append(anWrappedByte);
+ sb.append(", anWrappedShort=").append(anWrappedShort);
+ sb.append(", anWrappedInteger=").append(anWrappedInteger);
+ sb.append(", anWrappedLong=").append(anWrappedLong);
+ sb.append(", anWrappedFloat=").append(anWrappedFloat);
+ sb.append(", anWrappedDouble=").append(anWrappedDouble);
+ sb.append(", anWrappedBoolean=").append(anWrappedBoolean);
+ sb.append(", anWrappedCharacter=").append(anWrappedCharacter);
sb.append(", string='").append(string).append('\'');
sb.append(", color=").append(color);
sb.append('}');
@@ -234,22 +234,22 @@
return false;
}
FlattenObjectRequest that = (FlattenObjectRequest) o;
- return aByte == that.aByte &&
- aShort == that.aShort &&
+ return anByte == that.anByte &&
+ anShort == that.anShort &&
anInt == that.anInt &&
- aLong == that.aLong &&
- Float.compare(that.aFloat, aFloat) == 0 &&
- Double.compare(that.aDouble, aDouble) == 0 &&
- aBoolean == that.aBoolean &&
- aChar == that.aChar &&
- Objects.equals(aWrappedByte, that.aWrappedByte) &&
- Objects.equals(aWrappedShort, that.aWrappedShort) &&
- Objects.equals(aWrappedInteger, that.aWrappedInteger) &&
- Objects.equals(aWrappedLong, that.aWrappedLong) &&
- Objects.equals(aWrappedFloat, that.aWrappedFloat) &&
- Objects.equals(aWrappedDouble, that.aWrappedDouble) &&
- Objects.equals(aWrappedBoolean, that.aWrappedBoolean) &&
- Objects.equals(aWrappedCharacter, that.aWrappedCharacter) &&
+ anLong == that.anLong &&
+ Float.compare(that.anFloat, anFloat) == 0 &&
+ Double.compare(that.anDouble, anDouble) == 0 &&
+ anBoolean == that.anBoolean &&
+ anChar == that.anChar &&
+ Objects.equals(anWrappedByte, that.anWrappedByte) &&
+ Objects.equals(anWrappedShort, that.anWrappedShort) &&
+ Objects.equals(anWrappedInteger, that.anWrappedInteger) &&
+ Objects.equals(anWrappedLong, that.anWrappedLong) &&
+ Objects.equals(anWrappedFloat, that.anWrappedFloat) &&
+ Objects.equals(anWrappedDouble, that.anWrappedDouble) &&
+ Objects.equals(anWrappedBoolean, that.anWrappedBoolean) &&
+ Objects.equals(anWrappedCharacter, that.anWrappedCharacter) &&
Objects.equals(string, that.string) &&
color == that.color;
}
@@ -257,8 +257,8 @@
@Override
public int hashCode() {
return Objects
- .hash(aByte, aShort, anInt, aLong, aFloat, aDouble, aBoolean, aChar, aWrappedByte, aWrappedShort,
- aWrappedInteger,
- aWrappedLong, aWrappedFloat, aWrappedDouble, aWrappedBoolean, aWrappedCharacter, string, color);
+ .hash(anByte, anShort, anInt, anLong, anFloat, anDouble, anBoolean, anChar, anWrappedByte, anWrappedShort,
+ anWrappedInteger,
+ anWrappedLong, anWrappedFloat, anWrappedDouble, anWrappedBoolean, anWrappedCharacter, string, color);
}
}
\ No newline at end of file
diff --git a/integration-tests/it-common/src/main/java/org/apache/servicecomb/it/schema/objectparams/FlattenObjectResponse.java b/integration-tests/it-common/src/main/java/org/apache/servicecomb/it/schema/objectparams/FlattenObjectResponse.java
index 19ce7a3..4c9bece 100644
--- a/integration-tests/it-common/src/main/java/org/apache/servicecomb/it/schema/objectparams/FlattenObjectResponse.java
+++ b/integration-tests/it-common/src/main/java/org/apache/servicecomb/it/schema/objectparams/FlattenObjectResponse.java
@@ -20,56 +20,56 @@
import java.util.Objects;
public class FlattenObjectResponse {
- private byte aByte;
+ private byte anByte;
- private short aShort;
+ private short anShort;
private int anInt;
- private long aLong;
+ private long anLong;
- private float aFloat;
+ private float anFloat;
- private double aDouble;
+ private double anDouble;
- private boolean aBoolean;
+ private boolean anBoolean;
- private char aChar;
+ private char anChar;
- private Byte aWrappedByte;
+ private Byte anWrappedByte;
- private Short aWrappedShort;
+ private Short anWrappedShort;
- private Integer aWrappedInteger;
+ private Integer anWrappedInteger;
- private Long aWrappedLong;
+ private Long anWrappedLong;
- private Float aWrappedFloat;
+ private Float anWrappedFloat;
- private Double aWrappedDouble;
+ private Double anWrappedDouble;
- private Boolean aWrappedBoolean;
+ private Boolean anWrappedBoolean;
- private Character aWrappedCharacter;
+ private Character anWrappedCharacter;
private String string;
private Color color;
- public byte getaByte() {
- return aByte;
+ public byte getAnByte() {
+ return anByte;
}
- public void setaByte(byte aByte) {
- this.aByte = aByte;
+ public void setAnByte(byte anByte) {
+ this.anByte = anByte;
}
- public short getaShort() {
- return aShort;
+ public short getAnShort() {
+ return anShort;
}
- public void setaShort(short aShort) {
- this.aShort = aShort;
+ public void setAnShort(short anShort) {
+ this.anShort = anShort;
}
public int getAnInt() {
@@ -80,108 +80,108 @@
this.anInt = anInt;
}
- public long getaLong() {
- return aLong;
+ public long getAnLong() {
+ return anLong;
}
- public void setaLong(long aLong) {
- this.aLong = aLong;
+ public void setAnLong(long anLong) {
+ this.anLong = anLong;
}
- public float getaFloat() {
- return aFloat;
+ public float getAnFloat() {
+ return anFloat;
}
- public void setaFloat(float aFloat) {
- this.aFloat = aFloat;
+ public void setAnFloat(float anFloat) {
+ this.anFloat = anFloat;
}
- public double getaDouble() {
- return aDouble;
+ public double getAnDouble() {
+ return anDouble;
}
- public void setaDouble(double aDouble) {
- this.aDouble = aDouble;
+ public void setAnDouble(double anDouble) {
+ this.anDouble = anDouble;
}
- public boolean isaBoolean() {
- return aBoolean;
+ public boolean isAnBoolean() {
+ return anBoolean;
}
- public void setaBoolean(boolean aBoolean) {
- this.aBoolean = aBoolean;
+ public void setAnBoolean(boolean anBoolean) {
+ this.anBoolean = anBoolean;
}
- public char getaChar() {
- return aChar;
+ public char getAnChar() {
+ return anChar;
}
- public void setaChar(char aChar) {
- this.aChar = aChar;
+ public void setAnChar(char anChar) {
+ this.anChar = anChar;
}
- public Byte getaWrappedByte() {
- return aWrappedByte;
+ public Byte getAnWrappedByte() {
+ return anWrappedByte;
}
- public void setaWrappedByte(Byte aWrappedByte) {
- this.aWrappedByte = aWrappedByte;
+ public void setAnWrappedByte(Byte anWrappedByte) {
+ this.anWrappedByte = anWrappedByte;
}
- public Short getaWrappedShort() {
- return aWrappedShort;
+ public Short getAnWrappedShort() {
+ return anWrappedShort;
}
- public void setaWrappedShort(Short aWrappedShort) {
- this.aWrappedShort = aWrappedShort;
+ public void setAnWrappedShort(Short anWrappedShort) {
+ this.anWrappedShort = anWrappedShort;
}
- public Integer getaWrappedInteger() {
- return aWrappedInteger;
+ public Integer getAnWrappedInteger() {
+ return anWrappedInteger;
}
- public void setaWrappedInteger(Integer aWrappedInteger) {
- this.aWrappedInteger = aWrappedInteger;
+ public void setAnWrappedInteger(Integer anWrappedInteger) {
+ this.anWrappedInteger = anWrappedInteger;
}
- public Long getaWrappedLong() {
- return aWrappedLong;
+ public Long getAnWrappedLong() {
+ return anWrappedLong;
}
- public void setaWrappedLong(Long aWrappedLong) {
- this.aWrappedLong = aWrappedLong;
+ public void setAnWrappedLong(Long anWrappedLong) {
+ this.anWrappedLong = anWrappedLong;
}
- public Float getaWrappedFloat() {
- return aWrappedFloat;
+ public Float getAnWrappedFloat() {
+ return anWrappedFloat;
}
- public void setaWrappedFloat(Float aWrappedFloat) {
- this.aWrappedFloat = aWrappedFloat;
+ public void setAnWrappedFloat(Float anWrappedFloat) {
+ this.anWrappedFloat = anWrappedFloat;
}
- public Double getaWrappedDouble() {
- return aWrappedDouble;
+ public Double getAnWrappedDouble() {
+ return anWrappedDouble;
}
- public void setaWrappedDouble(Double aWrappedDouble) {
- this.aWrappedDouble = aWrappedDouble;
+ public void setAnWrappedDouble(Double anWrappedDouble) {
+ this.anWrappedDouble = anWrappedDouble;
}
- public Boolean getaWrappedBoolean() {
- return aWrappedBoolean;
+ public Boolean getAnWrappedBoolean() {
+ return anWrappedBoolean;
}
- public void setaWrappedBoolean(Boolean aWrappedBoolean) {
- this.aWrappedBoolean = aWrappedBoolean;
+ public void setAnWrappedBoolean(Boolean anWrappedBoolean) {
+ this.anWrappedBoolean = anWrappedBoolean;
}
- public Character getaWrappedCharacter() {
- return aWrappedCharacter;
+ public Character getAnWrappedCharacter() {
+ return anWrappedCharacter;
}
- public void setaWrappedCharacter(Character aWrappedCharacter) {
- this.aWrappedCharacter = aWrappedCharacter;
+ public void setAnWrappedCharacter(Character anWrappedCharacter) {
+ this.anWrappedCharacter = anWrappedCharacter;
}
public String getString() {
@@ -203,22 +203,22 @@
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("FlattenObjectResponse{");
- sb.append("aByte=").append(aByte);
- sb.append(", aShort=").append(aShort);
+ sb.append("anByte=").append(anByte);
+ sb.append(", anShort=").append(anShort);
sb.append(", anInt=").append(anInt);
- sb.append(", aLong=").append(aLong);
- sb.append(", aFloat=").append(aFloat);
- sb.append(", aDouble=").append(aDouble);
- sb.append(", aBoolean=").append(aBoolean);
- sb.append(", aChar=").append(aChar);
- sb.append(", aWrappedByte=").append(aWrappedByte);
- sb.append(", aWrappedShort=").append(aWrappedShort);
- sb.append(", aWrappedInteger=").append(aWrappedInteger);
- sb.append(", aWrappedLong=").append(aWrappedLong);
- sb.append(", aWrappedFloat=").append(aWrappedFloat);
- sb.append(", aWrappedDouble=").append(aWrappedDouble);
- sb.append(", aWrappedBoolean=").append(aWrappedBoolean);
- sb.append(", aWrappedCharacter=").append(aWrappedCharacter);
+ sb.append(", anLong=").append(anLong);
+ sb.append(", anFloat=").append(anFloat);
+ sb.append(", anDouble=").append(anDouble);
+ sb.append(", anBoolean=").append(anBoolean);
+ sb.append(", anChar=").append(anChar);
+ sb.append(", anWrappedByte=").append(anWrappedByte);
+ sb.append(", anWrappedShort=").append(anWrappedShort);
+ sb.append(", anWrappedInteger=").append(anWrappedInteger);
+ sb.append(", anWrappedLong=").append(anWrappedLong);
+ sb.append(", anWrappedFloat=").append(anWrappedFloat);
+ sb.append(", anWrappedDouble=").append(anWrappedDouble);
+ sb.append(", anWrappedBoolean=").append(anWrappedBoolean);
+ sb.append(", anWrappedCharacter=").append(anWrappedCharacter);
sb.append(", string='").append(string).append('\'');
sb.append(", color=").append(color);
sb.append('}');
@@ -234,22 +234,22 @@
return false;
}
FlattenObjectResponse that = (FlattenObjectResponse) o;
- return aByte == that.aByte &&
- aShort == that.aShort &&
+ return anByte == that.anByte &&
+ anShort == that.anShort &&
anInt == that.anInt &&
- aLong == that.aLong &&
- Float.compare(that.aFloat, aFloat) == 0 &&
- Double.compare(that.aDouble, aDouble) == 0 &&
- aBoolean == that.aBoolean &&
- aChar == that.aChar &&
- Objects.equals(aWrappedByte, that.aWrappedByte) &&
- Objects.equals(aWrappedShort, that.aWrappedShort) &&
- Objects.equals(aWrappedInteger, that.aWrappedInteger) &&
- Objects.equals(aWrappedLong, that.aWrappedLong) &&
- Objects.equals(aWrappedFloat, that.aWrappedFloat) &&
- Objects.equals(aWrappedDouble, that.aWrappedDouble) &&
- Objects.equals(aWrappedBoolean, that.aWrappedBoolean) &&
- Objects.equals(aWrappedCharacter, that.aWrappedCharacter) &&
+ anLong == that.anLong &&
+ Float.compare(that.anFloat, anFloat) == 0 &&
+ Double.compare(that.anDouble, anDouble) == 0 &&
+ anBoolean == that.anBoolean &&
+ anChar == that.anChar &&
+ Objects.equals(anWrappedByte, that.anWrappedByte) &&
+ Objects.equals(anWrappedShort, that.anWrappedShort) &&
+ Objects.equals(anWrappedInteger, that.anWrappedInteger) &&
+ Objects.equals(anWrappedLong, that.anWrappedLong) &&
+ Objects.equals(anWrappedFloat, that.anWrappedFloat) &&
+ Objects.equals(anWrappedDouble, that.anWrappedDouble) &&
+ Objects.equals(anWrappedBoolean, that.anWrappedBoolean) &&
+ Objects.equals(anWrappedCharacter, that.anWrappedCharacter) &&
Objects.equals(string, that.string) &&
color == that.color;
}
@@ -257,8 +257,8 @@
@Override
public int hashCode() {
return Objects
- .hash(aByte, aShort, anInt, aLong, aFloat, aDouble, aBoolean, aChar, aWrappedByte, aWrappedShort,
- aWrappedInteger,
- aWrappedLong, aWrappedFloat, aWrappedDouble, aWrappedBoolean, aWrappedCharacter, string, color);
+ .hash(anByte, anShort, anInt, anLong, anFloat, anDouble, anBoolean, anChar, anWrappedByte, anWrappedShort,
+ anWrappedInteger,
+ anWrappedLong, anWrappedFloat, anWrappedDouble, anWrappedBoolean, anWrappedCharacter, string, color);
}
}
diff --git a/integration-tests/it-common/src/main/java/org/apache/servicecomb/it/schema/objectparams/RecursiveObjectParam.java b/integration-tests/it-common/src/main/java/org/apache/servicecomb/it/schema/objectparams/RecursiveObjectParam.java
index 1ca29ed..0cef05b 100644
--- a/integration-tests/it-common/src/main/java/org/apache/servicecomb/it/schema/objectparams/RecursiveObjectParam.java
+++ b/integration-tests/it-common/src/main/java/org/apache/servicecomb/it/schema/objectparams/RecursiveObjectParam.java
@@ -28,7 +28,7 @@
private String string;
- private Color color;
+ private Color color = Color.RED; // If using highway, it's best practise to give default value to the first item. Or should take null equals to default value.
public RecursiveObjectParam() {
}
diff --git a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestDefaultJsonValueJaxrsSchema.java b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestDefaultJsonValueJaxrsSchema.java
index 257efe6..204c705 100644
--- a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestDefaultJsonValueJaxrsSchema.java
+++ b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestDefaultJsonValueJaxrsSchema.java
@@ -40,7 +40,8 @@
Assert.assertEquals("expected:0:0", result);
result = client.getForObject("/queryInput?size=", String.class);
- Assert.assertEquals("expected:0:", result);
+ // For REST, getParameter will return empty string, but For HIGHWAY, will return 0
+ Assert.assertEquals(true, "expected:0:".equals(result) || "expected:0:0".equals(result));
}
@SuppressWarnings("unchecked")
diff --git a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestParamCodec.java b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestParamCodec.java
index 073ec18..6c36cc2 100644
--- a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestParamCodec.java
+++ b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestParamCodec.java
@@ -18,10 +18,6 @@
package org.apache.servicecomb.it.testcase;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Map;
import org.apache.servicecomb.foundation.test.scaffolding.model.Media;
import org.apache.servicecomb.it.Consumers;
@@ -30,12 +26,17 @@
public class TestParamCodec {
interface ParamCodecSchemaIntf {
String spaceCharCodec(String pathVal, String q);
+ }
+ interface ParamCodecSchemaIntfRestOnly {
Media enumSpecialName(Media media);
}
static Consumers<ParamCodecSchemaIntf> consumers = new Consumers<>("paramCodec", ParamCodecSchemaIntf.class);
+ static Consumers<ParamCodecSchemaIntfRestOnly> consumersRestOnly = new Consumers<>("paramCodecRestOnly",
+ ParamCodecSchemaIntfRestOnly.class);
+
@Test
public void spaceCharEncode_intf() {
String paramString = "a%2B+%20b%% %20c";
@@ -65,24 +66,24 @@
@Test
public void enumSpecialName_intf() {
- assertEquals(Media.AAC, consumers.getIntf().enumSpecialName(Media.AAC));
- assertEquals(Media.FLAC, consumers.getIntf().enumSpecialName(Media.FLAC));
- assertEquals(Media.H_264, consumers.getIntf().enumSpecialName(Media.H_264));
- assertEquals(Media.MPEG_2, consumers.getIntf().enumSpecialName(Media.MPEG_2));
- assertEquals(Media.WMV, consumers.getIntf().enumSpecialName(Media.WMV));
+ assertEquals(Media.AAC, consumersRestOnly.getIntf().enumSpecialName(Media.AAC));
+ assertEquals(Media.FLAC, consumersRestOnly.getIntf().enumSpecialName(Media.FLAC));
+ assertEquals(Media.H_264, consumersRestOnly.getIntf().enumSpecialName(Media.H_264));
+ assertEquals(Media.MPEG_2, consumersRestOnly.getIntf().enumSpecialName(Media.MPEG_2));
+ assertEquals(Media.WMV, consumersRestOnly.getIntf().enumSpecialName(Media.WMV));
}
@Test
public void enumSpecialName_rt() {
assertEquals(Media.AAC,
- consumers.getSCBRestTemplate().postForObject("/enum/enumSpecialName", Media.AAC, Media.class));
+ consumersRestOnly.getSCBRestTemplate().postForObject("/enum/enumSpecialName", Media.AAC, Media.class));
assertEquals(Media.FLAC,
- consumers.getSCBRestTemplate().postForObject("/enum/enumSpecialName", Media.FLAC, Media.class));
+ consumersRestOnly.getSCBRestTemplate().postForObject("/enum/enumSpecialName", Media.FLAC, Media.class));
assertEquals(Media.H_264,
- consumers.getSCBRestTemplate().postForObject("/enum/enumSpecialName", Media.H_264, Media.class));
+ consumersRestOnly.getSCBRestTemplate().postForObject("/enum/enumSpecialName", Media.H_264, Media.class));
assertEquals(Media.MPEG_2,
- consumers.getSCBRestTemplate().postForObject("/enum/enumSpecialName", Media.MPEG_2, Media.class));
+ consumersRestOnly.getSCBRestTemplate().postForObject("/enum/enumSpecialName", Media.MPEG_2, Media.class));
assertEquals(Media.WMV,
- consumers.getSCBRestTemplate().postForObject("/enum/enumSpecialName", Media.WMV, Media.class));
+ consumersRestOnly.getSCBRestTemplate().postForObject("/enum/enumSpecialName", Media.WMV, Media.class));
}
}
diff --git a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestParamCodecEdge.java b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestParamCodecEdge.java
index 11d37d2..171c1ce 100644
--- a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestParamCodecEdge.java
+++ b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestParamCodecEdge.java
@@ -40,6 +40,7 @@
private static final Logger LOGGER = LoggerFactory.getLogger(TestParamCodecEdge.class);
static GateRestTemplate client = GateRestTemplate.createEdgeRestTemplate("paramCodec");
+ static GateRestTemplate restOnlyClient = GateRestTemplate.createEdgeRestTemplate("paramCodecRestOnly");
@Test
public void spaceCharEncode() {
@@ -61,15 +62,15 @@
@Test
public void enumSpecialName() {
assertEquals(Media.AAC,
- client.postForObject("/enum/enumSpecialName", Media.AAC, Media.class));
+ restOnlyClient.postForObject("/enum/enumSpecialName", Media.AAC, Media.class));
assertEquals(Media.FLAC,
- client.postForObject("/enum/enumSpecialName", Media.FLAC, Media.class));
+ restOnlyClient.postForObject("/enum/enumSpecialName", Media.FLAC, Media.class));
assertEquals(Media.H_264,
- client.postForObject("/enum/enumSpecialName", Media.H_264, Media.class));
+ restOnlyClient.postForObject("/enum/enumSpecialName", Media.H_264, Media.class));
assertEquals(Media.MPEG_2,
- client.postForObject("/enum/enumSpecialName", Media.MPEG_2, Media.class));
+ restOnlyClient.postForObject("/enum/enumSpecialName", Media.MPEG_2, Media.class));
assertEquals(Media.WMV,
- client.postForObject("/enum/enumSpecialName", Media.WMV, Media.class));
+ restOnlyClient.postForObject("/enum/enumSpecialName", Media.WMV, Media.class));
}
@Test
diff --git a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/objectparams/TestJAXRSObjectParamType.java b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/objectparams/TestJAXRSObjectParamType.java
index 11b8d2b..6d24a38 100644
--- a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/objectparams/TestJAXRSObjectParamType.java
+++ b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/objectparams/TestJAXRSObjectParamType.java
@@ -130,7 +130,8 @@
responseEntity = consumers.getEdgeRestTemplate()
.exchange("/testMultiLayerObjectParam", HttpMethod.PUT,
new HttpEntity<>(null), MultiLayerObjectParam.class);
- Assert.assertNull(responseEntity.getBody());
+ // highway will not return null object
+ Assert.assertTrue(responseEntity.getBody() == null || responseEntity.getBody().getString() == null);
Assert.assertEquals(200, responseEntity.getStatusCodeValue());
}
@@ -252,22 +253,22 @@
private FlattenObjectRequest createFlattenObjectRequest() {
FlattenObjectRequest request = new FlattenObjectRequest();
- request.setaByte((byte) 8);
- request.setaShort((short) 7);
+ request.setAnByte((byte) 8);
+ request.setAnShort((short) 7);
request.setAnInt(6);
- request.setaLong(5);
- request.setaFloat(4.4f);
- request.setaDouble(3.3);
- request.setaBoolean(true);
- request.setaChar('c');
- request.setaWrappedByte((byte) 16);
- request.setaWrappedShort((short) 15);
- request.setaWrappedInteger(14);
- request.setaWrappedLong(13L);
- request.setaWrappedFloat(12.2f);
- request.setaWrappedDouble(11.1);
- request.setaWrappedBoolean(true);
- request.setaWrappedCharacter('d');
+ request.setAnLong(5);
+ request.setAnFloat(4.4f);
+ request.setAnDouble(3.3);
+ request.setAnBoolean(true);
+ request.setAnChar('c');
+ request.setAnWrappedByte((byte) 16);
+ request.setAnWrappedShort((short) 15);
+ request.setAnWrappedInteger(14);
+ request.setAnWrappedLong(13L);
+ request.setAnWrappedFloat(12.2f);
+ request.setAnWrappedDouble(11.1);
+ request.setAnWrappedBoolean(true);
+ request.setAnWrappedCharacter('d');
request.setString("abc");
request.setColor(Color.BLUE);
return request;
diff --git a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/objectparams/TestRPCObjectParamType.java b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/objectparams/TestRPCObjectParamType.java
index 7cd40b7..095ca48 100644
--- a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/objectparams/TestRPCObjectParamType.java
+++ b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/objectparams/TestRPCObjectParamType.java
@@ -169,22 +169,22 @@
private FlattenObjectRequest createFlattenObjectRequest() {
FlattenObjectRequest request = new FlattenObjectRequest();
- request.setaByte((byte) 8);
- request.setaShort((short) 7);
+ request.setAnByte((byte) 8);
+ request.setAnShort((short) 7);
request.setAnInt(6);
- request.setaLong(5);
- request.setaFloat(4.4f);
- request.setaDouble(3.3);
- request.setaBoolean(true);
- request.setaChar('c');
- request.setaWrappedByte((byte) 16);
- request.setaWrappedShort((short) 15);
- request.setaWrappedInteger(14);
- request.setaWrappedLong(13L);
- request.setaWrappedFloat(12.2f);
- request.setaWrappedDouble(11.1);
- request.setaWrappedBoolean(true);
- request.setaWrappedCharacter('d');
+ request.setAnLong(5);
+ request.setAnFloat(4.4f);
+ request.setAnDouble(3.3);
+ request.setAnBoolean(true);
+ request.setAnChar('c');
+ request.setAnWrappedByte((byte) 16);
+ request.setAnWrappedShort((short) 15);
+ request.setAnWrappedInteger(14);
+ request.setAnWrappedLong(13L);
+ request.setAnWrappedFloat(12.2f);
+ request.setAnWrappedDouble(11.1);
+ request.setAnWrappedBoolean(true);
+ request.setAnWrappedCharacter('d');
request.setString("abc");
request.setColor(Color.BLUE);
return request;
diff --git a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/objectparams/TestSpringMVCObjectParamType.java b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/objectparams/TestSpringMVCObjectParamType.java
index f9f77a8..69c6093 100644
--- a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/objectparams/TestSpringMVCObjectParamType.java
+++ b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/objectparams/TestSpringMVCObjectParamType.java
@@ -46,10 +46,10 @@
interface SpringMVCObjectParamTypeSchema extends ObjectParamTypeSchema {
TestNullFieldAndDefaultValueParam testNullFieldAndDefaultValue(Object request);
- FlattenObjectRequest testQueryObjectParam(byte aByte, short aShort, int anInt, long aLong, float aFloat,
- double aDouble, boolean aBoolean, char aChar, Byte aWrappedByte, Short aWrappedShort, Integer aWrappedInteger,
- Long aWrappedLong, Float aWrappedFloat, Double aWrappedDouble, Boolean aWrappedBoolean,
- Character aWrappedCharacter, String string, Color color);
+ FlattenObjectRequest testQueryObjectParam(byte anByte, short anShort, int anInt, long anLong, float anFloat,
+ double anDouble, boolean anBoolean, char anChar, Byte anWrappedByte, Short anWrappedShort, Integer anWrappedInteger,
+ Long anWrappedLong, Float anWrappedFloat, Double anWrappedDouble, Boolean anWrappedBoolean,
+ Character anWrappedCharacter, String string, Color color);
}
static Consumers<SpringMVCObjectParamTypeSchema> consumers =
@@ -134,7 +134,8 @@
responseEntity = consumers.getEdgeRestTemplate()
.exchange("/testMultiLayerObjectParam", HttpMethod.PUT,
new HttpEntity<>(null), MultiLayerObjectParam.class);
- Assert.assertNull(responseEntity.getBody());
+ // Highway will not return null
+ Assert.assertTrue(responseEntity.getBody() == null || responseEntity.getBody().getString() == null);
Assert.assertEquals(200, responseEntity.getStatusCodeValue());
}
@@ -309,33 +310,33 @@
public void testQueryObjectParam() {
FlattenObjectRequest expected = createFlattenObjectRequest();
FlattenObjectRequest response = consumers.getIntf().testQueryObjectParam(
- expected.getaByte(), expected.getaShort(), expected.getAnInt(), expected.getaLong(), expected.getaFloat(),
- expected.getaDouble(), expected.isaBoolean(), expected.getaChar(),
- expected.getaWrappedByte(), expected.getaWrappedShort(), expected.getaWrappedInteger(),
- expected.getaWrappedLong(), expected.getaWrappedFloat(), expected.getaWrappedDouble(),
- expected.getaWrappedBoolean(), expected.getaWrappedCharacter(),
+ expected.getAnByte(), expected.getAnShort(), expected.getAnInt(), expected.getAnLong(), expected.getAnFloat(),
+ expected.getAnDouble(), expected.isAnBoolean(), expected.getAnChar(),
+ expected.getAnWrappedByte(), expected.getAnWrappedShort(), expected.getAnWrappedInteger(),
+ expected.getAnWrappedLong(), expected.getAnWrappedFloat(), expected.getAnWrappedDouble(),
+ expected.getAnWrappedBoolean(), expected.getAnWrappedCharacter(),
expected.getString(), expected.getColor()
);
Assert.assertEquals(expected, response);
StringBuilder requestUriBuilder = new StringBuilder();
requestUriBuilder.append("/testQueryObjectParam?")
- .append("aByte=" + expected.getaByte()).append("&")
- .append("aShort=" + expected.getaShort()).append("&")
+ .append("anByte=" + expected.getAnByte()).append("&")
+ .append("anShort=" + expected.getAnShort()).append("&")
.append("anInt=" + expected.getAnInt()).append("&")
- .append("aLong=" + expected.getaLong()).append("&")
- .append("aFloat=" + expected.getaFloat()).append("&")
- .append("aDouble=" + expected.getaDouble()).append("&")
- .append("aBoolean=" + expected.isaBoolean()).append("&")
- .append("aChar=" + expected.getaChar()).append("&")
- .append("aWrappedByte=" + expected.getaWrappedByte()).append("&")
- .append("aWrappedShort=" + expected.getaWrappedShort()).append("&")
- .append("aWrappedInteger=" + expected.getaWrappedInteger()).append("&")
- .append("aWrappedLong=" + expected.getaWrappedLong()).append("&")
- .append("aWrappedFloat=" + expected.getaWrappedFloat()).append("&")
- .append("aWrappedDouble=" + expected.getaWrappedDouble()).append("&")
- .append("aWrappedBoolean=" + expected.getaWrappedBoolean()).append("&")
- .append("aWrappedCharacter=" + expected.getaWrappedCharacter()).append("&")
+ .append("anLong=" + expected.getAnLong()).append("&")
+ .append("anFloat=" + expected.getAnFloat()).append("&")
+ .append("anDouble=" + expected.getAnDouble()).append("&")
+ .append("anBoolean=" + expected.isAnBoolean()).append("&")
+ .append("anChar=" + expected.getAnChar()).append("&")
+ .append("anWrappedByte=" + expected.getAnWrappedByte()).append("&")
+ .append("anWrappedShort=" + expected.getAnWrappedShort()).append("&")
+ .append("anWrappedInteger=" + expected.getAnWrappedInteger()).append("&")
+ .append("anWrappedLong=" + expected.getAnWrappedLong()).append("&")
+ .append("anWrappedFloat=" + expected.getAnWrappedFloat()).append("&")
+ .append("anWrappedDouble=" + expected.getAnWrappedDouble()).append("&")
+ .append("anWrappedBoolean=" + expected.getAnWrappedBoolean()).append("&")
+ .append("anWrappedCharacter=" + expected.getAnWrappedCharacter()).append("&")
.append("string=" + expected.getString()).append("&")
.append("color=" + expected.getColor());
ResponseEntity<FlattenObjectRequest> responseEntity = consumers.getSCBRestTemplate()
@@ -348,16 +349,16 @@
Assert.assertEquals(expected, responseEntity.getBody());
Assert.assertEquals(200, responseEntity.getStatusCodeValue());
- expected.setaWrappedBoolean(null);
+ expected.setAnWrappedBoolean(null);
expected.setString(null);
expected.setAnInt(0);
- expected.setaWrappedInteger(null);
+ expected.setAnWrappedInteger(null);
response = consumers.getIntf().testQueryObjectParam(
- expected.getaByte(), expected.getaShort(), expected.getAnInt(), expected.getaLong(), expected.getaFloat(),
- expected.getaDouble(), expected.isaBoolean(), expected.getaChar(),
- expected.getaWrappedByte(), expected.getaWrappedShort(), expected.getaWrappedInteger(),
- expected.getaWrappedLong(), expected.getaWrappedFloat(), expected.getaWrappedDouble(),
- expected.getaWrappedBoolean(), expected.getaWrappedCharacter(),
+ expected.getAnByte(), expected.getAnShort(), expected.getAnInt(), expected.getAnLong(), expected.getAnFloat(),
+ expected.getAnDouble(), expected.isAnBoolean(), expected.getAnChar(),
+ expected.getAnWrappedByte(), expected.getAnWrappedShort(), expected.getAnWrappedInteger(),
+ expected.getAnWrappedLong(), expected.getAnWrappedFloat(), expected.getAnWrappedDouble(),
+ expected.getAnWrappedBoolean(), expected.getAnWrappedCharacter(),
expected.getString(), expected.getColor()
);
Assert.assertEquals(expected, response);
@@ -365,22 +366,22 @@
private FlattenObjectRequest createFlattenObjectRequest() {
FlattenObjectRequest request = new FlattenObjectRequest();
- request.setaByte((byte) 8);
- request.setaShort((short) 7);
+ request.setAnByte((byte) 8);
+ request.setAnShort((short) 7);
request.setAnInt(6);
- request.setaLong(5);
- request.setaFloat(4.4f);
- request.setaDouble(3.3);
- request.setaBoolean(true);
- request.setaChar('c');
- request.setaWrappedByte((byte) 16);
- request.setaWrappedShort((short) 15);
- request.setaWrappedInteger(14);
- request.setaWrappedLong(13L);
- request.setaWrappedFloat(12.2f);
- request.setaWrappedDouble(11.1);
- request.setaWrappedBoolean(true);
- request.setaWrappedCharacter('d');
+ request.setAnLong(5);
+ request.setAnFloat(4.4f);
+ request.setAnDouble(3.3);
+ request.setAnBoolean(true);
+ request.setAnChar('c');
+ request.setAnWrappedByte((byte) 16);
+ request.setAnWrappedShort((short) 15);
+ request.setAnWrappedInteger(14);
+ request.setAnWrappedLong(13L);
+ request.setAnWrappedFloat(12.2f);
+ request.setAnWrappedDouble(11.1);
+ request.setAnWrappedBoolean(true);
+ request.setAnWrappedCharacter('d');
request.setString("abc");
request.setColor(Color.BLUE);
return request;
diff --git a/integration-tests/it-edge/src/main/resources/microservice.yaml b/integration-tests/it-edge/src/main/resources/microservice.yaml
index ec4c310..2ce4708 100644
--- a/integration-tests/it-edge/src/main/resources/microservice.yaml
+++ b/integration-tests/it-edge/src/main/resources/microservice.yaml
@@ -50,6 +50,8 @@
org.apache.servicecomb.it.schema.RestControllerSchema:
restControllerSchemaQueries:
transport: rest
+ paramCodecRestOnly:
+ transport: rest
it-producer-h2:
generic:
genericUser:
@@ -67,6 +69,8 @@
org.apache.servicecomb.it.schema.RestControllerSchema:
restControllerSchemaQueries:
transport: rest
+ paramCodecRestOnly:
+ transport: rest
it-producer-h2c:
generic:
genericUser:
@@ -84,6 +88,8 @@
org.apache.servicecomb.it.schema.RestControllerSchema:
restControllerSchemaQueries:
transport: rest
+ paramCodecRestOnly:
+ transport: rest
it-producer-deploy-springboot2-servlet:
generic:
genericUser:
@@ -101,6 +107,8 @@
org.apache.servicecomb.it.schema.RestControllerSchema:
restControllerSchemaQueries:
transport: rest
+ paramCodecRestOnly:
+ transport: rest
it-producer-deploy-springboot2-standalone:
generic:
genericUser:
@@ -118,6 +126,8 @@
org.apache.servicecomb.it.schema.RestControllerSchema:
restControllerSchemaQueries:
transport: rest
+ paramCodecRestOnly:
+ transport: rest
http:
dispatcher:
edge:
@@ -140,6 +150,7 @@
microserviceName: business
versionRule: 2.0.0-3.0.0
request:
+ timeout: 5000
it-producer:
edgeExceptionConvertSchema:
timeout: 30000
diff --git a/integration-tests/it-producer/src/main/java/org/apache/servicecomb/it/schema/ParamCodecSchema.java b/integration-tests/it-producer/src/main/java/org/apache/servicecomb/it/schema/ParamCodecSchema.java
index 267e471..0cd2f99 100644
--- a/integration-tests/it-producer/src/main/java/org/apache/servicecomb/it/schema/ParamCodecSchema.java
+++ b/integration-tests/it-producer/src/main/java/org/apache/servicecomb/it/schema/ParamCodecSchema.java
@@ -27,7 +27,6 @@
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
-import org.apache.servicecomb.foundation.test.scaffolding.model.Media;
import org.apache.servicecomb.provider.rest.common.RestSchema;
import org.apache.servicecomb.swagger.invocation.context.ContextUtils;
@@ -51,15 +50,6 @@
return result.equals(expected1) || result.equals(expected2);
}
- /**
- * Test special enum name tagged by {@link com.fasterxml.jackson.annotation.JsonProperty}
- */
- @Path("enum/enumSpecialName")
- @POST
- public Media enumSpecialName(Media media) {
- return media;
- }
-
@Path("invocationContext")
@GET
public Map<String, String> getInvocationContext() {
diff --git a/integration-tests/it-producer/src/main/java/org/apache/servicecomb/it/schema/ParamCodecSchemaRestOnly.java b/integration-tests/it-producer/src/main/java/org/apache/servicecomb/it/schema/ParamCodecSchemaRestOnly.java
new file mode 100644
index 0000000..9e4db24
--- /dev/null
+++ b/integration-tests/it-producer/src/main/java/org/apache/servicecomb/it/schema/ParamCodecSchemaRestOnly.java
@@ -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.servicecomb.it.schema;
+
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+
+import org.apache.servicecomb.foundation.test.scaffolding.model.Media;
+import org.apache.servicecomb.provider.rest.common.RestSchema;
+
+@RestSchema(schemaId = "paramCodecRestOnly")
+@Path("/v1/paramCodecRestOnly")
+public class ParamCodecSchemaRestOnly {
+ /**
+ * Test special enum name tagged by {@link com.fasterxml.jackson.annotation.JsonProperty}.
+ * Special name not supported by ProtoBuffer
+ */
+ @Path("enum/enumSpecialName")
+ @POST
+ public Media enumSpecialName(Media media) {
+ return media;
+ }
+}
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index 30cadb1..7aacd1a 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -95,13 +95,10 @@
<groupId>org.apache.servicecomb</groupId>
<artifactId>transport-rest-vertx</artifactId>
</dependency>
- <!-- TODO : WEAK recover highway integration tests -->
- <!--
<dependency>
<groupId>org.apache.servicecomb</groupId>
<artifactId>transport-highway</artifactId>
</dependency>
- -->
<dependency>
<groupId>org.apache.servicecomb</groupId>
<artifactId>provider-springmvc</artifactId>