当前位置: 首页>>代码示例>>Java>>正文


Java ElementMatcher.Junction方法代码示例

本文整理汇总了Java中net.bytebuddy.matcher.ElementMatcher.Junction方法的典型用法代码示例。如果您正苦于以下问题:Java ElementMatcher.Junction方法的具体用法?Java ElementMatcher.Junction怎么用?Java ElementMatcher.Junction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.bytebuddy.matcher.ElementMatcher的用法示例。


在下文中一共展示了ElementMatcher.Junction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: matchAnyMethodIn

import net.bytebuddy.matcher.ElementMatcher; //导入方法依赖的package包/类
/**
 * Returns a byte buddy matcher matching any method contained in methodSignatures.
 */
public static ElementMatcher<MethodDescription> matchAnyMethodIn(Set<MethodSignature> methodSignatures) {
    ElementMatcher.Junction<MethodDescription> methodMatcher = ElementMatchers.none();
    for (MethodSignature methodSignature : methodSignatures) {
        ElementMatcher.Junction<MethodDescription> junction = ElementMatchers
                .named(methodSignature.getMethodName())
                .and(not(isAbstract()))
                .and(isPublic())
                .and(takesArguments(methodSignature.getParameterTypes().size()));
        for (int i = 0; i < methodSignature.getParameterTypes().size(); i++) {
            junction = junction.and(takesArgument(i, named(methodSignature.getParameterTypes().get(i))));
        }
        methodMatcher = methodMatcher.or(junction);
    }
    return methodMatcher;
}
 
开发者ID:fstab,项目名称:promagent,代码行数:19,代码来源:Promagent.java

示例2: createAgentBuilder

import net.bytebuddy.matcher.ElementMatcher; //导入方法依赖的package包/类
/**
 * Creates the AgentBuilder that will redefine the System class.
 * @param inst instrumentation instance.
 * @return an agent builder.
 */
private static AgentBuilder createAgentBuilder(Instrumentation inst) {

    // Find me a class called "java.lang.System"
    final ElementMatcher.Junction<NamedElement> systemType = ElementMatchers.named("java.lang.System");

    // And then find a method called setSecurityManager and tell MySystemInterceptor to
    // intercept it (the method binding is smart enough to take it from there)
    final AgentBuilder.Transformer transformer =
            (b, typeDescription) -> b.method(ElementMatchers.named("setSecurityManager"))
                    .intercept(MethodDelegation.to(MySystemInterceptor.class));

    // Disable a bunch of stuff and turn on redefine as the only option
    final ByteBuddy byteBuddy = new ByteBuddy().with(Implementation.Context.Disabled.Factory.INSTANCE);
    final AgentBuilder agentBuilder = new AgentBuilder.Default()
            .withByteBuddy(byteBuddy)
            .withInitializationStrategy(AgentBuilder.InitializationStrategy.NoOp.INSTANCE)
            .withRedefinitionStrategy(AgentBuilder.RedefinitionStrategy.REDEFINITION)
            .withTypeStrategy(AgentBuilder.TypeStrategy.Default.REDEFINE)
            .type(systemType)
            .transform(transformer);

    return agentBuilder;
}
 
开发者ID:wsargent,项目名称:securityfixer,代码行数:29,代码来源:SecurityFixerAgent.java

示例3: createMatcher

import net.bytebuddy.matcher.ElementMatcher; //导入方法依赖的package包/类
private static ElementMatcher.Junction<TypeDescription> createMatcher() {
  // This matcher matches implementations of Executor, but excludes CurrentContextExecutor and
  // FixedContextExecutor from io.grpc.Context, which already propagate the context.
  // TODO(stschmidt): As the executor implementation itself (e.g. ThreadPoolExecutor) is
  // instrumented by the agent for automatic context propagation, CurrentContextExecutor could be
  // turned into a no-op to avoid another unneeded context propagation. Likewise, when using
  // FixedContextExecutor, the automatic context propagation added by the agent is unneeded.
  return isSubTypeOf(Executor.class)
      .and(not(isAbstract()))
      .and(
          not(
              nameStartsWith("io.grpc.Context$")
                  .and(
                      nameEndsWith("CurrentContextExecutor")
                          .or(nameEndsWith("FixedContextExecutor")))));
}
 
