use of org.aspectj.lang.annotation.After in project PhotoNoter by yydcdut.
the class PermissionAspect method afterPermissionRequestBack.
@After("execution(* android.support.v4.app.FragmentActivity.onRequestPermissionsResult(..))")
public void afterPermissionRequestBack(JoinPoint joinPoint) {
YLog.i(TAG, "afterPermissionRequestBack");
Object[] objects = joinPoint.getArgs();
Object object = joinPoint.getTarget();
if (objects.length >= 1 && objects[0] instanceof Integer && object != null && object instanceof IView && ((IView) object).getPresenter() != null) {
int requestCode = (int) objects[0];
invokeMethod(((IView) object).getPresenter(), requestCode);
} else {
YLog.i(TAG, "afterPermissionRequestBack --> bad");
}
}
use of org.aspectj.lang.annotation.After in project trainning by fernandotomasio.
the class IndicacoesLoggerAdvice method logCreateIndicacao.
@After("create()")
public void logCreateIndicacao(JoinPoint joinPoint) {
CursoDAO cursoDAO = factory.getCursoDAO();
IndicacaoDTO indicacao = (IndicacaoDTO) joinPoint.getArgs()[0];
if (indicacao != null) {
try {
LogDTO log = new LogDTO();
log.setDataCriacao(new Date());
log.setUser(getUser());
String texto = "CRIAÇÃO DE INDICAÇÃO " + getDetails(indicacao);
log.setTexto(texto);
logger.create(log);
} catch (DAOException ex) {
Logger.getLogger(IndicacoesLoggerAdvice.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
use of org.aspectj.lang.annotation.After in project ovirt-engine by oVirt.
the class DontPrune method afterCreateLivenessAnalyzer.
/**
* Right after constructing the liveness analyzer, make sure that all types
* matched by the regular expression are marked as if they were referenced
* by the GWT application code.
*/
@After("createLivenessAnalyzer(analyzer, program)")
public void afterCreateLivenessAnalyzer(ControlFlowAnalyzer analyzer, JProgram program) {
// Get the regular expression and warn the user if it's empty:
String dontPruneRe = System.getProperty(GWT_DONTPRUNE);
if (dontPruneRe == null) {
String error = "The system property '" + GWT_DONTPRUNE + "' that specifies the types not to be pruned wasn't set!";
System.err.println(error);
throw new RuntimeException(error);
}
// Compile the regular expression:
Pattern dontPrunePattern = Pattern.compile(dontPruneRe);
// Scan all the types and make sure that the ones matching the given regular
// expression are not pruned:
program.getDeclaredTypes().stream().filter(type -> dontPrunePattern.matcher(type.getName()).matches()).forEach(type -> {
// Note: calling "analyzer.traverseFromInstantiationOf(type)"
// may cause GWT compiler to crash on NPE; don't use that method:
analyzer.traverseFromReferenceTo(type);
// Make sure that all methods of the given type are not pruned:
for (JMethod method : type.getMethods()) {
analyzer.traverseFrom(method);
}
});
}
use of org.aspectj.lang.annotation.After in project apollo by ctripcorp.
the class NamespaceUnlockAspect method requireLockAdvice.
// delete item
@After("@annotation(PreAcquireNamespaceLock) && args(itemId, operator, ..)")
public void requireLockAdvice(long itemId, String operator) {
Item item = itemService.findOne(itemId);
if (item == null) {
throw new BadRequestException("item not exist.");
}
tryUnlock(namespaceService.findOne(item.getNamespaceId()));
}
use of org.aspectj.lang.annotation.After in project PhotoNoter by yydcdut.
the class PermissionAspect method afterPermissionRequestBack4Fragment.
@After("execution(* android.app.Fragment.onRequestPermissionsResult(..))")
public void afterPermissionRequestBack4Fragment(JoinPoint joinPoint) {
Object[] objects = joinPoint.getArgs();
Object object = joinPoint.getTarget();
if (objects.length >= 1 && objects[0] instanceof Integer && object != null && object instanceof IView && ((IView) object).getPresenter() != null) {
int requestCode = (int) objects[0];
invokeMethod(((IView) object).getPresenter(), requestCode);
} else {
YLog.i(TAG, "afterPermissionRequestBack4Fragment --> bad");
}
}
Aggregations