Jonas Bonér bio photo

Jonas Bonér

Specialist at Large.
Entrepreneur.
Hacker.
Public Speaker.
Powder Skier.
Obsessive Learner.
Jazz Addict.
Wannabee Musician.

Twitter LinkedIn Github
After two weeks of Ruthless Refactoring (TM) I can now announce that AspectWerkz version 0.6.3 has been released. I have among other things rewritten the whole definition and weave model implementation to support a much more powerful join point model. The join point model now have the essence of the AspectJ model.
    Here are some of the features/changes:
  • Completely new definition model. Aspects, advices, introductions and pointcuts are now completely orthogonal and the model now has the essence of the AspectJ model. See the documentation for details.
  • Abstract aspects definitions as well as pointcut expressions(e.g.((pc1 OR pc2) AND !pc3) and similar).
  • Multiple weave models.
  • Multiple AspectWerkz system can run in the same JVM concurrently.
  • setField and getField now works for get and set java.util.* collection fields (e.g. add/get/remove/size and so on).
  • Advice and introduction container is now pluggable. I.e. the user can provide its own custom implementation (f.e. to enable persistence).
  • The transparent persistence of advices and introductions have been moved to the sandbox.
  • Many bug fixes.
Here is an example of the new definition:
<aspectwerkz>
    <!-- ============================================= -->
    <!--  Define the advices                           -->
    <!-- ============================================= -->
    <advice-def name="log"
                advice="advices.LoggingAdvice"
                deployment-model="perInstance"/>

    <advice-def name="cache"
                advice="advices.CachingAdvice"
                deployment-model="perClass"/>

    <advice-def name="persistent"
                advice="advices.PersistenceAdvice"
                deployment-model="perJVM"/>

    <advices-def name="log_and_cache">
        <advice-ref name="log"/>
        <advice-ref name="cache"/>
    </advices-def>

    <!-- ============================================= -->
    <!--  Define the introductions                     -->
    <!-- ============================================= -->
    <introduction-def name="serializable"
                      interface="java.io.Serializable"/>

    <introduction-def name="mixin"
                      interface="mixins.Mixin"
                      implementation="mixins.MixinImpl"
                      deployment-model="perInstance"/>

    <!-- ============================================= -->
    <!--  Define the abstract aspects                  -->
    <!-- ============================================= -->
    <abstract-aspect name="MyAbstractAspect">
        <advice pointcut="setters AND !getters">
            <advices-ref name="log_and_cache"/>
        </advice>

        <advice pointcut="persistentFields">
            <advice-ref name="persistent"/>
        </advice>
    </aspect>

    <!-- ============================================= -->
    <!--  Define the aspects                           -->
    <!-- ============================================= -->
    <aspect name="MyAspect" extends="MyAbstractAspect">
        <introduction class="domain.*">
            <introduction-ref name="serializable"/>
            <introduction-ref name="mixin"/>
        </introduction>

        <pointcut-def name="setters" type="method" pattern="String domain.*.set*(..)"/>
        <pointcut-def name="getters" type="method" pattern="String domain.*.get*(..)"/>
        <pointcut-def name="persistentFields" type="setField" pattern="* domain.*.*">
    </aspect>
</aspectwerkz>
You can download the new release from the releases page

Enjoy.