Class CustomElementMatchers


  • public class CustomElementMatchers
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static net.bytebuddy.matcher.ElementMatcher.Junction<net.bytebuddy.description.annotation.AnnotationSource> annotationMatches​(java.lang.String annotationWildcard)  
      static net.bytebuddy.matcher.ElementMatcher.Junction<net.bytebuddy.description.NamedElement> anyMatch​(java.util.List<WildcardMatcher> matchers)  
      static net.bytebuddy.matcher.ElementMatcher.Junction<java.lang.ClassLoader> classLoaderCanLoadClass​(java.lang.String className)
      Matches only class loaders which can load a certain class.
      static net.bytebuddy.matcher.ElementMatcher.Junction<java.security.ProtectionDomain> implementationVersionGte​(java.lang.String version)  
      static net.bytebuddy.matcher.ElementMatcher.Junction<java.security.ProtectionDomain> implementationVersionLte​(java.lang.String version)
      A matcher that checks whether the implementation version read from the MANIFEST.MF related for a given ProtectionDomain is lower than or equals to the limit version.
      static net.bytebuddy.matcher.ElementMatcher.Junction<net.bytebuddy.description.NamedElement> isInAnyPackage​(java.util.Collection<java.lang.String> includedPackages, net.bytebuddy.matcher.ElementMatcher.Junction<net.bytebuddy.description.NamedElement> defaultIfEmpty)  
      static <T extends net.bytebuddy.description.NamedElement>
      net.bytebuddy.matcher.ElementMatcher.Junction<T>
      isProxy()  
      static net.bytebuddy.matcher.ElementMatcher.Junction<net.bytebuddy.description.NamedElement> matches​(WildcardMatcher matcher)  
      static MethodHierarchyMatcher overridesOrImplementsMethodThat​(net.bytebuddy.matcher.ElementMatcher<? super net.bytebuddy.description.method.MethodDescription> methodElementMatcher)
      Matches overridden methods of a super class or implemented methods of an interface.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CustomElementMatchers

        public CustomElementMatchers()
    • Method Detail

      • isInAnyPackage

        public static net.bytebuddy.matcher.ElementMatcher.Junction<net.bytebuddy.description.NamedElement> isInAnyPackage​(java.util.Collection<java.lang.String> includedPackages,
                                                                                                                           net.bytebuddy.matcher.ElementMatcher.Junction<net.bytebuddy.description.NamedElement> defaultIfEmpty)
      • classLoaderCanLoadClass

        public static net.bytebuddy.matcher.ElementMatcher.Junction<java.lang.ClassLoader> classLoaderCanLoadClass​(java.lang.String className)
        Matches only class loaders which can load a certain class.

        Warning: the class will be tried to load by each class loader. You should choose a class which does not have optional dependencies (imports classes which are not on the class path). Ideally, choose an interface or annotation without dependencies.

        Parameters:
        className - the name of the class to check
        Returns:
        a matcher which only matches class loaders which can load a certain class.
      • implementationVersionLte

        public static net.bytebuddy.matcher.ElementMatcher.Junction<java.security.ProtectionDomain> implementationVersionLte​(java.lang.String version)
        A matcher that checks whether the implementation version read from the MANIFEST.MF related for a given ProtectionDomain is lower than or equals to the limit version. Assumes a SemVer version format.
        Parameters:
        version - the version to check against
        Returns:
        an LTE SemVer matcher
      • implementationVersionGte

        public static net.bytebuddy.matcher.ElementMatcher.Junction<java.security.ProtectionDomain> implementationVersionGte​(java.lang.String version)
      • overridesOrImplementsMethodThat

        public static MethodHierarchyMatcher overridesOrImplementsMethodThat​(net.bytebuddy.matcher.ElementMatcher<? super net.bytebuddy.description.method.MethodDescription> methodElementMatcher)
        Matches overridden methods of a super class or implemented methods of an interface. Recursively traverses the superclasses and interfaces. The the superclasses and interfaces to examine can be limited via MethodHierarchyMatcher.onSuperClassesThat(ElementMatcher).
        Parameters:
        methodElementMatcher - The matcher which is applied on the method hierarchy
        Returns:
        a matcher which is applied on the method hierarchy
      • matches

        public static net.bytebuddy.matcher.ElementMatcher.Junction<net.bytebuddy.description.NamedElement> matches​(WildcardMatcher matcher)
      • anyMatch

        public static net.bytebuddy.matcher.ElementMatcher.Junction<net.bytebuddy.description.NamedElement> anyMatch​(java.util.List<WildcardMatcher> matchers)
      • annotationMatches

        public static net.bytebuddy.matcher.ElementMatcher.Junction<net.bytebuddy.description.annotation.AnnotationSource> annotationMatches​(java.lang.String annotationWildcard)
      • isProxy

        public static <T extends net.bytebuddy.description.NamedElement> net.bytebuddy.matcher.ElementMatcher.Junction<T> isProxy()