In this post under Lombok, I will show with example the purpose of “rank” attribute in “ToString.Include” annotation. Whenever we use “ToString” annotation on a class, it generates the string format of an object with fields displayed in the order they are declared in the class. So for example if below is the class that…… Continue reading Using ToString.Include annotation’s rank attribute
Month: June 2023
Accessing Container logs
In this post under TestContainers, I will show with example how to access container logs. Below is the complete main code for your reference. Main Class 1 package package2; 2 3 import org.testcontainers.containers.GenericContainer; 4 import org.testcontainers.utility.DockerImageName; 5 6 public class Example2 { 7 public static void main(String[] args) { 8 DockerImageName dockerImageName = DockerImageName.parse(“hello-world:latest”); 9…… Continue reading Accessing Container logs
Starting and Stopping Docker Containers
In this post under TestContainers, I will show with example how to start and stop a Docker container programmatically. Below is the complete main class for your reference. Main Class 1 package package1; 2 3 import org.testcontainers.containers.GenericContainer; 4 import org.testcontainers.utility.DockerImageName; 5 6 public class Example1 { 7 public static void main(String[] args) { 8 DockerImageName…… Continue reading Starting and Stopping Docker Containers
Registering Filters for all clients
In this post under JAX-RS Client, I will show how to register filters for all clients. In the previous posts, I showed with examples how to register filters per client and per web target. Sometimes we want to register a fixed set of filters for all clients. These fixed set of filters will be automatically…… Continue reading Registering Filters for all clients
Using @ToString callSuper attribute
In this post under Lombok, I will explain the purpose of and how to use “callSuper” attribute available in “@ToString” annotation. This attribute comes into picture when we are working with hierarchy of classes. For example lets say class “Shape” is a super class and class “Square” is a subclass of “Shape” class. “Shape” and…… Continue reading Using @ToString callSuper attribute
Using @ToString.Include annotation
In previous posts under Lombok, I showed you how to use “@ToString” and “@ToString.Exclude” annotations. In this post, I will show with example how to use “@ToString.Include” annotation. This annotation is inverse of “@ToString.Exclude”. This annotation is also used in conjunction with “@ToString” annotation. We also need to enable “onlyExplicitlyIncluded” attribute. This annotation is also…… Continue reading Using @ToString.Include annotation
Using @ToString.Exclude annotation
In previous post under Lombok you learned about “@ToString” annotation. It is an annotation that when applied at the class level generates a “toString” method. The “toString” method generated by Lombok considers all the non-static fields in the class. In this post under Lombok, I will show with example how to override this default behavior.…… Continue reading Using @ToString.Exclude annotation