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

io.github.amayaframework.di.stub.Mapping Maven / Gradle / Ivy

Go to download

A framework responsible for monitoring and automating the dependency injection process.

There is a newer version: 2.2.0
Show newest version
package io.github.amayaframework.di.stub;

import io.github.amayaframework.di.Artifact;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

final class Mapping {
    final Map artifacts;
    final Map fields;
    final String[] order;

    private Mapping(Map artifacts, Map fields, String[] order) {
        this.artifacts = artifacts;
        this.fields = fields;
        this.order = order;
    }

    static Mapping of(Set artifacts) {
        var from = new HashMap();
        var to = new HashMap();
        var order = new String[artifacts.size()];
        var count = 0;
        for (var artifact : artifacts) {
            var field = Integer.toString(count);
            from.put(artifact, field);
            to.put(field, artifact);
            order[count] = field;
            ++count;
        }
        return new Mapping(from, to, order);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy