Made GUIComponent.getPin(String) fail-fast
[Mograsim.git] / net.mograsim.logic.ui / src / net / mograsim / logic / ui / model / components / GUIComponent.java
index 69b02bf..22f1fbf 100644 (file)
@@ -6,6 +6,7 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.TreeMap;
 import java.util.function.Consumer;
 import java.util.function.Supplier;
 
@@ -88,7 +89,10 @@ public abstract class GUIComponent
 
        public Pin getPin(String name)
        {
-               return pinsByName.get(name);
+               Pin pin = pinsByName.get(name);
+               if (pin == null)
+                       throw new IllegalArgumentException("No pin with the name " + name);
+               return pin;
        }
 
        // @formatter:off
@@ -150,4 +154,10 @@ public abstract class GUIComponent
        {
                return identifierDelegate.get();
        }
+
+       @SuppressWarnings("static-method")
+       public Map<String, Object> getInstantiationParameters()
+       {
+               return new TreeMap<>();
+       }
 }
\ No newline at end of file