From db992a9f3ea430c97b6233f99bee5bca064eb6a9 Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Wed, 10 Nov 2021 10:04:00 +0100 Subject: [PATCH] Remove FunctionInspector --- .../main/resources/META-INF/spring.factories | 4 +- .../context/catalog/FunctionInspector.java | 153 ------------------ .../catalog/SimpleFunctionRegistry.java | 9 +- 3 files changed, 2 insertions(+), 164 deletions(-) delete mode 100644 spring-cloud-function-context/src/main/java/org/springframework/cloud/function/context/catalog/FunctionInspector.java diff --git a/spring-cloud-function-adapters/spring-cloud-function-adapter-aws/src/main/resources/META-INF/spring.factories b/spring-cloud-function-adapters/spring-cloud-function-adapter-aws/src/main/resources/META-INF/spring.factories index b10fc836b..caf1d26e9 100644 --- a/spring-cloud-function-adapters/spring-cloud-function-adapter-aws/src/main/resources/META-INF/spring.factories +++ b/spring-cloud-function-adapters/spring-cloud-function-adapter-aws/src/main/resources/META-INF/spring.factories @@ -1,4 +1,2 @@ org.springframework.context.ApplicationContextInitializer=\ -org.springframework.cloud.function.adapter.aws.CustomRuntimeInitializer -org.springframework.boot.env.EnvironmentPostProcessor=\ -org.springframework.cloud.function.adapter.aws.CustomRuntimeEnvironmentPostProcessor \ No newline at end of file +org.springframework.cloud.function.adapter.aws.CustomRuntimeInitializer \ No newline at end of file diff --git a/spring-cloud-function-context/src/main/java/org/springframework/cloud/function/context/catalog/FunctionInspector.java b/spring-cloud-function-context/src/main/java/org/springframework/cloud/function/context/catalog/FunctionInspector.java deleted file mode 100644 index 0b23146b0..000000000 --- a/spring-cloud-function-context/src/main/java/org/springframework/cloud/function/context/catalog/FunctionInspector.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright 2012-2020 the original author or authors. - * - * Licensed 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 - * - * https://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.springframework.cloud.function.context.catalog; - -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; -import java.lang.reflect.TypeVariable; -import java.lang.reflect.WildcardType; - -import net.jodah.typetools.TypeResolver; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -import org.springframework.cloud.function.context.FunctionRegistration; -import org.springframework.cloud.function.context.catalog.SimpleFunctionRegistry.FunctionInvocationWrapper; - -/** - * @author Dave Syer - * @author Oleg Zhurakousky - * - * @deprecated since 3.1 no longer used by the framework - */ -@Deprecated -public interface FunctionInspector { - - FunctionRegistration getRegistration(Object function); - - /** - * - * @deprecated since 3.1 no longer used by the framework - */ - @Deprecated - default boolean isMessage(Object function) { - if (function == null) { - return false; - } - - return ((FunctionInvocationWrapper) function).isInputTypeMessage(); - } - - /** - * - * @deprecated since 3.1 no longer used by the framework - */ - @Deprecated - default Class getInputType(Object function) { - if (function == null) { - return Object.class; - } - Type type = ((FunctionInvocationWrapper) function).getInputType(); - Class inputType; - if (type instanceof ParameterizedType) { - if (function != null && (((FunctionInvocationWrapper) function).isInputTypePublisher() || ((FunctionInvocationWrapper) function).isInputTypeMessage())) { - inputType = TypeResolver.resolveRawClass(FunctionTypeUtils.getImmediateGenericType(type, 0), null); - } - else { - inputType = ((FunctionInvocationWrapper) function).getRawInputType(); - } - } - else { - inputType = type instanceof TypeVariable || type instanceof WildcardType ? Object.class : (Class) type; - } - return inputType; - } - - /** - * - * @deprecated since 3.1 no longer used by the framework - */ - @Deprecated - default Class getOutputType(Object function) { - if (function == null) { - return Object.class; - } - Type type = ((FunctionInvocationWrapper) function).getOutputType(); - Class outputType; - if (type instanceof ParameterizedType) { - if (function != null && ((FunctionInvocationWrapper) function).isOutputTypePublisher() || ((FunctionInvocationWrapper) function).isOutputTypeMessage()) { - outputType = TypeResolver.resolveRawClass(FunctionTypeUtils.getImmediateGenericType(type, 0), null); - } - else { - outputType = ((FunctionInvocationWrapper) function).getRawOutputType(); - } - } - else { - outputType = type instanceof TypeVariable || type instanceof WildcardType ? Object.class : (Class) type; - } - return outputType; - } - - /** - * - * @deprecated since 3.1 no longer used by the framework - */ - @Deprecated - default Class getInputWrapper(Object function) { - Class c = function == null ? Object.class : TypeResolver.resolveRawClass(((FunctionInvocationWrapper) function).getInputType(), null); - if (Flux.class.isAssignableFrom(c)) { - return c; - } - else if (Mono.class.isAssignableFrom(c)) { - return c; - } - else { - return this.getInputType(function); - } - } - - /** - * - * @deprecated since 3.1 no longer used by the framework - */ - @Deprecated - default Class getOutputWrapper(Object function) { - Class c = function == null ? Object.class : TypeResolver.resolveRawClass(((FunctionInvocationWrapper) function).getOutputType(), null); - if (Flux.class.isAssignableFrom(c)) { - return c; - } - else if (Mono.class.isAssignableFrom(c)) { - return c; - } - else { - return this.getOutputType(function); - } - } - - /** - * - * @deprecated since 3.1 no longer used by the framework - */ - @Deprecated - default String getName(Object function) { - if (function == null) { - return null; - } - return ((FunctionInvocationWrapper) function).getFunctionDefinition(); - } - -} diff --git a/spring-cloud-function-context/src/main/java/org/springframework/cloud/function/context/catalog/SimpleFunctionRegistry.java b/spring-cloud-function-context/src/main/java/org/springframework/cloud/function/context/catalog/SimpleFunctionRegistry.java index 07ea3fb3e..2e22f46c4 100644 --- a/spring-cloud-function-context/src/main/java/org/springframework/cloud/function/context/catalog/SimpleFunctionRegistry.java +++ b/spring-cloud-function-context/src/main/java/org/springframework/cloud/function/context/catalog/SimpleFunctionRegistry.java @@ -82,7 +82,7 @@ import org.springframework.util.StringUtils; * @author Oleg Zhurakousky * */ -public class SimpleFunctionRegistry implements FunctionRegistry, FunctionInspector { +public class SimpleFunctionRegistry implements FunctionRegistry { protected Log logger = LogFactory.getLog(this.getClass()); /* * - do we care about FunctionRegistration after it's been registered? What additional value does it bring? @@ -133,13 +133,6 @@ public class SimpleFunctionRegistry implements FunctionRegistry, FunctionInspect } } - @Override - public FunctionRegistration getRegistration(Object function) { - throw new UnsupportedOperationException("FunctionInspector is deprecated. There is no need " - + "to access FunctionRegistration directly since you can interogate the actual " - + "looked-up function (see FunctionInvocationWrapper."); - } - public SimpleFunctionRegistry(ConversionService conversionService, CompositeMessageConverter messageConverter, JsonMapper jsonMapper) { this(conversionService, messageConverter, jsonMapper, null, null); }