Created
July 27, 2012 11:23
-
-
Save msulima/3187473 to your computer and use it in GitHub Desktop.
FulfilsPredicateAspect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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