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

org.babyfish.jimmer.client.generator.Namespace Maven / Gradle / Ivy

There is a newer version: 0.9.35
Show newest version
package org.babyfish.jimmer.client.generator;

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

public class Namespace {

    private final Map map = new HashMap<>();

    private final Map subMap = new HashMap<>();

    public String allocate(String name) {
        int value = map.getOrDefault(name, 1);
        map.put(name, value + 1);
        return value == 1 ? name : name + '_' + value;
    }

    public Namespace subNamespace(String name) {
        return subMap.computeIfAbsent(name, it -> new Namespace());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy