|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 output 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)
Creates a new JSON writer. |
Method Summary | |
---|---|
String |
getContentType()
Recover the MIME content type for the stream |
protected String |
getJsonpCallback()
|
void |
write(UriInfo uriInfo,
Writer w,
T target)
Write an object to the formatted version of the stream |
protected void |
writeCollection(JsonWriter jw,
EdmCollectionType type,
OCollection<? extends OObject> coll)
|
protected void |
writeComplexObject(JsonWriter jw,
String complexObjectName,
String fullyQualifiedTypeName,
List<OProperty<?>> props)
|
protected abstract void |
writeContent(UriInfo uriInfo,
JsonWriter jw,
T target)
A strategy method to actually write content objects |
protected void |
writeLinks(JsonWriter jw,
OEntity oe,
UriInfo uriInfo,
boolean isResponse)
|
protected void |
writeOEntity(UriInfo uriInfo,
JsonWriter jw,
OEntity oe,
EdmEntitySet ees,
boolean isResponse)
|
protected void |
writeOProperties(JsonWriter jw,
List<OProperty<?>> properties)
|
protected void |
writeProperty(JsonWriter jw,
OProperty<?> prop)
|
protected void |
writeRequestLink(JsonWriter jw,
OLink link,
OEntity oe,
UriInfo uriInfo)
|
protected void |
writeResponseLink(JsonWriter jw,
OLink link,
OEntity oe,
UriInfo uriInfo)
|
protected void |
writeValue(JsonWriter jw,
EdmType type,
Object pvalue)
|
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(UriInfo 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 void writeCollection(JsonWriter jw, EdmCollectionType type, OCollection<? extends OObject> coll)
protected void writeComplexObject(JsonWriter jw, String complexObjectName, String fullyQualifiedTypeName, List<OProperty<?>> props)
protected abstract void writeContent(UriInfo 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 writeLinks(JsonWriter jw, OEntity oe, UriInfo uriInfo, boolean isResponse)
protected void writeOEntity(UriInfo uriInfo, JsonWriter jw, OEntity oe, EdmEntitySet ees, boolean isResponse)
protected void writeOProperties(JsonWriter jw, List<OProperty<?>> properties)
protected void writeProperty(JsonWriter jw, OProperty<?> prop)
protected void writeRequestLink(JsonWriter jw, OLink link, OEntity oe, UriInfo uriInfo)
protected void writeResponseLink(JsonWriter jw, OLink link, OEntity oe, UriInfo uriInfo)
protected void writeValue(JsonWriter jw, EdmType type, Object pvalue)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |