From 53494d55bee12ce24f39f676ae5caca01732afd3 Mon Sep 17 00:00:00 2001 From: Volker Berlin Date: Sun, 7 Oct 2018 18:57:41 +0200 Subject: [PATCH] Add get/setProperty --- .../jwebassembly/JWebAssembly.java | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/de/inetsoftware/jwebassembly/JWebAssembly.java b/src/de/inetsoftware/jwebassembly/JWebAssembly.java index 80b175d..22dac84 100644 --- a/src/de/inetsoftware/jwebassembly/JWebAssembly.java +++ b/src/de/inetsoftware/jwebassembly/JWebAssembly.java @@ -24,6 +24,7 @@ import java.io.OutputStream; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import javax.annotation.Nonnull; @@ -41,7 +42,9 @@ import de.inetsoftware.jwebassembly.text.TextModuleWriter; */ public class JWebAssembly { - private List classFiles = new ArrayList<>(); + private final List classFiles = new ArrayList<>(); + + private final HashMap properties = new HashMap<>(); /** * Create a instance. @@ -73,6 +76,29 @@ public class JWebAssembly { classFiles.add( classFile ); } + /** + * Set property to control the behavior of the compiler + * + * @param key + * the key + * @param value + * the new value + */ + public void setProperty( String key, String value ) { + properties.put( key, value ); + } + + /** + * Get the value of a property. + * + * @param key + * the key + * @return the current value + */ + public String getProperty( String key ) { + return properties.get( key ); + } + /** * Convert the added files to a WebAssembly module in text representation. *