public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType)
      throws IOException {
    if (object == null) {
      serializer.writeNull();
      return;
    }

    serializer.write(object.toString());
  }
예제 #2
0
 public void writeValue(JSONSerializer paramJSONSerializer, Object paramObject) throws Exception {
   paramJSONSerializer = paramJSONSerializer.getWriter();
   if (paramObject == null) {
     if (paramJSONSerializer.isEnabled(SerializerFeature.WriteNullNumberAsZero)) {
       paramJSONSerializer.write('0');
       return;
     }
     paramJSONSerializer.writeNull();
     return;
   }
   paramJSONSerializer.append(paramObject.toString());
 }
예제 #3
0
 public void write(
     JSONSerializer paramJSONSerializer, Object paramObject1, Object paramObject2, Type paramType)
     throws IOException {
   paramJSONSerializer = paramJSONSerializer.getWriter();
   paramObject1 = (Point) paramObject1;
   if (paramObject1 == null) {
     paramJSONSerializer.writeNull();
     return;
   }
   char c = '{';
   if (paramJSONSerializer.isEnabled(SerializerFeature.WriteClassName)) {
     paramJSONSerializer.write('{');
     paramJSONSerializer.writeFieldName(JSON.DEFAULT_TYPE_KEY);
     paramJSONSerializer.writeString(Point.class.getName());
     c = ',';
   }
   paramJSONSerializer.writeFieldValue(c, "x", paramObject1.getX());
   paramJSONSerializer.writeFieldValue(',', "y", paramObject1.getY());
   paramJSONSerializer.write('}');
 }