示例#1
0
/*     */   public void serializeContentsUsing(Object[] value, JsonGenerator jgen, SerializerProvider provider, JsonSerializer<Object> ser)
/*     */     throws IOException, JsonGenerationException
/*     */   {
/* 131 */     int len = value.length;
/* 132 */     TypeSerializer typeSer = this._valueTypeSerializer;
/*     */ 
/* 134 */     int i = 0;
/* 135 */     Object elem = null;
/*     */     try {
/* 137 */       for (; i < len; i++) {
/* 138 */         elem = value[i];
/* 139 */         if (elem == null) {
/* 140 */           provider.defaultSerializeNull(jgen);
/*     */         }
/* 143 */         else if (typeSer == null)
/* 144 */           ser.serialize(elem, jgen, provider);
/*     */         else
/* 146 */           ser.serializeWithType(elem, jgen, provider, typeSer);
/*     */       }
/*     */     }
/*     */     catch (IOException ioe) {
/* 150 */       throw ioe;
/*     */     } catch (Exception e) {
/* 152 */       Throwable t = e;
/* 153 */       while (((t instanceof InvocationTargetException)) && (t.getCause() != null)) {
/* 154 */         t = t.getCause();
/*     */       }
/* 156 */       if ((t instanceof Error)) {
/* 157 */         throw ((Error)t);
/*     */       }
/* 159 */       throw JsonMappingException.wrapWithPath(t, elem, i);
/*     */     }
/*     */   }
示例#2
0
/*     */   public void serializeContents(Object[] value, JsonGenerator jgen, SerializerProvider provider)
/*     */     throws IOException, JsonGenerationException
/*     */   {
/*  79 */     int len = value.length;
/*  80 */     if (len == 0) {
/*  81 */       return;
/*     */     }
/*  83 */     if (this._elementSerializer != null) {
/*  84 */       serializeContentsUsing(value, jgen, provider, this._elementSerializer);
/*  85 */       return;
/*     */     }
/*  87 */     if (this._valueTypeSerializer != null) {
/*  88 */       serializeTypedContents(value, jgen, provider);
/*  89 */       return;
/*     */     }
/*  91 */     int i = 0;
/*  92 */     Object elem = null;
/*     */     try {
/*  94 */       PropertySerializerMap serializers = this._dynamicSerializers;
/*  95 */       for (; i < len; i++) {
/*  96 */         elem = value[i];
/*  97 */         if (elem == null) {
/*  98 */           provider.defaultSerializeNull(jgen);
/*     */         }
/*     */         else {
/* 101 */           Class cc = elem.getClass();
/* 102 */           JsonSerializer serializer = serializers.serializerFor(cc);
/* 103 */           if (serializer == null) {
/* 104 */             serializer = _findAndAddDynamic(serializers, cc, provider);
/*     */           }
/* 106 */           serializer.serialize(elem, jgen, provider);
/*     */         }
/*     */       }
/*     */     } catch (IOException ioe) {
/* 109 */       throw ioe;
/*     */     }
/*     */     catch (Exception e)
/*     */     {
/* 116 */       Throwable t = e;
/* 117 */       while (((t instanceof InvocationTargetException)) && (t.getCause() != null)) {
/* 118 */         t = t.getCause();
/*     */       }
/* 120 */       if ((t instanceof Error)) {
/* 121 */         throw ((Error)t);
/*     */       }
/* 123 */       throw JsonMappingException.wrapWithPath(t, elem, i);
/*     */     }
/*     */   }
示例#3
0
/*     */   public void serializeTypedContents(Object[] value, JsonGenerator jgen, SerializerProvider provider)
/*     */     throws IOException, JsonGenerationException
/*     */   {
/* 166 */     int len = value.length;
/* 167 */     TypeSerializer typeSer = this._valueTypeSerializer;
/* 168 */     int i = 0;
/* 169 */     Object elem = null;
/*     */     try {
/* 171 */       PropertySerializerMap serializers = this._dynamicSerializers;
/* 172 */       for (; i < len; i++) {
/* 173 */         elem = value[i];
/* 174 */         if (elem == null) {
/* 175 */           provider.defaultSerializeNull(jgen);
/*     */         }
/*     */         else {
/* 178 */           Class cc = elem.getClass();
/* 179 */           JsonSerializer serializer = serializers.serializerFor(cc);
/* 180 */           if (serializer == null) {
/* 181 */             serializer = _findAndAddDynamic(serializers, cc, provider);
/*     */           }
/* 183 */           serializer.serializeWithType(elem, jgen, provider, typeSer);
/*     */         }
/*     */       }
/*     */     } catch (IOException ioe) {
/* 186 */       throw ioe;
/*     */     } catch (Exception e) {
/* 188 */       Throwable t = e;
/* 189 */       while (((t instanceof InvocationTargetException)) && (t.getCause() != null)) {
/* 190 */         t = t.getCause();
/*     */       }
/* 192 */       if ((t instanceof Error)) {
/* 193 */         throw ((Error)t);
/*     */       }
/* 195 */       throw JsonMappingException.wrapWithPath(t, elem, i);
/*     */     }
/*     */   }