Search in sources :

Example 6 with MatcherOperand

use of com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.MatcherOperand in project pinpoint by naver.

the class DefaultMultiClassBasedMatcher method getMatcherOperand.

private MatcherOperand getMatcherOperand(List<String> baseClassNames, MatcherOperand additional) {
    MatcherOperand operand = joinOr(baseClassNames);
    if (operand == null) {
        throw new IllegalStateException("operand is null");
    }
    if (additional == null) {
        return operand;
    }
    // (class OR ...) AND additional
    operand = operand.and(additional);
    return operand;
}
Also used : MatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.MatcherOperand) ClassInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.ClassInternalNameMatcherOperand)

Example 7 with MatcherOperand

use of com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.MatcherOperand in project pinpoint by naver.

the class DefaultMultiClassBasedMatcher method joinOr.

private MatcherOperand joinOr(List<String> baseClassNames) {
    MatcherOperand operand = null;
    for (String baseClassName : baseClassNames) {
        if (operand == null) {
            operand = new ClassInternalNameMatcherOperand(baseClassName);
        } else {
            // class OR ...
            final MatcherOperand classMatcherOperand = new ClassInternalNameMatcherOperand(baseClassName);
            operand = operand.or(classMatcherOperand);
        }
    }
    return operand;
}
Also used : MatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.MatcherOperand) ClassInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.ClassInternalNameMatcherOperand) ClassInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.ClassInternalNameMatcherOperand)

Example 8 with MatcherOperand

use of com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.MatcherOperand in project pinpoint by naver.

the class MatchableTransformerRegistry method addTransformer.

private void addTransformer(final Matcher matcher, final ClassFileTransformer transformer) {
    if (!MatcherType.isBasedMatcher(matcher)) {
        throw new IllegalArgumentException("unsupported baseMatcher");
    }
    // class or package based.
    MatcherOperand matcherOperand = ((BasedMatcher) matcher).getMatcherOperand();
    addIndex(matcherOperand, transformer);
}
Also used : ClassInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.ClassInternalNameMatcherOperand) MatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.MatcherOperand) PackageInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.PackageInternalNameMatcherOperand) BasedMatcher(com.navercorp.pinpoint.bootstrap.instrument.matcher.BasedMatcher)

Example 9 with MatcherOperand

use of com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.MatcherOperand in project pinpoint by naver.

the class DefaultClassBasedMatcherTest method getMatcherOperandWithClassName.

@Test
public void getMatcherOperandWithClassName() {
    DefaultClassBasedMatcher matcher = new DefaultClassBasedMatcher("java.lang.String");
    assertEquals("java.lang.String", matcher.getBaseClassName());
    MatcherOperand operand = matcher.getMatcherOperand();
    assertTrue(operand instanceof ClassInternalNameMatcherOperand);
    ClassInternalNameMatcherOperand classInternalNameMatcherOperand = (ClassInternalNameMatcherOperand) operand;
    assertEquals("java/lang/String", classInternalNameMatcherOperand.getClassInternalName());
}
Also used : MatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.MatcherOperand) ClassInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.ClassInternalNameMatcherOperand) InterfaceInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.InterfaceInternalNameMatcherOperand) ClassInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.ClassInternalNameMatcherOperand) Test(org.junit.Test)

Example 10 with MatcherOperand

use of com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.MatcherOperand in project pinpoint by naver.

the class DefaultClassBasedMatcherTest method getMatcherOperandWithClassNameAndAdditional.

@Test
public void getMatcherOperandWithClassNameAndAdditional() {
    InterfaceInternalNameMatcherOperand additional = new InterfaceInternalNameMatcherOperand("java/lang/Runnable", false);
    DefaultClassBasedMatcher matcher = new DefaultClassBasedMatcher("java.lang.String", additional);
    assertEquals("java.lang.String", matcher.getBaseClassName());
    MatcherOperand operand = matcher.getMatcherOperand();
    assertTrue(operand instanceof AndMatcherOperator);
    AndMatcherOperator operator = (AndMatcherOperator) operand;
    assertTrue(operator.getLeftOperand() instanceof ClassInternalNameMatcherOperand);
    assertTrue(operator.getRightOperand() instanceof InterfaceInternalNameMatcherOperand);
}
Also used : InterfaceInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.InterfaceInternalNameMatcherOperand) MatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.MatcherOperand) ClassInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.ClassInternalNameMatcherOperand) InterfaceInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.InterfaceInternalNameMatcherOperand) AndMatcherOperator(com.navercorp.pinpoint.bootstrap.instrument.matcher.operator.AndMatcherOperator) ClassInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.ClassInternalNameMatcherOperand) Test(org.junit.Test)

Aggregations

MatcherOperand (com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.MatcherOperand)17 ClassInternalNameMatcherOperand (com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.ClassInternalNameMatcherOperand)11 InterfaceInternalNameMatcherOperand (com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.InterfaceInternalNameMatcherOperand)10 PackageInternalNameMatcherOperand (com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.PackageInternalNameMatcherOperand)10 Test (org.junit.Test)10 AndMatcherOperator (com.navercorp.pinpoint.bootstrap.instrument.matcher.operator.AndMatcherOperator)5 OrMatcherOperator (com.navercorp.pinpoint.bootstrap.instrument.matcher.operator.OrMatcherOperator)5 AnnotationInternalNameMatcherOperand (com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.AnnotationInternalNameMatcherOperand)3 SuperClassInternalNameMatcherOperand (com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.SuperClassInternalNameMatcherOperand)3 MatcherOperator (com.navercorp.pinpoint.bootstrap.instrument.matcher.operator.MatcherOperator)2 NotMatcherOperator (com.navercorp.pinpoint.bootstrap.instrument.matcher.operator.NotMatcherOperator)2 BasedMatcher (com.navercorp.pinpoint.bootstrap.instrument.matcher.BasedMatcher)1 InternalClassMetadata (com.navercorp.pinpoint.profiler.instrument.classreading.InternalClassMetadata)1 DefaultInstrumentMatcherCacheConfig (com.navercorp.pinpoint.profiler.instrument.config.DefaultInstrumentMatcherCacheConfig)1 InstrumentMatcherCacheConfig (com.navercorp.pinpoint.profiler.instrument.config.InstrumentMatcherCacheConfig)1 InputStream (java.io.InputStream)1