Hi,
If you have two interceptors A and B that go into the same phase and
additionally you want to make sure A must precede B, you can either
write
addBefore(B) in A's constructor
or
addAfter(A) in B's constructor.

But is there a good rule for deciding which one to choose?

The concrete case that I have is for LoggingOutInterceptor and
TransformOutInterceptor.
They both go into PRE_STREAM..

LoggingOI should wrap the output stream before anyone start using it,
so it must precede any Stax based interceptors. That means we have the
order:
LoggingOI < TransformOI < StaxOI

Initially, I added this constraint in the constructor of TransformOI
as I was fixing another issue of this class.
addBefore(StaxOI)
addAfter(LoggingOI).

But later I thought, it might have been more readable to put this
constraint in the LoggingOI as
addBefore(StaxOI)
addBefore(TransformOI).
to indicate LoggingOI must precede any known Stax based interceptors.

Maybe, this is a stupid question. But if someone has a strong opinion
in one way or the other. I am interested in hearing it.

Thanks.

regards, aki

Reply via email to