001package org.nuxeo.box.api.marshalling.interfaces; 002 003import org.nuxeo.box.api.marshalling.exceptions.BoxJSONException; 004 005import java.io.InputStream; 006 007public interface IBoxJSONParser { 008 009 /** 010 * Convert the object into String. No exception will be thrown, in case of failure, null is returned. 011 * 012 * @param object 013 * @return 014 */ 015 String convertBoxObjectToJSONStringQuietly(final Object object); 016 017 /** 018 * Convert InputStream to object.No exception will be thrown, in case of failure, null is returned. 019 * 020 * @param inputStream 021 * @param theClass 022 * @return 023 */ 024 <T> T parseIntoBoxObjectQuietly(final InputStream inputStream, final Class<T> theClass); 025 026 /** 027 * Convert the json string into object.No exception will be thrown, in case of failure, null is returned. 028 * 029 * @param jsonString 030 * @param theClass 031 * @return 032 */ 033 <T> T parseIntoBoxObjectQuietly(final String jsonString, final Class<T> theClass); 034 035 /** 036 * Convert the object into String. 037 * 038 * @param object 039 * @return 040 * @throws BoxJSONException 041 */ 042 String convertBoxObjectToJSONString(final Object object) throws BoxJSONException; 043 044 /** 045 * Convert InputStream to object. 046 * 047 * @param inputStream 048 * @param theClass 049 * @return 050 * @throws BoxJSONException 051 */ 052 <T> T parseIntoBoxObject(final InputStream inputStream, final Class<T> theClass) throws BoxJSONException; 053 054 /** 055 * Convert the json string into object. 056 * 057 * @param jsonString 058 * @param theClass 059 * @return 060 * @throws BoxJSONException 061 */ 062 <T> T parseIntoBoxObject(final String jsonString, final Class<T> theClass) throws BoxJSONException; 063}