Another thing:

If no scope (null) is supplied to the dependency visitor it will visit no 
dependency at all. I thought null here as an
match always case (otherwise you would have asserted not null in the 
constructor?).

         if( scope != null && dependencyModel.matchesScope(scope))
         {
             visitDependency( dependencyModel );
         }

So, perhaps an:

         if( scope == null || dependencyModel.matchesScope(scope))
         {
             visitDependency( dependencyModel );
         }

Would be more appropriate?

Regarding the filtering for scope, perhaps an Specification (Evans, Fowler -> 
discussed on the ddd list) approach would
be even better to have model classes respond to queries for certain 
information/filtering.


Michael, asking


Michael Hunger schrieb:
> Just had a look at the dependency visitor.
> 
> Why do you have to models exposing their internals to the visitor, wouldn't 
> it be better to get a
> Iterable<DependenycModel> dependenciesForScope(Class<? extends Annotation> 
> scope) in the model classes. So the filtering 
> could be internal and the usage would be much cleaner. As well as having the 
> law of demeter and behaviour and attributes 
> together.
> 
> WDYT ?
> 
> Michael
> 
> Rickard Öberg schrieb:
>> Niclas Hedhman wrote:
>>> On Wed, Jun 11, 2008 at 10:23 PM, Rickard Öberg <[EMAIL PROTECTED]> wrote:
>>>
>>>> Alright, the cleanup and shuffle-around is done now. The only remaining
>>>> part which does not compile currently is the RDF-output of the model.
>>> I probably had a hunch, and it was never fully complete.
>>>
>>> So, I can take charge of this and "start over" in a couple of days,
>> Don't worry, I'm rewriting it now using the new ModelVisitor. It's quite 
>> pretty, and not that much work (just started though, so might get 
>> screwed later). Also, I created a DependencyVisitor as a subclass of 
>> ModelVisitor so you can now easily traverse only the dependencies by 
>> using that, like so:
>> ApplicationModel applicationModel = ...;
>> applicationModel.visitModel(new DependencyVisitor(Service.class))
>> {
>>     public void visitDependency(DependencyModel serviceDependency)
>>     {
>>       .. do something with the service dependency ..
>>     }
>> });
>>
>> It seems like creating some specialized visitors can make it a whole lot 
>> easier to work with the model, now that the traversing is in one place 
>> only (the model itself).
>>
>> /Rickard
>>
>>
>> _______________________________________________
>> qi4j-dev mailing list
>> [email protected]
>> http://lists.ops4j.org/mailman/listinfo/qi4j-dev
> 
> 
> _______________________________________________
> qi4j-dev mailing list
> [email protected]
> http://lists.ops4j.org/mailman/listinfo/qi4j-dev


-- 
Michael Hunger
Independent Consultant

Web: http://www.jexp.de
Email: [EMAIL PROTECTED]

Enthusiastic Evangelist for Better Software Development

Don't stop where you are: http://creating.passionate-developers.org
We support Software Engineering Radio (www.se-radio.net)


_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to