List of usage examples for org.aspectj.lang JoinPoint.StaticPart getSourceLocation
SourceLocation getSourceLocation();
If there is no source location available, returns null.
Returns the SourceLocation of the defining class for default constructors.
getStaticPart().getSourceLocation()
returns the same object.
From source file:org.cooperari.core.CYieldPointImpl.java
License:Apache License
/** * Constructs a yield point from supplied AspectJ join point information * @param jpsp Join point information.// ww w .j a v a2s.c o m */ CYieldPointImpl(JoinPoint.StaticPart jpsp) { this(deriveSignature(jpsp), jpsp.getSourceLocation().getFileName(), jpsp.getSourceLocation().getLine()); }
From source file:org.smallmind.scribe.pen.aop.AutoLogAspect.java
License:Open Source License
@Before(value = "@within(autoLog) && (execution(* * (..)) || initialization(new(..)) || staticinitialization(*)) && !@annotation(AutoLog)", argNames = "staticPart, autoLog") public void beforeClassToBeLogged(JoinPoint.StaticPart staticPart, AutoLog autoLog) { startProbe(autoLog, staticPart.getSourceLocation().getWithinType()); }
From source file:org.smallmind.scribe.pen.aop.AutoLogAspect.java
License:Open Source License
@Before(value = "(execution(@AutoLog * * (..)) || initialization(@AutoLog new(..))) && @annotation(autoLog)", argNames = "staticPart, autoLog") public void beforeMethodToBeLogged(JoinPoint.StaticPart staticPart, AutoLog autoLog) { startProbe(autoLog, staticPart.getSourceLocation().getWithinType()); }
From source file:org.smallmind.scribe.pen.aop.LogContextAspect.java
License:Open Source License
@AfterReturning(value = "execution(@LogContext * * (..)) && @annotation(logContext)", argNames = "staticPart, logContext") public void afterReturnFromLogContextMethod(JoinPoint.StaticPart staticPart, LogContext logContext) { Logger backingLogger;//w w w.j ava 2 s . c o m Discriminator discriminator = null; backingLogger = LoggerManager.getLogger( logContext.name().equals("") ? staticPart.getSourceLocation().getWithinType().getCanonicalName() : logContext.name()); if (!logContext.discriminator().ofClass().equals(Unused.class)) { Method parseMethod; try { parseMethod = logContext.discriminator().ofClass().getMethod("parse", PARSE_SIGNATURE); discriminator = (Discriminator) parseMethod.invoke(null, logContext.discriminator().value()); } catch (Exception exception) { throw new AutoLogRuntimeException(exception); } } for (Class<? extends Context> contextClass : logContext.context()) { Context context; if ((context = ContextFactory.getContext(contextClass)) != null) { backingLogger.log(discriminator, logContext.off() ? Level.OFF : (!logContext.level().equals(Level.OFF)) ? logContext.level() : backingLogger.getLevel(), context); } } }