Java 16 – Records and Constructor
In my previous post, I introduced you to the new construct called Records which was introduced in Java 16. In this post, I will go a bit deeper into how you can override the default constructor of a...
View ArticleJava 16 – Pattern matching for instanceof
We all have used instanceof check with a subsequent cast to the desired type and in this process, we are doing two operations: validating whether the object we have is of the desired type using...
View ArticleJava 17 – Sealed classes
Prior to Sealed Classes feature there were two ways a developer could prevent a class to be extended: by declaring the class as final where no one can extend this class. public final class MyClass { }...
View ArticleIntegrate with OpenAI(ChatGPT) Completion API in Java using WebClient
By now you all would have heard about OpenAI and played with its famous product ChatGPT. OpenAI also provides APIs which can be used to integrate features like text completion, code generation, image...
View ArticleIntegrate with OpenAI(ChatGPT) Chat Completion API in Java using Webclient
In my previous post I showed how you can integrate with Completion API. The completion API doesnt support the ChatpGPT model. The ChatGPT model is supported in the Chat completion API. In this post we...
View ArticleConvert XML to HTML using XSLT in Java
In this post I will show you how to convert XML to HTML using XSLT in Java using Saxon HE version 11 library We will add the dependency to our pom: <dependency>...
View ArticleSetting value of XSL parameter xsl:param in Saxon Java API
In one of my previous posts I showed you how to generate HTML from XML data using XSLT. At times you would need to pass certain parameters to the XSLT and use the value of that parameter in generating...
View ArticleThe correct way to do @Async in Java Spring based applications
Spring provides an annotation @Async to run tasks in a separate thread. In Spring boot applications we can enable asynchronous tasks by adding the annotation @EnableAsync to any of the Spring...
View ArticleGotcha: Using Apache Commons StringUtils.isNumeric
StringUtils java class in Apache commons library provides a method isNumeric to check if given sequence of characters contains digits only. But this is not a sure shot way to check for numbers because...
View ArticleUnveiling the Magic of Java ServiceLoader API: Building Modular and...
In the vast realm of Java programming, developers are often faced with the challenge of creating modular, extensible, and maintainable applications. As software systems grow in complexity, the need to...
View Article