Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Is it on the cards for PCDs to be defined in terms of annotations?

Been following the discussion on external definition of PCDs with interest.
I'd like to ask the reciprocal question:

Suppose we have a POJO model over which we want to apply some aspects (eg
persistence, security, visualization).  I don't want to use naming
conventions to identify the features to be persisted, visualized etc., and I
don't want to have the "binding" of the aspects to the model externalized;
rather I'd like to annotate the model directly using JSR 175 annotations:

So, for example, I might have:

@Persistent
public class CustomerPojo {

  @Visualize
  private String firstName;

  @Visualize
  private String lastName;

  @Transactional
  public void setLastName(final String lastName) {
    this.lastName = lastName;
  }

  // and so on...
}

We then would want a pointcut defined in terms of these annotations.  I
guess it would be something like:

public aspect PersistenceAspect {

  public pointcut persistentClasses(): within(@Persistent);  // or something
like
  // and so on...

}

public aspect VisualizeAspect {

  public pointcut visualizedFeatures(): get(@Visualize);     // you get the
idea
  // and so on...

}

As a relative newbie to AspectJ, I was wondering if this has been discussed
and is it in the plans?  Hopefully "yes" to both.

Cheers
Dan




Back to the top