
Inclusion
A Concern declared via the @Concerns annotation is only a candidate. The decision if it is included in the Invocation Stack for each method is determined by;
import org.qi4j.api.concern.internal.ConcernFor;
/**
* Base class for Concerns.
* <p>It introduces a typed "next" pointer
* that Concerns can use to invoke the next Concern (or mixin) in
* the chain.
* </p>
* <p>
* Generic Concerns should subclass {@link GenericConcern} instead.
* </p>
*/
public abstract class ConcernOf<T>
{
/**
* The "next" pointer. This points to
* the next concern in the chain or the mixin
* to be invoked.
*/
final @ConcernFor protected T next = null;
}
@Concerns( { AuthorizationConcern.class } )
public interface BankAccountEntity extends BankAccount, EntityComposite
{}
import org.qi4j.library.auth.RequiresPermission;
public interface BankAccount
{
@RequiresPermission
Money checkBalance();
@RequiresPermission
void transfer( BankAccount toAccount, Money amount );
}
public class BankAccountMixin
implements BankAccount
{
@This private BankAccountBalance accountBalance;
public Money checkBalance()
{
return accountBalance.amount().get();
}
}
public interface BankAccountBalance
{
Property<Money> amount();
}
The Authorization library contains the building blocks to hook in any authentication and authorization mechanism, but the AuthorizationConcern defined in the EntityComposite above stays the same.