Class RepositoryCommonValidations


  • public class RepositoryCommonValidations
    extends Object
    Author:
    Andrey Khayrutdinov
    • Constructor Detail

      • RepositoryCommonValidations

        public RepositoryCommonValidations()
    • Method Detail

      • checkUserInfo

        public static boolean checkUserInfo​(IUser user)
        Validates user's data. Common rule for all repositories is: both login and name must contain at least one meaningful char.
        Parameters:
        user - user
        Returns:
        true if user's login and name are not empty
        Throws:
        NullPointerException - is user is null
      • normalizeUserInfo

        public static IUser normalizeUserInfo​(IUser user)
        Normalizes user's data. According to common rules, simply trims login and name.
        Parameters:
        user - user
        Returns:
        normalized instance
        Throws:
        NullPointerException - if user is null or user's login and name