Android JsonSerializationContext - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android JsonSerializationContext class.

This code example shows how to use the following methods:serialize
	public static class Serializer implements JsonSerializer<CallResultMessage> {
		@Override 
		public JsonElement serialize(CallResultMessage msg, Type arg1,
				JsonSerializationContext context) {
			JsonArray array = new JsonArray();
			array.add(context.serialize(msg.getType().getCode()));
			array.add(context.serialize(msg.callId));
			array.add(msg.payload.getGsonElement());
			return array;
		} 
	} 
 
	public static class Deserializer implements JsonDeserializer<CallResultMessage> {
		@Override 
		public CallResultMessage deserialize(JsonElement element, Type arg1,
				JsonDeserializationContext context) throws JsonParseException {
 
			JsonArray array = element.getAsJsonArray();
			 
			if ( MessageType.fromInteger(array.get(0).getAsInt()) != MessageType.CALLRESULT)
5
CodeRank
This code example shows how to use the following methods:serialize
	@Override 
	public JsonElement serialize(IdentityProxy src, Type srcType, JsonSerializationContext context) {
		if(SerializationContext.current().getUuidTranslation()) { 
			assert(src != null);
			if(src.getValue() == null)
				return context.serialize(null);
	 
			IdentityDao identityDao = new IdentityDaoImpl();
			if(src.getTableName() != null) {
				String uuid = identityDao.getIdentityUuid(src.getTableName(), String.valueOf(src.getValue()));
				if(uuid == null)
					return context.serialize(null);
				 
				// Exceptions set the _idFieldName in the IdentityProxy structure. So if this field is not 
				// null, prepare a structure of uuid and idFieldName and return the json representation of that. 
				String idName = src.getidFieldName();
				if (idName != null) {
					// Prepare a structure. 
					JsonObject jsonObj = new JsonObject();
					jsonObj.add("uuid", new JsonPrimitive(uuid));
4
CodeRank
This code example shows how to use the following methods:serialize
This code example shows how to use the following methods:serialize
	 * @see JsonSerializer#serialize(Object, Type, JsonSerializationContext) 
	 */ 
 
	public JsonElement serialize(org.redpin.base.core.Fingerprint src,
			Type typeOfSrc, JsonSerializationContext context) {
		return context.serialize(src, Fingerprint.class);
	} 
 
	/** 
	 * @see JsonDeserializer#deserialize(JsonElement, Type, 
	 *      JsonDeserializationContext) 
	 */ 
 
	public Fingerprint deserialize(JsonElement json, Type typeOfT,
			JsonDeserializationContext context) throws JsonParseException {
		return context.deserialize(json, Fingerprint.class);
	} 
 
} 
4
CodeRank
This code example shows how to use the following methods:serialize
This code example shows how to use the following methods:serialize
	 * @see JsonSerializer#serialize(Object, Type, JsonSerializationContext) 
	 */ 
	public JsonElement serialize(org.redpin.base.core.Measurement src,
			Type typeOfSrc, JsonSerializationContext context) {
 
		return context.serialize(src, Measurement.class);
	} 
 
	/** 
	 * @see JsonDeserializer#deserialize(JsonElement, Type, 
	 *      JsonDeserializationContext) 
	 */ 
	public Measurement deserialize(JsonElement json, Type typeOfT,
			JsonDeserializationContext context) throws JsonParseException {
 
		return context.deserialize(json, Measurement.class);
	} 
 
} 
4
CodeRank
This code example shows how to use the following methods:serialize

Related Android JsonSerializationContext Questions & Answers:

See Code Examples for Android JsonSerializationContext Methods: