Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Visibility of inter-type members with @DeclareMixin and @DeclareParents

Greetings,

In "traditional" AspectJ syntax, to make a field private relative to the aspect (so that only code within the aspect can refer to it), it sufficed to declare an inter-type field as private.

With @DeclareMixin/@DeclareParents I use an interface with a setter and a getter to emulate an inter-type field. How do I make this “emulated field” private?

Using the private keyword in the factory method (for @DeclareMixin) / field (for @DeclareParents)?
That is:
    @DeclareMixin("ClassName")
    private static IFood create FoodImplementation() {
        return new FoodImpl();
    }

and
    @DeclareParents(value="ClassName",defaultImpl=FoodImpl.class)
    private IFood food;


Thanks. Also, in the above examples, the visibility will be private, even if the interface/implementation class is public, right?

Back to the top