/** * Instantiates a new simple profile monitor. * * @param label * the label * @param parent * the parent */ public SimpleProfileMonitor(final Signature label, final SimpleProfileMonitor parent) { this(SignatureHelper.getAsString(label), parent); }
/** * @see patterntesting.runtime.monitor.ProfileMonitor#getLabel() */ public String getLabel() { if (this.label == null) { return "root"; } else { return SignatureHelper.getAsString(label); } }
/** * We use now the signature without the return value. That's enough. * * @param sig the sig * * @return the monitor for sig */ public SimpleProfileMonitor getMonitor(Signature sig) { String label = SignatureHelper.getAsString(sig); for (SimpleProfileMonitor mon : childs) { String monLabel = SignatureHelper.getAsString(mon.label); if (label.equals(monLabel)) { return mon; } } return null; }
/** * The difference to Signature.toString() is that in case of a methode * or constructor the return type is not part of result. * * @param sig the sig * * @return signature as string * * @deprecated Use {@link SignatureHelper#getAsString(Signature)} instead */ @Deprecated public static String getAsString(Signature sig) { return SignatureHelper.getAsString(sig); }
/** * We use now the signature without the return value. That's enough. * * @param sig * the sig * * @return the monitor for sig */ public SimpleProfileMonitor getMonitor(final Signature sig) { String lbl = SignatureHelper.getAsString(sig); return getMonitor(lbl); }
/** * Gets the monitor. * * @param sig the signature * * @return the monitor */ public static ProfileMonitor getMonitor(Signature sig) { String label = SignatureHelper.getAsString(sig); ProfileMonitor mon = JamonMonitorFactory.start(label); return mon; }
/** * Start profile monitor for the given signature. * * @param sig * the signature * @return the profile monitor */ public ProfileMonitor startProfileMonitorFor(final Signature sig) { return this.startProfileMonitorFor(SignatureHelper.getAsString(sig)); }
/** * Gets the monitor. * * @param sig * the sig * @param root * the root * @return the monitor * @since 1.4.2 */ public static ProfileMonitor getMonitor(final Signature sig, final ProfileMonitor root) { String label = SignatureHelper.getAsString(sig); return getMonitor(label, root); }
private synchronized ProfileMonitor getMonitor(final Signature sig) { return factory.getMonitor(SignatureHelper.getAsString(sig)); }
/** * Do you want to look for the monitor of a given method? Use this method * here. * * @param signature * e.g. "hello.World(String[])" * * @return monitor for the given signature or null * @since 1.4.2 */ @MayReturnNull public ProfileMonitor getProfileMonitor(final Signature signature) { return this.getProfileMonitor(SignatureHelper.getAsString(signature)); }
/** * Gets the as short string. * * @param joinpoint * the joinpoint * * @return the as short string */ public static String getAsShortString(final JoinPoint joinpoint) { Signature sig = joinpoint.getSignature(); if (sig instanceof FieldSignature) { return getAsString(joinpoint); } Object[] args = joinpoint.getArgs(); if (sig instanceof CatchClauseSignature) { return SignatureHelper.getAsString(sig.getDeclaringType().getSimpleName(), sig) + "(" + args[0].getClass().getName() + ")"; } return SignatureHelper.getAsString(sig.getDeclaringType().getSimpleName(), sig) + getArgsAsShortString(args); }
/** * The difference to Signature.toString() is that in case of a methode * or constructor the return type is not part of result. * * @param sig the sig * * @return the given signature as string */ public static String getAsString(Signature sig) { try { CodeSignature codeSig = (CodeSignature) sig; String name = getAsString(sig.getDeclaringTypeName(), sig); Class<?>[] params = codeSig.getParameterTypes(); return name + "(" + Converter.toShortString(params) + ")"; } catch (Exception e) { log.debug("can't get '" + sig + "' as String", e); return sig.toString(); } }
/** * The difference to Signature.toString() is that in case of a methode or * constructor the return type is not part of result. * * @param sig * the sig * * @return the given signature as string */ public static String getAsString(final Signature sig) { if (sig instanceof CodeSignature) { try { CodeSignature codeSig = (CodeSignature) sig; String name = getAsString(sig.getDeclaringTypeName(), sig); Class<?>[] params = codeSig.getParameterTypes(); return name + "(" + Converter.toShortString(params) + ")"; } catch (RuntimeException e) { LOG.debug("Cannot get '" + sig + "' as short string:", e); } } return sig.toString(); }
/** * Gets the as long string. * * @param joinpoint * the joinpoint * * @return the as short string */ public static String getAsLongString(final JoinPoint joinpoint) { Signature sig = joinpoint.getSignature(); if (sig instanceof FieldSignature) { return getAsString(joinpoint); } Object[] args = joinpoint.getArgs(); return SignatureHelper.getAsString(sig.getDeclaringType().getName(), sig) + getArgsAsString(args); }
/** * Gets the as short string. * * @param joinpoint the joinpoint * * @return the as short string */ public static String getAsShortString(JoinPoint joinpoint) { Signature sig = joinpoint.getSignature(); if (sig instanceof FieldSignature) { return getAsString(joinpoint); } Object[] args = joinpoint.getArgs(); return SignatureHelper.getAsString(sig.getDeclaringType() .getSimpleName(), sig) + getArgsAsString(args); }
/** * Gets the given joinpoint as string. * * @param joinpoint * the joinpoint * * @return the as string */ public static String getAsString(final JoinPoint joinpoint) { Signature sig = joinpoint.getSignature(); Object[] args = joinpoint.getArgs(); if (sig instanceof FieldSignature) { if (args.length == 0) { return "get " + sig.toShortString(); } else { return "set " + sig.toShortString() + " = " + getArgAsString(args[0]); } } else if (sig instanceof CodeSignature) { Annotation[][] paramAnnotations = getParameterAnnotations(joinpoint); return SignatureHelper.getAsString(sig.getDeclaringTypeName(), sig) + getArgsAsString(args, paramAnnotations); } else { return SignatureHelper.getAsString(sig.getDeclaringTypeName(), sig) + getArgsAsString(args); } }
/** * Gets the as string. * * @param joinpoint the joinpoint * * @return the as string */ public static String getAsString(JoinPoint joinpoint) { Signature sig = joinpoint.getSignature(); Object[] args = joinpoint.getArgs(); if (sig instanceof FieldSignature) { if (args.length == 0) { return "get " + sig.toShortString(); } else { return "set " + sig.toShortString() + " = " + getArgAsString(args[0]); } } else if (sig instanceof CodeSignature) { Annotation[][] paramAnnotations = getParameterAnnotations(joinpoint); return SignatureHelper.getAsString(sig.getDeclaringTypeName(), sig) + getArgsAsString(args, paramAnnotations); } else { return SignatureHelper.getAsString(sig.getDeclaringTypeName(), sig) + getArgsAsString(args); } }