Java Records Unleashed: Validation Best Practices

Pubblicato il: 19 agosto 2024
sul canale di: 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


In questa pagina del sito puoi guardare il video online Java Records Unleashed: Validation Best Practices della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Tales from the jar side 19 agosto 2024, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 782 volte e gli è piaciuto 56 spettatori. Buona visione!