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

com.github.ruediste.salta.standard.StandardStaticBinding Maven / Gradle / Ivy

Go to download

Core of the Salta Framework. Provides most of the infrastructure, but no API

There is a newer version: 1.1
Show newest version
package com.github.ruediste.salta.standard;

import java.util.HashSet;
import java.util.Set;
import java.util.function.Supplier;

import com.github.ruediste.salta.core.CoreDependencyKey;
import com.github.ruediste.salta.core.RecipeCreationContext;
import com.github.ruediste.salta.core.Scope;
import com.github.ruediste.salta.core.StaticBinding;
import com.github.ruediste.salta.core.compile.SupplierRecipe;
import com.github.ruediste.salta.matchers.Matcher;
import com.google.common.reflect.TypeToken;

/**
 * Statically defined Binding.
 */
public class StandardStaticBinding extends StaticBinding {
    public Matcher> dependencyMatcher;
    public final Set> possibleTypes = new HashSet<>();
    public CreationRecipeFactory recipeFactory;
    public Supplier scopeSupplier;

    @Override
    public Set> getPossibleTypes() {
        return possibleTypes;
    }

    @Override
    public SupplierRecipe createRecipe(RecipeCreationContext ctx) {
        return recipeFactory.createRecipe(ctx);
    }

    @Override
    public String toString() {
        return "StandardStaticBinding(" + dependencyMatcher + ")";
    }

    @Override
    public Matcher> getMatcher() {
        return dependencyMatcher;
    }

    @Override
    protected Scope getScopeImpl() {
        return scopeSupplier.get();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy