pagullo / directjngine

Automatically exported from code.google.com/p/directjngine
0 stars 0 forks source link

Action should be allowed to have duplicate name in different APIs. #2

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The way Registry class loop up action by name ignores the APIs that contains 
this action.
So we can't have actions with same name in the whole system even if their 
parent APIs are different.

public class Registry {
  @NonNull /* package */ static final Logger logger = Logger.getLogger( Registry.class );
  @NonNull private Map<String, RegisteredApi> apisByName = new HashMap<String, RegisteredApi>();
  @NonNull private Map<String, RegisteredAction> actionsByName = new HashMap<String, RegisteredAction>();
…
public boolean hasApi( String name ) {
    assert !StringUtils.isEmpty(name);

    return this.apisByName.containsKey(name);
  }
  …
  public boolean hasAction(String name) {
    assert !StringUtils.isEmpty( name );

    return this.actionsByName.containsKey(name);
  }

Original issue reported on code.google.com by yipking1...@yahoo.com on 31 May 2012 at 12:41