/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package API; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; /** * * @author Eugenio */ public class BuildParams { public static HashMap> params = new HashMap<>(); public static void _init() { } public static void Set(String tag, ArrayList values) { params.put(tag, values); } public static String GetFirst(String tag) throws Exception { return Get(tag).get(0); } public static ArrayList Get(String tag) throws Exception { if (!params.containsKey(tag)) { throw new Exception(String.format("Build param `%s` não definido!", tag)); } return params.get(tag); } public static void Add(String tag, String value) { ArrayList container; if (!params.containsKey(tag)) { container = new ArrayList<>(); params.put(tag, container); } else { container = params.get(tag); } container.add(value); } public static void Set(String tag, String value) { ArrayList a = new ArrayList<>(); a.add(value); params.put(tag, a); } public static void List() { System.out.println("BuildParams:\n"); for (Map.Entry> entry : params.entrySet()) { System.out.println("\t" + entry.getKey() + ": " + entry.getValue()); } } }