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

com.mastfrog.webapi.Interpolators Maven / Gradle / Ivy

There is a newer version: 2.9.7
Show newest version
package com.mastfrog.webapi;

import java.util.LinkedList;
import java.util.List;

/**
 * Registry of interpolators by type
 *
 * @author Tim Boudreau
 */
final class Interpolators {

    private final List> all = new LinkedList<>();

    @SuppressWarnings("unchecked")
    > Class get(Class type) {
        for (Entry e : all) {
            if (type == e.parameterType) {
                return (Class) e.interpolatorType;
            }
        }
        return null;
    }

    public > void add(Class type, Class dec) {
        all.add(new Entry(type, dec));
    }

    private static final class Entry> {

        private final Class parameterType;
        private final Class interpolatorType;

        public Entry(Class parameterType, Class interpolatorType) {
            this.parameterType = parameterType;
            this.interpolatorType = interpolatorType;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy