|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.odata4j.format.json.JsonFormatWriter<T>
T
- the type of the content elements to be written to the stream.public abstract class JsonFormatWriter<T>
Write content to an HTTP stream in JSON format. This class is abstract because it delegates the strategy pattern of writing actual content elements to its (various) subclasses. Each element in the array to be written can be wrapped in a function call on the JavaScript side by specifying the name of a function to call to the constructor.
Constructor Summary | |
---|---|
JsonFormatWriter(String jsonpCallback)
Create a new JSON writer. |
Method Summary | |
---|---|
String |
getContentType()
Recover the MIME content type for the stream |
protected String |
getJsonpCallback()
|
void |
write(ExtendedUriInfo uriInfo,
Writer w,
T target)
Write an object to the formatted version of the stream |
protected abstract void |
writeContent(ExtendedUriInfo uriInfo,
JsonWriter jw,
T target)
A strategy method to actually write content objects |
protected void |
writeOEntity(ExtendedUriInfo uriInfo,
JsonWriter jw,
OEntity oe,
EdmEntitySet ees,
boolean isResponse)
|
protected void |
writeOProperties(JsonWriter jw,
List<OProperty<?>> properties)
|
protected void |
writeProperty(JsonWriter jw,
OProperty<?> prop)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JsonFormatWriter(String jsonpCallback)
jsonpCallback
- a function to call on the javascript side to act
on the data provided in the content.Method Detail |
---|
public String getContentType()
FormatWriter
getContentType
in interface FormatWriter<T>
protected String getJsonpCallback()
public void write(ExtendedUriInfo uriInfo, Writer w, T target)
FormatWriter
write
in interface FormatWriter<T>
uriInfo
- the base uri of the entity documentsw
- the underlying "stream" to write totarget
- the object to be writtenprotected abstract void writeContent(ExtendedUriInfo uriInfo, JsonWriter jw, T target)
uriInfo
- the base URI that indicates where in the schema we arejw
- the JSON writer objecttarget
- the content value to be writtenprotected void writeOEntity(ExtendedUriInfo uriInfo, JsonWriter jw, OEntity oe, EdmEntitySet ees, boolean isResponse)
protected void writeOProperties(JsonWriter jw, List<OProperty<?>> properties)
protected void writeProperty(JsonWriter jw, OProperty<?> prop)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |