On 8/20/11 14:47 , Niclas Hedhman wrote:
On Fri, Aug 19, 2011 at 2:20 PM, Rickard Öberg<[email protected]>  wrote:

    @Concerns(CapitalizeConcern.class)
    public static class AnyTransient
        implements TransientComposite

Is the "implements TransientComposite" really needed, or just
something you forgot to remove?

In the spike I did it's needed, but should be fixable. Just need to be able to add that interfaec if the class doesn't implement it.

I assume it is not needed, since you answered Paul that Restlet system
can be enhanced now.

If you subclass and add TransientComposite. Hopefully I can get away from that though.

The next step is probably to allow a typed Concern as well;

  public class CapitalizeConcern extends AnyTransient
  {
        @ConcernFor
        AnyTransient next;

        @Override
        public String hello( String name)
        {
            if ( name != null)
            {
                return next.hello( name.toUpperCase() );
            } else
                return next.invoke( proxy, method, args );
        }
    }
}

Sounds like fairly straight forward as well...

It would be, but the problem here is that you're creating lots of instances of the base class, which is not such a good idea. If you need typed concerns I would suggest going the whole way and use an interface.

IIUIC, Scala traits are subclassed like that, but "next" is done via
"super" which is handled by the compiler to be the next in chain.

No, traits gets converted to static methods with first parameter being the object that is "treated".

/Rickard

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

Reply via email to