X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=system%2Fgeneral%2Fsrc%2Fmain%2Fjava%2Forg%2Fwamblee%2Fsystem%2Fcore%2FDefaultScope.java;h=7290a790365eda04712f5ffe5ecd74cc692a2fb4;hb=ad6e06e3c1ba0c4ae0dea100596b1c5503bfe1c6;hp=5ec26223b416e842da3239add38c5fb65f803e43;hpb=fddbe9b130633c7d8925f2580afea65767d1d615;p=utils diff --git a/system/general/src/main/java/org/wamblee/system/core/DefaultScope.java b/system/general/src/main/java/org/wamblee/system/core/DefaultScope.java index 5ec26223..7290a790 100644 --- a/system/general/src/main/java/org/wamblee/system/core/DefaultScope.java +++ b/system/general/src/main/java/org/wamblee/system/core/DefaultScope.java @@ -17,17 +17,18 @@ package org.wamblee.system.core; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.TreeMap; +import java.util.UUID; public class DefaultScope implements Scope { private List _parents; - private int _count; private Map _properties; private Map _runtimes; - private Map _provided; + private Map _provided; private ProvidedInterface[] _externallyProvided; public DefaultScope(ProvidedInterface[] aExternallyProvided) { @@ -41,10 +42,9 @@ public class DefaultScope implements Scope { public DefaultScope(ProvidedInterface[] aExternallyProvided, List aParent) { _parents = new ArrayList(aParent); - _count = 0; - _properties = new TreeMap(); - _runtimes = new TreeMap(); - _provided = new TreeMap(); + _properties = new HashMap(); + _runtimes = new HashMap(); + _provided = new HashMap(); _externallyProvided = aExternallyProvided; } @@ -81,10 +81,8 @@ public class DefaultScope implements Scope { @Override synchronized public void publishInterface(ProvidedInterface aInterface, Object aImplementation) { - String id = "" + _count++; - _provided.put(id, new ProvidedInterfaceImplementation(aInterface, + _provided.put(aInterface, new ProvidedInterfaceImplementation(aInterface, aImplementation)); - aInterface.setUniqueId(id); } @Override @@ -92,13 +90,8 @@ public class DefaultScope implements Scope { Class aType) { if ( aInterface == null ) { return null; - } - String id = aInterface.getUniqueId(); - if ( id == null ) { - // optional interface that was not published. - return null; - } - ProvidedInterfaceImplementation provided = _provided.get(id); + } + ProvidedInterfaceImplementation provided = _provided.get(aInterface); if (provided == null) { for (Scope parent : _parents) { T impl = parent.getInterfaceImplementation(aInterface, aType);