Class UserUtils
java.lang.Object
es.kukenan.smartfi.microservice.onboarding.utils.UserUtils
UserUtils class for users-microservice.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringReturn Local date as String.static StringReturn Local date with time as String.static intdateDifference(LocalDate dateFrom, LocalDate dateTo, int differenceType) Return Local date as String.static StringgenerateRandomPassword(String characters, int length) Generate password with defined length.private static ObjectinvokeGetter(Object object, Method method) Helper util to invoke a method capturing, controlling and logging any exception thrown.private static ObjectinvokeSetter(Object object, String setMethodName, Object argument) Helper util to invoke a method capturing, controlling and logging any exception thrown.static List<es.kukenan.smartfi.microservice.onboarding.events.common.UserBackoffice>map(List<UserBackoffice> userBackofficeEntities) Map the givenUserBackofficelist to aUserBackofficelist.static <T,Q> T mergeEntityUser(T original, Q remote) merge user info Method.static StringtoJsonString(Object object) Return de object in json format.
-
Constructor Details
-
UserUtils
public UserUtils()
-
-
Method Details
-
mergeEntityUser
public static <T,Q> T mergeEntityUser(T original, Q remote) merge user info Method.- Type Parameters:
T- user original.Q- user from event.- Parameters:
original- user from event.remote- user from event.- Returns:
- object merged.
-
invokeSetter
Helper util to invoke a method capturing, controlling and logging any exception thrown.- Parameters:
object- the object which method will be invoked.setMethodName- the name of the method to invoke.argument- the setter argument.- Returns:
- the method invocation result or null if any exception is captured.
-
invokeGetter
Helper util to invoke a method capturing, controlling and logging any exception thrown.- Parameters:
object- the object which method will be invoked.method- the method.- Returns:
- the method invocation result or null if any exception is captured.
-
map
public static List<es.kukenan.smartfi.microservice.onboarding.events.common.UserBackoffice> map(List<UserBackoffice> userBackofficeEntities) Map the givenUserBackofficelist to aUserBackofficelist.- Parameters:
userBackofficeEntities- a user backoffice entity list.- Returns:
- the mapped user backoffice dto list.
-
toJsonString
Return de object in json format.- Parameters:
object- the object to get json format.- Returns:
- json formater
-
convertLocalDateToString
Return Local date as String.- Parameters:
date- local Date.- Returns:
- date as String
-
convertLocalDateWithTimeToString
Return Local date with time as String.- Parameters:
date- local Date.- Returns:
- date with time as String
-
generateRandomPassword
Generate password with defined length.- Parameters:
characters- String with all characters.length- String length.- Returns:
- Random password.
-
dateDifference
Return Local date as String.- Parameters:
dateFrom- local Date from.dateTo- local Date to.differenceType- type of difference 1 - Days, 2 - Month, 3 - Years.- Returns:
- date as String
-