Java Records Unleashed: Validation Best Practices

Published: 19 August 2024
on channel: Tales from the jar side
782
56

Simplifying RESTful Web Service Constraints in Java

In this episode of 'Tales from the Jar Side,' Ken Kousen guides Java developers through the process of simplifying constraints when interacting with a RESTful web service. Using a text-to-speech service example, Ken demonstrates four steps to enforce input restrictions programmatically. He covers using Java records, defining constants and enums, utilizing compact constructors for validation and transformation, and applying Bean Validation annotations. The episode also includes practical coding examples and a final test to ensure proper service utilization. All code is available in the accompanying GitHub repository.

00:00 Why do you we need to do this?
02:40 A basic request class
03:30 Defining constants
03:56 Adding enums
06:13 Overloaded constructors
07:44 Compact constructors
09:16 Bean Validation
11:17 Adding the validation dependency
12:01 Bean Validation Annotations
13:50 Testing
15:14 What have we learned?
16:41 Generating audio from text


On this page of the site you can watch the video online Java Records Unleashed: Validation Best Practices with a duration of hours minute second in good quality, which was uploaded by the user Tales from the jar side 19 August 2024, share the link with friends and acquaintances, this video has already been watched 782 times on youtube and it was liked by 56 viewers. Enjoy your viewing!