开发者ID:census-instrumentation,项目名称:opencensus-java,代码行数:17,代码来源:ExecutorInstrumentation.java

示例4: elementMatcher

import net.bytebuddy.matcher.ElementMatcher; //导入方法依赖的package包/类
private ElementMatcher.Junction<MethodDescription> elementMatcher() {
    switch (this) {
        case Private: {
            return isPrivate();
        }
        case Default: {
            return isPackagePrivate();
        }
        case Public: {
            return isPublic();
        }
        case Protected: {
            return isProtected();
        }
        default:
            return isPublic();
    }
}
 
开发者ID:O2O-Market,项目名称:Market-monitor,代码行数:19,代码来源:MethodMatcher.java

示例5: buildMatch

import net.bytebuddy.matcher.ElementMatcher; //导入方法依赖的package包/类
public ElementMatcher<? super TypeDescription> buildMatch() {
    ElementMatcher.Junction judge = new AbstractJunction<NamedElement>() {
        @Override
        public boolean matches(NamedElement target) {
            return nameMatchDefine.containsKey(target.getActualName());
        }
    };
    judge = judge.and(not(isInterface()));
    for (AbstractClassEnhancePluginDefine define : signatureMatchDefine) {
        ClassMatch match = define.enhanceClass();
        if (match instanceof IndirectMatch) {
            judge = judge.or(((IndirectMatch)match).buildJunction());
        }
    }
    return new ProtectiveShieldMatcher(judge);
}
 
开发者ID:apache,项目名称:incubator-skywalking,代码行数:17,代码来源:PluginFinder.java

示例6: excludeObjectDefaultMethod

import net.bytebuddy.matcher.ElementMatcher; //导入方法依赖的package包/类
protected ElementMatcher.Junction<MethodDescription> excludeObjectDefaultMethod() {
    ElementMatcher.Junction<MethodDescription> exclusiveMatcher = null;
    for (MethodMatcher methodMatcher : EXCLUSIVE_DEFAULT_METHOD_NAME) {
        if (exclusiveMatcher == null) {
            exclusiveMatcher = methodMatcher.buildMatcher();
            continue;
        }

        exclusiveMatcher = exclusiveMatcher.or(methodMatcher.buildMatcher());

    }
    return not(exclusiveMatcher);
}
 
开发者ID:O2O-Market,项目名称:Market-monitor,代码行数:14,代码来源:ExclusiveObjectDefaultMethodsMatcher.java

示例7: match

import net.bytebuddy.matcher.ElementMatcher; //导入方法依赖的package包/类
@Override
public ElementMatcher.Junction<MethodDescription> match() {
    ElementMatcher.Junction<MethodDescription> result = null;

    for (MethodMatcher matcher : matchers) {
        if (result == null) {
            result = matcher.buildMatcher();
            continue;
        }

        result = result.or(matcher.buildMatcher());
    }

    return not(result);
}
 
开发者ID:O2O-Market,项目名称:Market-monitor,代码行数:16,代码来源:MethodsExclusiveMatcher.java

示例8: mergeArgumentsIfNecessary

import net.bytebuddy.matcher.ElementMatcher; //导入方法依赖的package包/类
protected ElementMatcher.Junction<MethodDescription> mergeArgumentsIfNecessary(ElementMatcher.Junction<MethodDescription> matcher) {
    if (argTypeArray != null) {
        matcher = matcher.and(takesArguments(argTypeArray));
    }

    if (argNum > -1) {
        matcher = matcher.and(takesArguments(argNum));
    }

    if (modifier != null) {
        matcher = matcher.and(modifier.elementMatcher());
    }

    return matcher;
}
 
