com.mailgun.util.StringUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mailgun-java Show documentation
Show all versions of mailgun-java Show documentation
The Mailgun SDK for Java enables Java developers to work with Mailgun API
efficiently.
package com.mailgun.util;
import com.mailgun.exception.MailGunException;
import lombok.experimental.UtilityClass;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@UtilityClass
public class StringUtil {
/**
*
* Method that can be used to serialize any Java value as a String.
*
*
* @param obj any Java value
* @return serialized result
*/
public String asJsonString(final Object obj) {
try {
return ObjectMapperUtil.getObjectMapper().writeValueAsString(obj);
} catch (Exception e) {
log.error("Unable to serialize object.", e);
throw new MailGunException("Unable to serialize object.");
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy