io.virtdata.core.VirtDataLibraries Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of virtdata-lib-realer Show documentation
Show all versions of virtdata-lib-realer Show documentation
With inspiration from other libraries
package io.virtdata.core;
import io.virtdata.api.DataMapper;
import io.virtdata.api.VirtDataFunctionLibrary;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class VirtDataLibraries implements VirtDataFunctionLibrary {
private final static Logger logger = LoggerFactory.getLogger(VirtDataLibraries.class);
private static VirtDataLibraries instance = new VirtDataLibraries();
private final Map> threadSafeCache = new HashMap<>();
private final VirtDataFunctionResolver resolver = new VirtDataFunctionResolver();
public static VirtDataLibraries get() {
return instance;
}
private VirtDataLibraries() {
}
@Override
public String getName() {
return "ALL";
}
@Override
public List resolveFunctions(
Class> returnType,
Class> inputType,
String functionName,
Map customConfig,
Object... parameters)
{
List resolvedFunctions = new ArrayList<>();
List resolved = resolver.resolveFunctions(returnType, inputType, functionName, customConfig, parameters);
// Written this way to allow for easy debugging and understanding, do not convert to .stream()...
if (resolved.size()>0) {
resolvedFunctions.addAll(resolved);
}
return resolvedFunctions;
}
}