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

dk.mada.jaxrs.generator.mpclient.imports.JavaUtil Maven / Gradle / Ivy

There is a newer version: 0.11.8
Show newest version
package dk.mada.jaxrs.generator.mpclient.imports;

import java.util.EnumSet;
import java.util.Optional;
import java.util.Set;

import dk.mada.jaxrs.generator.mpclient.imports.Imports.ImportRenderPrefs;

/**
 * Java util import paths.
 */
public enum JavaUtil implements TypedImport {
    /** ArrayList. */
    ARRAY_LIST("java.util.ArrayList"),
    /** Arrays. */
    ARRAYS("java.util.Arrays"),
    /** HashMap. */
    HASH_MAP("java.util.HashMap"),
    /** LinkedHashSet. */
    LINKED_HASH_SET("java.util.LinkedHashSet"),
    /** List. */
    LIST("java.util.List"),
    /** Map. */
    MAP("java.util.Map"),
    /** Objects. */
    OBJECTS("java.util.Objects"),
    /** Set. */
    SET("java.util.Set");

    /** The import path for the type. */
    private final String importPath;

    JavaUtil(String importPath) {
        this.importPath = importPath;
    }

    /** {@return the container implementation types} */
    public static Set containerImplementationTypes() {
        return EnumSet.of(
                JavaUtil.ARRAY_LIST,
                JavaUtil.LINKED_HASH_SET,
                JavaUtil.HASH_MAP);
    }

    /** {@return the generic container list-type} */
    public static JavaUtil containerListType() {
        return JavaUtil.LIST;
    }

    /** {@return the container list-types (including implementation)} */
    public static Set containerListImplementationTypes() {
        return EnumSet.of(
                JavaUtil.ARRAY_LIST,
                JavaUtil.LIST);
    }

    /** {@return the genetic container map-type} */
    public static JavaUtil containerMapType() {
        return JavaUtil.MAP;
    }

    /** {@return the container map-types (including implementation)} */
    public static Set containerMapImplementationTypes() {
        return EnumSet.of(
                JavaUtil.HASH_MAP,
                JavaUtil.MAP);
    }

    /** {@return the generic container set-type} */
    public static JavaUtil containerSetType() {
        return JavaUtil.SET;
    }

    /** {@return the container set-types (including implementation)} */
    public static Set containerSetImplementationTypes() {
        return EnumSet.of(
                JavaUtil.LINKED_HASH_SET,
                JavaUtil.SET);
    }

    @Override
    public Optional path(ImportRenderPrefs irp) {
        return Optional.of(importPath);
    }

    /** {@return the import path regardless of rendering preferences} */
    public String path() {
        return importPath;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy