A library of useful Java classes. You can use them as part of your entities, too.
Think about a person. Now try to make a Person class. I guess you would craft something like this:
public class Person {
private String firstName;
private String lastName;
private Date birthDate;
private String email;
}Can you see that we have these properties: name and email address, but we have to map them to types like String, Date, etc. And do not forget about validating this data in the service layer....
So instead of these, why can't we have Name or Email types? And these types should know what is a valid email address or what is the maximum length of a name.
By using molecules, your Person class could look like this:
public class Person {
private Name firstName;
private Name lastName;
private BirthDate birthDate;
private Email email;
}Isn't it better? :)
Do you like the idea? Check out all the molecules or help! :)
Currently, these molecules are available within the following packages:
Well, at the moment you can clone or download this repository, build it and you can install it as a third party package. Later on, I'm planning to upload it as an artifact to the Maven Central Repository.