Polishing, javadoc. . .

This commit is contained in:
Oleg Zhurakousky
2019-02-19 14:12:00 +01:00
parent 16fb340de5
commit e86479e839
3 changed files with 33 additions and 20 deletions

View File

@@ -89,24 +89,14 @@ public abstract class AbstractComposableFunctionRegistry
return this.doLookup(type, functionDefinitionName); return this.doLookup(type, functionDefinitionName);
} }
@Override @SuppressWarnings("serial")
public void setApplicationEventPublisher(
ApplicationEventPublisher applicationEventPublisher) {
this.applicationEventPublisher = applicationEventPublisher;
}
@Override
public void setEnvironment(Environment environment) {
this.environment = environment;
}
@Override @Override
public Set<String> getNames(Class<?> type) { public Set<String> getNames(Class<?> type) {
if (type == null) { //perhaps some synchronization if (type == null) {
Set<String> names = new HashSet<>(suppliers.keySet()); return new HashSet<String>(getSupplierNames()) {{
names.addAll(functions.keySet()); addAll(getConsumerNames());
names.addAll(consumers.keySet()); addAll(getFunctionNames());
return names; } };
} }
if (Supplier.class.isAssignableFrom(type)) { if (Supplier.class.isAssignableFrom(type)) {
return this.getSupplierNames(); return this.getSupplierNames();
@@ -120,14 +110,26 @@ public abstract class AbstractComposableFunctionRegistry
return Collections.emptySet(); return Collections.emptySet();
} }
/**
* Returns the names of available Suppliers.
* @return immutable {@link Set} of available {@link Supplier} names.
*/
public Set<String> getSupplierNames() { public Set<String> getSupplierNames() {
return this.suppliers.keySet(); return Collections.unmodifiableSet(this.suppliers.keySet());
} }
/**
* Returns the names of available Functions.
* @return immutable {@link Set} of available {@link Function} names.
*/
public Set<String> getFunctionNames() { public Set<String> getFunctionNames() {
return this.functions.keySet(); return this.functions.keySet();
} }
/**
* Returns the names of available Consumers.
* @return immutable {@link Set} of available {@link Consumer} names.
*/
public Set<String> getConsumerNames() { public Set<String> getConsumerNames() {
return this.consumers.keySet(); return this.consumers.keySet();
} }
@@ -167,6 +169,17 @@ public abstract class AbstractComposableFunctionRegistry
return this.names.containsKey(function) ? this.names.get(function) : null; return this.names.containsKey(function) ? this.names.get(function) : null;
} }
@Override
public void setApplicationEventPublisher(
ApplicationEventPublisher applicationEventPublisher) {
this.applicationEventPublisher = applicationEventPublisher;
}
@Override
public void setEnvironment(Environment environment) {
this.environment = environment;
}
protected void wrap(FunctionRegistration<?> registration, String key) { protected void wrap(FunctionRegistration<?> registration, String key) {
Object target = registration.getTarget(); Object target = registration.getTarget();
this.addName(target, key); this.addName(target, key);

View File

@@ -96,7 +96,6 @@ public class ContextFunctionCatalogAutoConfiguration {
private ConfigurableListableBeanFactory beanFactory; private ConfigurableListableBeanFactory beanFactory;
//@SuppressWarnings("unchecked")
@Override @Override
public FunctionRegistration<?> getRegistration(Object function) { public FunctionRegistration<?> getRegistration(Object function) {
String functionName = this.lookupFunctionName(function); String functionName = this.lookupFunctionName(function);

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2019-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -26,6 +26,7 @@ import reactor.core.publisher.Mono;
* *
* @param <T> output type of target supplier * @param <T> output type of target supplier
* @author Mark Fisher * @author Mark Fisher
* @since 2.1
*/ */
public class MonoSupplier<T> implements Supplier<Mono<T>>, FluxWrapper<Supplier<T>> { public class MonoSupplier<T> implements Supplier<Mono<T>>, FluxWrapper<Supplier<T>> {
@@ -41,7 +42,7 @@ public class MonoSupplier<T> implements Supplier<Mono<T>>, FluxWrapper<Supplier<
} }
@Override @Override
@SuppressWarnings({ "unchecked", "rawtypes" }) @SuppressWarnings("unchecked")
public Mono<T> get() { public Mono<T> get() {
Object result = this.supplier.get(); Object result = this.supplier.get();
return Mono.just((T) result); return Mono.just((T) result);