GH-202 Added size() to FunctionCatalog

Resolves #202
This commit is contained in:
Oleg Zhurakousky
2018-09-12 20:15:53 +02:00
parent d1c423e161
commit 40b542edfe
2 changed files with 15 additions and 0 deletions

View File

@@ -47,4 +47,12 @@ public interface FunctionCatalog {
Set<String> getNames(Class<?> type);
/**
* Return the count of functions registered in this catalog
* @return the count of functions registered in this catalog
*/
default int size() {
throw new UnsupportedOperationException("This instance of FunctionCatalog does not support this operation");
}
}

View File

@@ -169,6 +169,13 @@ public class ContextFunctionCatalogAutoConfiguration {
return Collections.emptySet();
}
@Override
public int size() {
return this.processor.getSuppliers().size() +
this.processor.getFunctions().size() +
this.processor.getConsumers().size();
}
public BeanFactoryFunctionCatalog(ContextFunctionRegistry processor) {
this.processor = processor;
}