开发者ID:O2O-Market,项目名称:Market-monitor,代码行数:16,代码来源:MethodMatcher.java

示例9: buildJunction

import net.bytebuddy.matcher.ElementMatcher; //导入方法依赖的package包/类
@Override
public ElementMatcher.Junction buildJunction() {
    ElementMatcher.Junction junction = null;
    for (String annotation : annotations) {
        if (junction == null) {
            junction = buildEachAnnotation(annotation);
        } else {
            junction = junction.and(buildEachAnnotation(annotation));
        }
    }
    junction = declaresMethod(junction).and(not(isInterface()));
    return junction;
}
 
开发者ID:apache,项目名称:incubator-skywalking,代码行数:14,代码来源:MethodAnnotationMatch.java

示例10: buildJunction

import net.bytebuddy.matcher.ElementMatcher; //导入方法依赖的package包/类
@Override
public ElementMatcher.Junction buildJunction() {
    ElementMatcher.Junction junction = null;
    for (String name : matchClassNames) {
        if (junction == null) {
            junction = named(name);
        } else {
            junction = junction.or(named(name));
        }
    }
    return junction;
}
 
开发者ID:apache,项目名称:incubator-skywalking,代码行数:13,代码来源:MultiClassNameMatch.java

示例11: buildJunction

import net.bytebuddy.matcher.ElementMatcher; //导入方法依赖的package包/类
@Override
public ElementMatcher.Junction buildJunction() {
    ElementMatcher.Junction junction = null;
    for (String superTypeName : parentTypes) {
        if (junction == null) {
            junction = buildSuperClassMatcher(superTypeName);
        } else {
            junction = junction.and(buildSuperClassMatcher(superTypeName));
        }
    }
    junction = junction.and(not(isInterface()));
    return junction;
}
 
开发者ID:apache,项目名称:incubator-skywalking,代码行数:14,代码来源:HierarchyMatch.java

示例12: buildJunction

import net.bytebuddy.matcher.ElementMatcher; //导入方法依赖的package包/类
@Override
public ElementMatcher.Junction buildJunction() {
    ElementMatcher.Junction junction = null;
    for (String annotation : annotations) {
        if (junction == null) {
            junction = buildEachAnnotation(annotation);
        } else {
            junction = junction.and(buildEachAnnotation(annotation));
        }
    }
    junction = junction.and(not(isInterface()));
    return junction;
}
 
开发者ID:apache,项目名称:incubator-skywalking,代码行数:14,代码来源:ClassAnnotationMatch.java

示例13: inPlugins

import net.bytebuddy.matcher.ElementMatcher; //导入方法依赖的package包/类
public <T extends NamedElement> ElementMatcher.Junction<T> inPlugins() {
    return new NameMatcher(new PluginMathers(pluginManager));
}
 
开发者ID:superbiger,项目名称:sbiger-apm,代码行数:4,代码来源:AgentBoot.java

示例14: buildMatcher

import net.bytebuddy.matcher.ElementMatcher; //导入方法依赖的package包/类
@Override
public ElementMatcher.Junction<MethodDescription> buildMatcher() {
    return this.match().and(excludeObjectDefaultMethod());
}
 
开发者ID:O2O-Market,项目名称:Market-monitor,代码行数:5,代码来源:ExclusiveObjectDefaultMethodsMatcher.java

示例15: buildMatcher

import net.bytebuddy.matcher.ElementMatcher; //导入方法依赖的package包/类
@Override
public ElementMatcher.Junction<MethodDescription> buildMatcher() {
    ElementMatcher.Junction<MethodDescription> matcher = nameMatches(getMethodMatchDescribe());
    return mergeArgumentsIfNecessary(matcher);
}
 
开发者ID:O2O-Market,项目名称:Market-monitor,代码行数:6,代码来源:MethodRegexMatcher.java


注:本文中的net.bytebuddy.matcher.ElementMatcher.Junction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。