All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.virtdata.core.VirtDataLibraries Maven / Gradle / Ivy

The newest version!
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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy