[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: New behaviour of AbstractMetaDataContext.isEmpty()

alesj do-not-reply at jboss.com
Thu Nov 15 15:28:59 EST 2007


"adrian at jboss.org" wrote : 
  | i.e. There should be a
  | 
  |   | List<MetaDataRetrieval> getScopedRetrievals(ScopeLevel level)
  |   | 
  | 
This should be enough:

  |    MetaData getScopeMetaData(ScopeLevel level);
  | 
looking at the code from the bridge

  |    public MetaData getScopeMetaData(ScopeLevel level)
  |    {
  |       if (level == null)
  |          throw new IllegalArgumentException("Null scope level");
  | 
  |       MetaDataRetrieval scopedRetrieval = retrieval.getScopedRetrieval(level);
  |       if (scopedRetrieval != null)
  |          return new MetaDataRetrievalToMetaDataBridge(scopedRetrieval);
  | 
  |       return null;
  |    }
  | 
where in context I have this

  |    public MetaDataRetrieval getScopedRetrieval(ScopeLevel level)
  |    {
  |       List<MetaDataRetrieval> matchingRetrievals = new ArrayList<MetaDataRetrieval>();
  |       List<MetaDataRetrieval> localRetrievals = getLocalRetrievals();
  |       for (MetaDataRetrieval localRetrieval : localRetrievals)
  |       {
  |          ScopeKey scopeKey = localRetrieval.getScope();
  |          if (scopeKey.getScopeLevel(level) != null)
  |             matchingRetrievals.add(localRetrieval);
  |       }
  | 
  |       if (matchingRetrievals.isEmpty() == false)
  |          return new AbstractMetaDataContext(null, matchingRetrievals);
  | 
  |       return null;
  |    }
  | 
and in retrieval

  |    public MetaDataRetrieval getScopedRetrieval(ScopeLevel level)
  |    {
  |       if (getScope().getScopeLevel(level) != null)
  |          return new AbstractMetaDataContext(this);
  | 
  |       return null;
  |    }
  | 

A question here. :-)
Why do I need to wrap retrieval in context in this last code snippet?
OK, I know this was my old code :-), but can't see it now why I wrapped it. 
Perhaps a port of previous code from AOPConstructorJoinpoint?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4105211#4105211

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4105211



More information about the jboss-dev-forums mailing list