All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.bytebuddy.matcher.NameMatcher Maven / Gradle / Ivy

Go to download

Byte Buddy is a Java library for creating Java classes at run time. This artifact is a build of Byte Buddy with a remaining dependency onto ASM. You should never depend on this module without repackaging Byte Buddy and ASM into your own namespace.

There is a newer version: 1.15.11
Show newest version
package net.bytebuddy.matcher;

import net.bytebuddy.description.NamedElement;

/**
 * A method matcher that matches a byte code element's source code name:
 * 
    *
  • The source code name of types is equal to their binary name where arrays are appended a {@code []} by * their arity and where inner classes are appended by dots to their outer class's source name.
  • *
  • Constructors and the type initializer methods are represented by the empty string as they do not * represent a source code name.
  • *
  • Fields are named as in the source code.
  • *
* * @param The type of the matched entity. */ public class NameMatcher extends ElementMatcher.Junction.AbstractBase { /** * The matcher that is applied to a byte code element's source code name. */ private final ElementMatcher nameMatcher; /** * Creates a new matcher for a byte code element's source name. * * @param nameMatcher The matcher that is applied to a byte code element's source code name. */ public NameMatcher(ElementMatcher nameMatcher) { this.nameMatcher = nameMatcher; } @Override public boolean matches(T target) { return nameMatcher.matches(target.getSourceCodeName()); } @Override public boolean equals(Object other) { return this == other || !(other == null || getClass() != other.getClass()) && nameMatcher.equals(((NameMatcher) other).nameMatcher); } @Override public int hashCode() { return nameMatcher.hashCode(); } @Override public String toString() { return "name(" + nameMatcher + ")"; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy