In this post under DataMask, I will show with example how to do middle masking of email address excluding masking of delimiter. So if the email address is “john.doe@gmail.com”, the output should be “jo**.*oe@gmail.com”. The delimiter “.” is also is excluded. Below is the complete main class Main class package core; import io.github.freewarelabs.datamask.core.DataFormatType; import io.github.freewarelabs.datamask.core.DataMaskManager;…… Continue reading Middle masking of email address with configured delimiter
Month: November 2026
Annotation @CachePut example
In this post under Spring Caching, I will introduce you to “@CachePut” Spring annotation. Similar to “@Cacheable” annotation it can be applied at class and method level. The difference between “@Cacheable” and “@CachePut” is that “@Cacheable” can be used to both get value from the cache and put value in the cache but “@CachePut” is…… Continue reading Annotation @CachePut example
Side masking of email address with configured delimiter
In this post under DataMask, I will show with example how to do side masking of email address excluding masking of delimiter. So if the email address is “john.doe@gmail.com”, the output should be “**h*.***@gmail.com”. The delimiter “.” is excluded. Below is the complete main class Main class package core; import io.github.freewarelabs.datamask.core.DataFormatType; import io.github.freewarelabs.datamask.core.DataMaskManager; import io.github.freewarelabs.datamask.core.MaskInformationDTO;…… Continue reading Side masking of email address with configured delimiter
Stubbing a non-void non-static method to throw an exception
In this post under Mockito, I will show with example how to stub mock object’s non-void non-static method to throw an exception. In previous posts under Mockito, I have shown you how to stub mock object’s non-static void method to throw an exception by using Mockito’s “doThrow” method and passing the exception class object as…… Continue reading Stubbing a non-void non-static method to throw an exception
Middle masking of delimited text without configuring delimiter
In this post under DataMask, I will show with example how to do middle masking of delimited text including masking of delimiter. So if the text is “1111-2222-3333-4444”, the output should be “111**********3-4444”. The delimiter “-” is also masked, it is not excluded. Below is the complete main class Main class package core; import io.github.freewarelabs.datamask.core.DataFormatType;…… Continue reading Middle masking of delimited text without configuring delimiter
Creating custom cache key using KeyGenerator interface
In all my previous posts under Spring Caching, I have used Java primitive types and String as cache key. In this post under Spring Caching, I will show with example how to create custom cache key. To create a custom cache key we need to implement Spring interface “KeyGenerator” and provide the logic that creates…… Continue reading Creating custom cache key using KeyGenerator interface