Initial round of deprecation rmovals
This commit is contained in:
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2019 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.core;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
/**
|
||||
* Wrapper for a {@link Consumer} implementation that converts a <i>non-reactive</i>
|
||||
* consumer into a reactive function ({@code Function<Flux<?>, Mono<?>>}).
|
||||
*
|
||||
* @param <I> input type of target consumer
|
||||
* @author Dave Syer
|
||||
* @author Oleg Zhurakousky
|
||||
* @see FluxedConsumer
|
||||
*
|
||||
* @deprecated since 3.1 no longer used by the framework
|
||||
*/
|
||||
@Deprecated
|
||||
public class FluxConsumer<I>
|
||||
extends WrappedFunction<I, Void, Flux<I>, Mono<Void>, Consumer<I>> {
|
||||
|
||||
public FluxConsumer(Consumer<I> target) {
|
||||
super(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Void> apply(Flux<I> input) {
|
||||
return input.doOnNext(this.getTarget()).then();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2019 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.core;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
/**
|
||||
* {@link Function} implementation that wraps a target Function so that the target's
|
||||
* simple input and output types will be wrapped as {@link Flux} instances.
|
||||
*
|
||||
* @param <I> input type of target function
|
||||
* @param <O> output type of target function
|
||||
* @author Mark Fisher
|
||||
* @author Oleg Zhurakousky
|
||||
*
|
||||
* @deprecated since 3.1 no longer used by the framework
|
||||
*/
|
||||
@Deprecated
|
||||
public class FluxFunction<I, O>
|
||||
extends WrappedFunction<I, O, Flux<I>, Flux<O>, Function<I, O>> {
|
||||
|
||||
public FluxFunction(Function<I, O> target) {
|
||||
super(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<O> apply(Flux<I> input) {
|
||||
return input.map(value -> this.getTarget().apply(value));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2019 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.core;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
/**
|
||||
* {@link Supplier} implementation that wraps a target Supplier so that the target's
|
||||
* simple output type will be wrapped in a {@link Flux} instance. If a {@link Duration} is
|
||||
* provided, the Flux will produce output periodically, invoking the target Supplier's
|
||||
* {@code get} method at each interval. If no Duration is provided, the target will be
|
||||
* invoked only once.
|
||||
*
|
||||
* @param <T> output type of target supplier
|
||||
* @author Mark Fisher
|
||||
*
|
||||
* @deprecated since 3.1 no longer used by the framework
|
||||
*/
|
||||
@Deprecated
|
||||
public class FluxSupplier<T> implements Supplier<Flux<T>>, FluxWrapper<Supplier<T>> {
|
||||
|
||||
private final Supplier<T> supplier;
|
||||
|
||||
private final Duration period;
|
||||
|
||||
public FluxSupplier(Supplier<T> supplier) {
|
||||
this(supplier, null);
|
||||
}
|
||||
|
||||
public FluxSupplier(Supplier<T> supplier, Duration period) {
|
||||
this.supplier = supplier;
|
||||
this.period = period;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Supplier<T> getTarget() {
|
||||
return this.supplier;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public Flux<T> get() {
|
||||
if (this.period != null) {
|
||||
return Flux.interval(this.period).map(i -> this.supplier.get());
|
||||
}
|
||||
Object result = this.supplier.get();
|
||||
if (result instanceof Stream) {
|
||||
return Flux.fromStream((Stream) result);
|
||||
}
|
||||
return Flux.just((T) result);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2019 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.core;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
/**
|
||||
* Wrapper to mark function {@code Function<Flux<?>, Mono<?>>}.
|
||||
*
|
||||
* While it may look similar to {@link FluxedConsumer} the fundamental difference is that
|
||||
* this class represents a function that returns {@link Mono} of type {@code <O>}, while
|
||||
* {@link FluxedConsumer} is a consumer that has been decorated as
|
||||
* {@code Function<Flux<?>, Mono<Void>>}.
|
||||
*
|
||||
* @param <I> type of {@link Flux} input of the target function
|
||||
* @param <O> type of {@link Mono} output of the target function
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*
|
||||
* @deprecated since 3.1 no longer used by the framework
|
||||
*/
|
||||
@Deprecated
|
||||
public class FluxToMonoFunction<I, O>
|
||||
extends WrappedFunction<I, O, Flux<I>, Mono<O>, Function<Flux<I>, Mono<O>>> {
|
||||
|
||||
public FluxToMonoFunction(Function<Flux<I>, Mono<O>> target) {
|
||||
super(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<O> apply(Flux<I> input) {
|
||||
return this.getTarget().apply(input);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2019 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.core;
|
||||
|
||||
/**
|
||||
* @param <T> target type
|
||||
* @author Dave Syer
|
||||
*
|
||||
* @deprecated since 3.1 no longer used by the framework
|
||||
*/
|
||||
@Deprecated
|
||||
public interface FluxWrapper<T> {
|
||||
|
||||
T getTarget();
|
||||
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright 2019-2019 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.core;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
/**
|
||||
* Wrapper for a {@link Consumer} implementation that converts a reactive consumer into a
|
||||
* reactive function ({@code Function<Flux<?>, Mono<?>>}). This is primarily done for
|
||||
* consistent representation of reactive and non-reactive consumers.
|
||||
*
|
||||
* @param <I> input type of target consumer
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0.1
|
||||
* @see FluxConsumer
|
||||
*
|
||||
* @deprecated since 3.1 no longer used by the framework
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public class FluxedConsumer<I>
|
||||
extends WrappedFunction<I, Void, Flux<I>, Mono<Void>, Consumer<Flux<I>>> {
|
||||
|
||||
public FluxedConsumer(Consumer<Flux<I>> target) {
|
||||
super(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Void> apply(Flux<I> input) {
|
||||
return Mono.fromRunnable(() -> this.getTarget().accept(input));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright 2019-2019 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.core;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
/**
|
||||
* {@link Function} implementation that wraps a target Function so that the target's
|
||||
* simple input and output types will be wrapped as {@link Flux} instances.
|
||||
*
|
||||
* @param <I> input type of target function
|
||||
* @param <O> output type of target function
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0.1
|
||||
*
|
||||
* @deprecated since 3.1 no longer used by the framework
|
||||
*/
|
||||
@Deprecated
|
||||
public class FluxedFunction<I, O>
|
||||
extends WrappedFunction<I, O, Flux<I>, Flux<O>, Function<Flux<I>, Flux<O>>> {
|
||||
|
||||
public FluxedFunction(Function<Flux<I>, Flux<O>> target) {
|
||||
super(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<O> apply(Flux<I> input) {
|
||||
return input.transform(this.getTarget());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2019 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.core;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* @param <F> target type
|
||||
* @author Dave Syer
|
||||
*
|
||||
* @deprecated since 3.1 no longer used by the framework
|
||||
*/
|
||||
@Deprecated
|
||||
public interface FunctionFactoryMetadata<F> {
|
||||
|
||||
Method getFactoryMethod();
|
||||
|
||||
F getTarget();
|
||||
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2019 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.core;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
* @param <T> supplied type
|
||||
* @author Dave Syer
|
||||
* @deprecated since 3.1 no longer used by the framework
|
||||
*/
|
||||
@Deprecated
|
||||
public class IsolatedSupplier<T> implements Supplier<T>, Isolated {
|
||||
|
||||
private final Supplier<T> supplier;
|
||||
|
||||
private final ClassLoader classLoader;
|
||||
|
||||
public IsolatedSupplier(Supplier<T> supplier) {
|
||||
this.supplier = supplier;
|
||||
this.classLoader = supplier.getClass().getClassLoader();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassLoader getClassLoader() {
|
||||
return this.classLoader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get() {
|
||||
ClassLoader context = ClassUtils
|
||||
.overrideThreadContextClassLoader(this.classLoader);
|
||||
try {
|
||||
return this.supplier.get();
|
||||
}
|
||||
finally {
|
||||
ClassUtils.overrideThreadContextClassLoader(context);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright 2019-2019 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.core;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
/**
|
||||
* {@link Supplier} implementation that wraps a target Supplier so that the target's
|
||||
* simple output type will be wrapped in a {@link Mono} instance.
|
||||
*
|
||||
* @param <T> output type of target supplier
|
||||
* @author Mark Fisher
|
||||
* @since 2.1
|
||||
*
|
||||
* @deprecated since 3.1 no longer used by the framework
|
||||
*/
|
||||
@Deprecated
|
||||
public class MonoSupplier<T> implements Supplier<Mono<T>>, FluxWrapper<Supplier<T>> {
|
||||
|
||||
private final Supplier<T> supplier;
|
||||
|
||||
public MonoSupplier(Supplier<T> supplier) {
|
||||
this.supplier = supplier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Supplier<T> getTarget() {
|
||||
return this.supplier;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Mono<T> get() {
|
||||
Object result = this.supplier.get();
|
||||
return Mono.just((T) result);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2019 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.core;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
/**
|
||||
* Marker wrapper for target Function<Mono, Flux>.
|
||||
*
|
||||
* @param <I> type of {@link Mono} input of the target function
|
||||
* @param <O> type of {@link Flux} output of the target function
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*
|
||||
* @deprecated since 3.1 no longer used by the framework
|
||||
*/
|
||||
@Deprecated
|
||||
public class MonoToFluxFunction<I, O>
|
||||
extends WrappedFunction<I, O, Mono<I>, Flux<O>, Function<Mono<I>, Flux<O>>> {
|
||||
|
||||
public MonoToFluxFunction(Function<Mono<I>, Flux<O>> target) {
|
||||
super(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<O> apply(Mono<I> input) {
|
||||
return this.getTarget().apply(input);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright 2019-2019 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.core;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.reactivestreams.Publisher;
|
||||
|
||||
/**
|
||||
* Base class for all wrappers that represent underlying functions (user defined
|
||||
* suppliers, functions and/or consumers) as reactive functions.
|
||||
*
|
||||
* @param <I> input type of target consumer
|
||||
* @param <O> output type of target consumer
|
||||
* @param <IP> reactive input type of target function (instance of {@link Publisher}
|
||||
* @param <OP> reactive output type of target function (instance of {@link Publisher}
|
||||
* @param <T> actual target function (instance of {@link Supplier}, {@link Function} or
|
||||
* {@link Consumer})
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0.1
|
||||
*
|
||||
* @deprecated since 3.1 no longer used by the framework
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract class WrappedFunction<I, O, IP extends Publisher<I>, OP extends Publisher<O>, T>
|
||||
implements Function<IP, OP>, FluxWrapper<T> {
|
||||
|
||||
private final T target;
|
||||
|
||||
WrappedFunction(T target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T getTarget() {
|
||||
return this.target;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user