com.urbanairship.api.common.model.APIModelObject Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-client Show documentation
Show all versions of java-client Show documentation
The Urban Airship Java client library
/*
* Copyright (c) 2013-2016. Urban Airship and Contributors
*/
package com.urbanairship.api.common.model;
import com.urbanairship.api.common.parse.CommonObjectMapper;
import java.io.IOException;
public abstract class APIModelObject {
public String toJSON() {
try {
return CommonObjectMapper.getInstance().writeValueAsString(this);
} catch ( IOException e) {
return toJSON(e);
}
}
protected static String toJSON(Exception e) {
return "{ \"exception\" : \"" + e.getClass().getName() + "\", \"message\" : \"" + e.getMessage() + "\" }";
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy