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


Java ElementMatcher类代码示例

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


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

示例1: getIncludes

import net.bytebuddy.matcher.ElementMatcher; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public ElementMatcher<MethodDescription> getIncludes() {
    return not(ElementMatchers.<MethodDescription>isPrivate()
            .or(ObjectMethodElementMatchers.INSTANCE)
            .or(named("close"))
            .or(named("getDB"))
            .or(named("getClient"))
            .or(named("connect"))
            .or(named("setDataSource"))
            .or(named("resetState"))
            .or(named("clusterSlots"))
            .or(named("isConnected"))
            .or(named("ping"))
            .or(named("quit"))
            .or(named("checkIsInMultiOrPipeline")));
}
 
开发者ID:YanXs,项目名称:nighthawk,代码行数:18,代码来源:JaRedisMethodInclusion.java

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: getInstanceMethodsInterceptPoints

import net.bytebuddy.matcher.ElementMatcher; //导入依赖的package包/类
@Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
    return new InstanceMethodsInterceptPoint[] {
        new InstanceMethodsInterceptPoint() {
            @Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
                return named(ENHANCE_METHOD);
            }

            @Override public String getMethodsInterceptor() {
                return INTERCEPTOR_CLASS;
            }

            @Override public boolean isOverrideArgs() {
                return false;
            }
        }
    };
}
 
开发者ID:apache,项目名称:incubator-skywalking,代码行数:18,代码来源:ConsumeMessageOrderlyInstrumentation.java

示例7: 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

示例8: getInstanceMethodsInterceptPoints

import net.bytebuddy.matcher.ElementMatcher; //导入依赖的package包/类
/**
 * @return the collection of {@link InstanceMethodsInterceptPoint}, represent the intercepted methods and their
 * interceptors.
 */
@Override
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
    return new InstanceMethodsInterceptPoint[] {
        new InstanceMethodsInterceptPoint() {
            @Override
            public ElementMatcher<MethodDescription> getMethodsMatcher() {
                return named("convert");
            }

            @Override
            public String getMethodsInterceptor() {
                return "PrintTraceIdInterceptor";
            }

            @Override public boolean isOverrideArgs() {
                return false;
            }
        }
    };
}
 
开发者ID:apache,项目名称:incubator-skywalking,代码行数:25,代码来源:TraceIdPatternConverterActivation.java

示例9: getInstanceMethodsInterceptPoints

import net.bytebuddy.matcher.ElementMatcher; //导入依赖的package包/类
@Override
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
    return new InstanceMethodsInterceptPoint[] {
        new InstanceMethodsInterceptPoint() {
            @Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
                return named("activate");
            }

            @Override public String getMethodsInterceptor() {
                return ACTIVATE_METHOD_INTERCEPTOR;
            }

            @Override public boolean isOverrideArgs() {
                return false;
            }
        }
    };
}
 
开发者ID:apache,项目名称:incubator-skywalking,代码行数:19,代码来源:SkywalkingContinuationActivation.java

示例10: getInstanceMethodsInterceptPoints

import net.bytebuddy.matcher.ElementMatcher; //导入依赖的package包/类
/**
 * @return the collection of {@link StaticMethodsInterceptPoint}, represent the intercepted methods and their
 * interceptors.
 */
@Override
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
    return new InstanceMethodsInterceptPoint[] {
        new InstanceMethodsInterceptPoint() {
            @Override
            public ElementMatcher<MethodDescription> getMethodsMatcher() {
                return named("convert");
            }

            @Override
            public String getMethodsInterceptor() {
                return "PrintTraceIdInterceptor";
            }

            @Override public boolean isOverrideArgs() {
                return false;
            }
        }
    };
}
 
开发者ID:apache,项目名称:incubator-skywalking,代码行数:25,代码来源:LogbackPatternConverterActivation.java

示例11: getInstanceMethodsInterceptPoints

import net.bytebuddy.matcher.ElementMatcher; //导入依赖的package包/类
@Override
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
    return new InstanceMethodsInterceptPoint[] {
        new InstanceMethodsInterceptPoint() {
            @Override
            public ElementMatcher<MethodDescription> getMethodsMatcher() {
                return named("convertTID");
            }

            @Override
            public String getMethodsInterceptor() {
                return "PrintMDCTraceIdInterceptor";
            }

            @Override public boolean isOverrideArgs() {
                return false;
            }
        }
    };
}
 
开发者ID:apache,项目名称:incubator-skywalking,代码行数:21,代码来源:MDCConverterActivation.java

示例12: getStaticMethodsInterceptPoints

import net.bytebuddy.matcher.ElementMatcher; //导入依赖的package包/类
/**
 * @return the collection of {@link StaticMethodsInterceptPoint}, represent the intercepted methods and their
 * interceptors.
 */
@Override
protected StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
    return new StaticMethodsInterceptPoint[] {
        new StaticMethodsInterceptPoint() {
            @Override
            public ElementMatcher<MethodDescription> getMethodsMatcher() {
                return named("append");
            }

            @Override
            public String getMethodsInterceptor() {
                return "PrintTraceIdInterceptor";
            }

            @Override public boolean isOverrideArgs() {
                return false;
            }
        }
    };
}
 
开发者ID:apache,项目名称:incubator-skywalking,代码行数:25,代码来源:Log4j2OutputAppenderActivation.java

示例13: getStaticMethodsInterceptPoints

import net.bytebuddy.matcher.ElementMatcher; //导入依赖的package包/类
@Override protected StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
    return new StaticMethodsInterceptPoint[] {
        new StaticMethodsInterceptPoint() {
            @Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
                return named(INTERCEPTOR_METHOD_NAME);
            }

            @Override public String getMethodsInterceptor() {
                return INTERCEPTOR_CLASS;
            }

            @Override public boolean isOverrideArgs() {
                return false;
            }
        }
    };
}
 
开发者ID:apache,项目名称:incubator-skywalking,代码行数:18,代码来源:ActiveSpanTagActivation.java

示例14: getStaticMethodsInterceptPoints

import net.bytebuddy.matcher.ElementMatcher; //导入依赖的package包/类
/**
 * @return the collection of {@link StaticMethodsInterceptPoint}, represent the intercepted methods and their
 * interceptors.
 */
@Override
protected StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
    return new StaticMethodsInterceptPoint[] {
        new StaticMethodsInterceptPoint() {
            @Override
            public ElementMatcher<MethodDescription> getMethodsMatcher() {
                return named("traceId");
            }

            @Override
            public String getMethodsInterceptor() {
                return "TraceContextInterceptor";
            }

            @Override public boolean isOverrideArgs() {
                return false;
            }
        }
    };
}
 
开发者ID:apache,项目名称:incubator-skywalking,代码行数:25,代码来源:TraceContextActivation.java

示例15: getInstanceMethodsInterceptPoints

import net.bytebuddy.matcher.ElementMatcher; //导入依赖的package包/类
@Override
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
    return new InstanceMethodsInterceptPoint[] {
        new InstanceMethodsInterceptPoint() {
            @Override
            public ElementMatcher<MethodDescription> getMethodsMatcher() {
                    return named("get").or(named("set")) .or(named("add")).or(named("replace")).or(named("gets"))
                         .or(named("append")) .or(named("prepend")).or(named("cas")).or(named("delete")).or(named("touch")).
                         or(named("getAndTouch")).or(named("incr")) .or(named("decr"));
            }

            @Override
            public String getMethodsInterceptor() {
                return METHOD_INTERCEPT_CLASS;
            }

            @Override public boolean isOverrideArgs() {
                return false;
            }
        }
    };
}
 
开发者ID:apache,项目名称:incubator-skywalking,代码行数:23,代码来源:XMemcachedInstrumentation.java


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