Skip to content

Instantly share code, notes, and snippets.

@msulima
Created July 27, 2012 11:23
Show Gist options
  • Save msulima/3187473 to your computer and use it in GitHub Desktop.
Save msulima/3187473 to your computer and use it in GitHub Desktop.
FulfilsPredicateAspect
package com.futureprocessing.fpcommunity.core.validation.groups;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Component;
public aspect FulfilsPredicateAspect {
pointcut hasFulfisPredicateArguments() : execution(* *(.., @com.futureprocessing.fpcommunity.core.validation.groups.FulfilsPredicate (*) ,..));
pointcut isSpringComponent() : (@within(Service) || @within(Component)) && within(com.futureprocessing.fpcommunity..*);
before() : hasFulfisPredicateArguments() && isSpringComponent() {
// znalezienie wszystkich argumentów z adnotacją @FulfilsPredicate
// zaaplikowanie na każdym z tych argumentów predykatów
// w przypadku niespełnienia któregoś:
throw new IllegalArgumentException();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment