@Retention(value=RUNTIME) @Target(value={TYPE,METHOD}) @Documented public @interface AppliesTo
@AppliesTo can specify one of;
Example with annotation:
@AppliesTo( Sessional.class ) // Tells Zest to apply this concern on methods with @Sessional annotation
public class SessionConcern extends GenericConcern
{
public Object invoke( Object proxy, Method method, Object[] args )
throws Throwable
{
... do session stuff ...
}
}
@Retention( RetentionPolicy.RUNTIME )
@Target( ElementType.METHOD )
@Documented
@Inherited
public @interface Sessional
{
}
public class MyMixin
implements My
{
@Sessional
public void doSomethingSessional()
{
// ... do your logic wrapped in a session
}
public void doSomethingWithoutSession()
{
// ... do stuff that are not wrapped in session.
}
}
public interface My
{
void doSomethingSessional();
void doSomethingWithoutSession();
}
@Concerns( SessionConcern.class )
@Mixins( MyMixin.class )
public interface MyComposite extends My, TransientComposite
{}
The doSomethingWithoutSession method do not have the @Sessional annotation, therefore the SessionConcern will not be placed into the call sequence of these methods, and vice-versa. The @Sessional annotation can be placed either on the interface method or the implementation method, depending on whether it is a contract or implementation detail.
public abstract Class<?>[] value