In this post under DataMask, I will show with example how to do side masking of email address including masking of delimiter. So if the text is “john.doe@gmail.com”, the output should be “**hn****@gmail.com” 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; import io.github.freewarelabs.datamask.core.MaskType; import io.github.freewarelabs.datamask.core.exception.DataMaskException; public class…… Continue reading Side masking of email address without configuring delimiter
Instance Main and Non-Instance Main method in one class example
In this post under Java language, I will show with example how Java runs a program which has two main methods. Here two main methods means one traditional public static void main method as shown below public static void main(String[] args) { } and another being the new main method as shown below void main()…… Continue reading Instance Main and Non-Instance Main method in one class example
Instance Main method example
In this post under Java language, I will introduce you to new feature added to Java called “Instance Main Method”. This feature was added in Java version 25. Pre Java 25, if we have to write class with “main” method, we used to mark it as public and static as shown below. You also need…… Continue reading Instance Main method example
Conditional caching using SpEL
In this post under Spring Caching, I will show with example how to enable conditional caching using SpEL. In previous posts I showed you how to use “@Cacheable” annotation. In that annotation itself there is an attribute that we can use to enable conditional caching. That attribute name is “condition” and it takes as SpEL…… Continue reading Conditional caching using SpEL
Creating custom cache key from target object properties using SpEL
In this post under Spring Caching, I will show with example how to create custom cache key using annotated method’s target object properties in SpEL. For our example, we will use the below “Calculator” class as shown below Calculator package caching.package8; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Component; @Component public class Calculator { private int start, end; @Cacheable(cacheNames…… Continue reading Creating custom cache key from target object properties using SpEL
Middle masking of delimited text with configured delimiter
In this post under DataMask, I will show with example how to do middle masking of a simple delimited text excluding masking of delimiter. So if the text is “1111-2222-3333-4444”, the output should be “111*-****-**33-4444” As you can see from the output the numbers are masked in the middle excluding delimiters. Below is the complete…… Continue reading Middle masking of delimited text with configured delimiter
Creating custom cache key from method object properties using SpEL
In this post under Spring Caching, I will show with example how to create custom cache key using annotated method’s properties in SpEL. For our example, we will use the below “Calculator” class as shown below Calculator package caching.package7; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Component; @Component public class Calculator { @Cacheable(cacheNames = "addNumbersWithParam_region", key = "#root.method.hashCode() +…… Continue reading Creating custom cache key from method object properties using SpEL
Side masking of delimited text with configured delimiter
In this post under DataMask, I will show with example how to do side masking of a simple delimited text excluding masking of delimiter. So if the text is “1111-2222-3333-4444”, the output should be “***1-2222-33**-***” As you can see from the output the numbers are masked from the sides excluding delimiters. Below is the complete…… Continue reading Side masking of delimited text with configured delimiter
Full masking of delimited text without configuring delimiter
In this post under DataMask, I will show with example how to do full masking of a simple delimited text including masking of delimiter. So if the text is “1111-2222-3333-4444”, the output should be “*******************” As you can see from the output the numbers and delimiter “-” are also masked. Below is the complete main…… Continue reading Full masking of delimited text without configuring delimiter
Creating custom cache key from method name using SpEL
In this post under Spring Caching, I will show with example how to create custom cache key from method name using SpEL. In SpEL, to access SpEL context object we will use “#root” variable. This SpEL context object will have below information reference to target method that is annotated with @Cacheable, @CachePut, or @CacheEvict reference…… Continue reading Creating custom cache key from method name using SpEL