Welcome to EverybodyWiki 😃 ! Nuvola apps kgpg.png Log in or ➕👤 create an account to improve, watchlist or create an article like a 🏭 company page or a 👨👩 bio (yours ?)...

Byte Buddy

From EverybodyWiki Bios & Wiki


Byte Buddy
Developer(s)Rafael Winterhalter
Repositorygithub.com/raphw/byte-buddy/
Written inJava
Engine
    Operating systemCross-platform
    TypeBytecode Engineering Library
    LicenseApache license (version 2)
    Websitebytebuddy.net

    Amazon.com Logo.png Search Byte Buddy on Amazon.

    Byte Buddy is a Java library for the manipulation and creation of Java bytecode. Bytecode manipulation can be performed prior to execution or during the runtime of an application.

    Byte Buddy uses the ObjectWeb ASM library to apply its manipulations but provides a high-level API that avoids the explicit specification of Java bytecode that is required by ASM. Instead, Byte Buddy uses a domain-specific language to express bytecode manipulation on a high level where the domain language’s verbs lean onto terms of the Java programming language.

    Byte Buddy is used by a wide-range of commercial and free software products on the Java virtual machine. For example, the library is used by the popular Mockito and Hibernate libraries.[1]. Byte Buddy is in particularly popular for creating Java agents, for example by Instana APM [2] or Elastic APM [3], where code changes are implemented in regular Java code which is used as template for changing a class’s code.

    Byte Buddy is part of the OpenJDK Quality Outreach [4] for giving early feedback on upcoming Java releases. The library received a Duke's Choice Award in 2015[5] and its author was distinguished with an Oracle Groundbreaker Award in 2019[6]

    Example[edit]

    Using Byte Buddy, the following code creates and loads a class that extends java.lang.Object and overrides its toString method to return the string Hello World!.

    Class<?> dynamicType = new ByteBuddy()
      .subclass(Object.class)
      .method(ElementMatchers.named("toString"))
      .intercept(FixedValue.value("Hello World!"))
      .make()
      .load(getClass().getClassLoader())
      .getLoaded();
    
    assertThat(dynamicType.newInstance().toString(), is("Hello World!"));
    

    See also[edit]


    Other articles of the topic Computer programming : G Sharp (programming language), Programmer, The Countess of Lovelace, Data-oriented programming, Nim (programming language), C++/codebox experiment, AdoptOpenJDK
    Some use of "" in your query was not closed by a matching "".Some use of "" in your query was not closed by a matching "".

    • ObjectWeb ASM
    • Byte Code Engineering Library
    • Javassist

    References[edit]

    1. "Maven usage overview". MvnRepository.
    2. "Instana agent description". Instana Inc.
    3. "Elastic Search Agent description". Elastic.
    4. "Quality outreach". OpenJDK.
    5. "JAX Enter article mentioning the award (German)". JAX Enter.
    6. "Forbes article on the Groundbreaker award winners of 2019". Forbes.

    External links[edit]

    Category:Java (programming language) libraries


    This article "Byte Buddy" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:Byte Buddy. Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.