A quick and practical overview of Class.isInstance and Class.isAssignableFrom methods.
Search Results for: isinstance
Avoiding the IndexOutOfBoundsException When Using List.subList() in Java
In Java, subList() creates a sub-list from a larger list, but it can throw an exception if you give it invalid starting or ending positions. Learn how to avoid this error.
Difference Between Lombok @AllArgsConstructor, @RequiredArgsConstructor and @NoArgConstructor
Learn about different constructor generation annotations in Lombok and when to use them.
Set an Environment Variable at Runtime in Java
Learn how to have more control over the environment variables, especially for test scenarios.
All the Ways Java Uses the Colon Character
Learn how Java uses the colon character in a variety of different ways.
Resolving Gson’s “Multiple JSON Fields” Exception
Discuss the causes for a tricky yet ultimately fixable IllegalArgumentException we can encounter when using Gson
Checking if an Object’s Type Is Enum
Explore various approaches and best practices for determining if an object’s type is an enum.
Retry Logic with CompletableFuture
Learn how to apply retry logic to CompletableFuture objects.
Programmatic Generation of JSON Schemas in Java
Learn how to create JSON Schemas programmatically using the Java JSON Schema Generator library.
Integer.class vs Integer.TYPE vs int.class
Explore the differences between Integer.class, Integer.TYPE, and int.class. Understand their significance in Java programming.
Using Java Records with JPA
Learn how we can use records with JPA and Spring Data JPA.
Determine if a Class Implements an Interface in Java
Learn several ways to determine if an object or a class implements a specific interface.
Toggle a Boolean Variable in Java
Learn how to build a null-safe method to toggle a given boolean variable in Java
Testing Spring JMS
Learn different approaches for testing a Spring JMS application.
Hibernate’s “Detached Entity Passed to Persist” Error
Explanation about detached entities, why occurs the”Detached Entity Passed to Persist” error occurs and how to prevent it.
Constraint Composition with Bean Validation
Learn how to group multiple constraints under a single, custom annotation to reduce code duplication and improve readability
Hibernate’s “Not-Null Property References a Null or Transient Value” Error
Learn about Hibernate’s PropertyValueException. In particular, the “not-null property references a null or transient value” error message.
HttpMessageNotWritableException: No Converter for [class …] With Preset Content-Type
Learn what causes Spring to throw HttpMessageNotWritableException with the message “No converter for [class …] with preset Content-Type” and how to solve it.
Validate String as Filename in Java
Learn how to validate if a given string has a valid filename for the OS, using Java.
Non-Capturing Regex Groups in Java
Explore how to use non-capturing groups in Java Regular Expressions