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;
}
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;
}
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);
}
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());
}
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);
}
Aggregations