Hi all, in this post under Java pattern matching section, I will introduce you to pattern matching and how to use it with instanceof operator. Please don’t confuse java pattern matching with regex pattern matching Regex pattern matching checks whether a given text matches a text pattern and may optionally extract parts of the text.…… Continue reading Pattern matching with instanceof
DictionaryRule with TernaryDictionary example
In this post under Passay, I will show with example, how to use “TernaryDictionary” with “DictionaryRule”. For recap, DictionaryRule will check whether the user inputed password matches a word amoung a dictionary of words. If it matches, the validation fails or else passes. The dictionary of words can be implemented in many ways but for…… Continue reading DictionaryRule with TernaryDictionary example
Passing context information to custom mapping method
In this post under MapStruct, I will explain with example how to pass context information to custom mapping methods. In the previous post, I have explained how to tell MapStruct which is the context information i.e., by annotating it with “@Context” annotation as shown below @Mapping(target = "addressDTO", source = "address") PersonDTO personToPersonDTO(Person person, @Context…… Continue reading Passing context information to custom mapping method
Passing context information to mapping method
In this post under MapStruct, I will show with example how to pass context information to the mapping methods. For our example, I will have “Person” entity and map it to “PersonDTO” entity. Below is the class structure of “Person” class Person package package34; public class Person { private int id; private String name; private…… Continue reading Passing context information to mapping method
CollectionUtils transform method
In this post under Apache Collections, I will show with example, how to use and purpose of “transform” static method in Apache Collections “CollectionUtils” class. The “transform” method can be used to transform each elements in a collection. The transformer logic is implemented by implementing the “Transformer” functional interface. Please note it doesn’t create a…… Continue reading CollectionUtils transform method
Using multiple source object in expressions
In previous posts under MapStruct, I introduced you guys to expressions and then I showed how we can use a source object in an expressions. Just to be thorough, in this post under MapStruct, I will show with example that we can refer multiple source objects in an expressions. For our example, we use below…… Continue reading Using multiple source object in expressions
Ordering multiple BeanPostProcessor implementations example
In this post under Spring Core, I will show with example how to order multiple “BeanPostProcessor” interface implementations. To order multiple “BeanPostProcessor” implementations, each implementations much implement “Ordered” interface and provide order number in the interface “getOrder” method. Note: Ordering of “BeanPostProcessor” implementations only work with “@Component” annotation and not with “@Bean” annotation. For our…… Continue reading Ordering multiple BeanPostProcessor implementations example
DictionaryRule with WordListDictionary example
In this post under Passay, I will show with example what is the purpose and how to use “DictionaryRule”. DictionaryRule will check whether the user inputed password matches a word amoung a dictionary of words. If it matches, the validation fails or else passes. The dictionary of words can be implemented in many ways but…… Continue reading DictionaryRule with WordListDictionary example
RepeatCharacterRegexRule example
In this post under Passay, I will explain with example the purpose of “RepeatCharacterRegexRule” rule. This rule checks the user inputed password for repeated ASCII characters. If a particular ASCII character is repeated more than the preconfigured character count, the rule will invalidate the password. Let’s say, the pre-configured character count is 3, and below…… Continue reading RepeatCharacterRegexRule example
BeanFactoryPostProcessor example
In this post under Spring Core, I will explain with example the purpose of “BeanFactoryPostProcessor” Spring class. We define our Spring beans and give it to Spring container to create instances of those beans. Spring container reads the bean definitions and create instances of beans. What if we want to change the definition of those…… Continue reading BeanFactoryPostProcessor example