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

de.sstoehr.pustefix.i18n.input.AbstractReader Maven / Gradle / Ivy

There is a newer version: 1.0.2
Show newest version
package de.sstoehr.pustefix.i18n.input;

import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import de.sstoehr.pustefix.i18n.model.Locale;
import de.sstoehr.pustefix.i18n.model.Message;

public abstract class AbstractReader implements Reader {

    protected Map locales = new LinkedHashMap<>();

    @Override
    public void addLocale(Locale locale, File file) {
        locales.put(locale, file);
    }

    @Override
    public List read() {
        Map messages = new LinkedHashMap<>();
        for (Map.Entry locale : locales.entrySet()) {
            this.readSingle(locale.getKey(), locale.getValue(), messages);
        }

        List list = new ArrayList<>(messages.values());
        return Collections.unmodifiableList(list);
    }

    abstract void readSingle(Locale locale, File file, Map messages);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy