In this post under Java, I will explain with example the purpose of Sealed classes and interfaces. Sealed classes are the classes that doesn’t allow themselves to be inherited by any unspecified classes. Only those classes which are permitted by sealed classes, are allowed to inherit the sealed class. Lets take an example. A “Shape”…… Continue reading Sealed Classes and interfaces
Object Mapping between classes with different attributes
In the previous post under MapStruct I showed an example of how to use MapStruct framework for object mapping. I assumed that attribute names in source class and destination class are same. What if they are not. In this post, I will show with an example how to configure MapStruct to map between source and…… Continue reading Object Mapping between classes with different attributes
Simple Object Mapping Example
In this post under MapStruct, I will show with simple example how to map one object attribute values to another object attributes. For our example I will have two classes as shown below Student package package1; public class Student { private int id; private String name; private String className; /*getter and setter methods for each…… Continue reading Simple Object Mapping Example
Populating collection with multiple elements in one single method call
In this post under Java, I will show with example the purpose of static “addAll” method in “Collections” class. The “addAll” method populates a collection with the given list of elements. This method takes two arguments1) the collection that it has to fill or populate2) variable length arument that will contain the elements that has…… Continue reading Populating collection with multiple elements in one single method call
Collections frequency method
In this post under Java, I will show with example the purpose of “frequency” static method in “Collections” class. The “frequency” method returns the number of times an element is repeated in a collection. This method takes two argument1) the collection it has to search2) the element for which it has to return the frequency.…… Continue reading Collections frequency method
Renaming an ldap entry
In this post under Java LDAP, I will show with example how to rename an ldap entry. To rename an ldap entry, Java LDAP api provides “rename” method which takes two arguments1) the current name/fully qualified dn2) the new name/fully qualified dn Below is the complete main code for your reference Main class 1 package…… Continue reading Renaming an ldap entry
LengthComplexityRule example
In this port under Passay, I will show with example the purpose of “LengthComplexityRule” class. In all my previous posts under Passay, I showed how a password will have one set of rules that should be evaluated to check whether the password is valid or not. Whereas in real situation, the rules to be evaluated…… Continue reading LengthComplexityRule example
Configuring access to multiple custom property files
In this post under Spring Core, I will show with example how to configure access to multiple custom property files. In the previous post, I showed with example how to configure access to single custom property file. In real world scenario they wouldn’t be a situation where we need access to only one custom property…… Continue reading Configuring access to multiple custom property files
Configuring access to custom property file
In this post under Spring Core, I will show with example how to configure access to custom property file. In the last blog I showed with example how to access system and environment properties. But those are not the only properties that we need access to. We developers also need access to properties created by…… Continue reading Configuring access to custom property file
Checking whether the password have whitespaces or not
In this post under Passay, I will explain with example the purpose of “WhitespaceRule”. Sometimes user chooses a password that will have whitespaces. If you want to restrict user from creating a password that does have whitespaces, you can use “WhitespaceRule” class. “WhitespaceRule” class makes sure that the password set by the user doesn’t have…… Continue reading Checking whether the password have whitespaces or not