return wiresUnmodifiable;
}
- public <T extends ModelComponent> T getComponentByName(String name, Class<T> expectedComponentClass)
- {
- return getByName(name, expectedComponentClass, components);
- }
-
- public ModelWire getWireByName(String name)
+ public ModelComponent getComponentByName(String name)
{
- return getByName(name, ModelWire.class, wires);
+ return components.get(name);
}
@SuppressWarnings("unchecked")
- private static <T> T getByName(String name, Class<T> expectedClass, Map<String, ? super T> map)
+ public <T extends ModelComponent> T getComponentByName(String name, Class<T> expectedComponentClass)
{
- Object comp = map.get(name);
+ ModelComponent comp = components.get(name);
Objects.requireNonNull(comp, "Invaild path, component " + name + " not found");
- if (expectedClass.isInstance(comp))
+ if (expectedComponentClass.isInstance(comp))
return (T) comp;
- throw new IllegalArgumentException("The component " + name + " is not an instance of " + expectedClass);
+ throw new IllegalArgumentException("The component " + name + " is not an instance of " + expectedComponentClass);
+ }
+
+ public ModelWire getWireByName(String name)
+ {
+ return wires.get(name);
}
public <T extends ModelComponent> T getComponentBySubmodelPath(String path, Class<T> modelClass)