Tags
Language
Tags
April 2024
Su Mo Tu We Th Fr Sa
31 1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 1 2 3 4

Java Interceptor Development with ByteBuddy: Fundamental

Posted By: silva1410
Java Interceptor Development with ByteBuddy: Fundamental

Java Interceptor Development with ByteBuddy: Fundamental
By Eric Fong
English | ASIN : B08MV4G9BV | 2020 | 256 pages | EPUB | 3.37 MB


ByteBuddy is an open source Java based library for Java bytecode generation and manipulation. ByteBuddy is licensed under Apache License Version 2.0, and is freely available on Github. This book provides fundamental knowledge and learn by example guideline on how to develop interceptor and generate code using ByteBuddy. The book provides many easy-to-understand and concise sample codes. The learner can expect to learn these skills and knowledge from this book:

(1) Intercept Java code using on method enter advice, one method exit advice, and around advice.

(2) Learn to generate code during maven build time, and integrate code generation with the maven build process (19 chapters).

(3) ByteBuddy supports instrumentation that can inspect and modify existing Java bytecode. These techniques will be explained in this book:

• Add new constructor, method and instance variable

• Remove existing constructor, method and instance variable

• Modify the value of instance variable

• Modify the value of method parameter

• Inspect the existing Java class structure, constructor signature, method signature, and instance variable

• Generate new generic Java class, constructor, method, and instance variable (upper bound, lower bound, multiple bound, wildcard, parameterized type, method type argument)

• Search and replace code in the method

• Add and remove annotation that is annotated on Java class, constructor, method, instance variable, and parameter

• Add and modify Java inner class (add first and second level inner class, intercepting inner class and anonymous class)

• Generate new Java class, Java interface, enum, annotation, and abstract class

• Generate simple method and lambda expression

• Sharing data between advice codes

(5) Introduction to Java agent development with Java Instrumentation API and ByteBuddy, which can intercept JDK core class (one chapter only)

This book does not cover:

• How to instrument Record component

• How to instrument Java native method

• How to instrument lambda expression

• How to generate anonymous class

• How to instrument Java bytecode using bytecode instruction, for example, stack manipulation, and ByteCodeAppender