Class AgentElementMatchers


  • public class AgentElementMatchers
    extends Object
    This class provides some custom ByteBuddy element matchers to use when applying instrumentation.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T extends net.bytebuddy.description.type.TypeDescription>
      net.bytebuddy.matcher.ElementMatcher.Junction<T>
      extendsClass​(net.bytebuddy.matcher.ElementMatcher<? super net.bytebuddy.description.type.TypeDescription> matcher)  
      static <T> net.bytebuddy.matcher.ElementMatcher.Junction<T> failSafe​(net.bytebuddy.matcher.ElementMatcher<? super T> matcher, String description)
      Wraps another matcher to assure that an element is not matched in case that the matching causes an Exception.
      static <T extends net.bytebuddy.description.type.TypeDescription>
      net.bytebuddy.matcher.ElementMatcher.Junction<T>
      hasInterface​(net.bytebuddy.matcher.ElementMatcher<? super net.bytebuddy.description.type.TypeDescription> matcher)  
      static <T extends net.bytebuddy.description.method.MethodDescription>
      net.bytebuddy.matcher.ElementMatcher.Junction<T>
      hasSuperMethod​(net.bytebuddy.matcher.ElementMatcher<? super net.bytebuddy.description.method.MethodDescription> matcher)  
      static <T extends net.bytebuddy.description.type.TypeDescription>
      net.bytebuddy.matcher.ElementMatcher.Junction<T>
      implementsInterface​(net.bytebuddy.matcher.ElementMatcher<? super net.bytebuddy.description.type.TypeDescription> matcher)  
      static <T extends net.bytebuddy.description.type.TypeDescription>
      net.bytebuddy.matcher.ElementMatcher.Junction<T>
      safeHasSuperType​(net.bytebuddy.matcher.ElementMatcher<? super net.bytebuddy.description.type.TypeDescription> matcher)  
    • Constructor Detail

      • AgentElementMatchers

        public AgentElementMatchers()
    • Method Detail

      • extendsClass

        public static <T extends net.bytebuddy.description.type.TypeDescription> net.bytebuddy.matcher.ElementMatcher.Junction<T> extendsClass​(net.bytebuddy.matcher.ElementMatcher<? super net.bytebuddy.description.type.TypeDescription> matcher)
      • implementsInterface

        public static <T extends net.bytebuddy.description.type.TypeDescription> net.bytebuddy.matcher.ElementMatcher.Junction<T> implementsInterface​(net.bytebuddy.matcher.ElementMatcher<? super net.bytebuddy.description.type.TypeDescription> matcher)
      • hasInterface

        public static <T extends net.bytebuddy.description.type.TypeDescription> net.bytebuddy.matcher.ElementMatcher.Junction<T> hasInterface​(net.bytebuddy.matcher.ElementMatcher<? super net.bytebuddy.description.type.TypeDescription> matcher)
      • safeHasSuperType

        public static <T extends net.bytebuddy.description.type.TypeDescription> net.bytebuddy.matcher.ElementMatcher.Junction<T> safeHasSuperType​(net.bytebuddy.matcher.ElementMatcher<? super net.bytebuddy.description.type.TypeDescription> matcher)
      • hasSuperMethod

        public static <T extends net.bytebuddy.description.method.MethodDescription> net.bytebuddy.matcher.ElementMatcher.Junction<T> hasSuperMethod​(net.bytebuddy.matcher.ElementMatcher<? super net.bytebuddy.description.method.MethodDescription> matcher)
      • failSafe

        public static <T> net.bytebuddy.matcher.ElementMatcher.Junction<T> failSafe​(net.bytebuddy.matcher.ElementMatcher<? super T> matcher,
                                                                                    String description)
        Wraps another matcher to assure that an element is not matched in case that the matching causes an Exception. Logs exception if it happens.
        Type Parameters:
        T - The type of the matched object.
        Parameters:
        matcher - The element matcher that potentially throws an exception.
        Returns:
        A matcher that returns false in case that the given matcher throws an exception.