public virtual VPackParser registerDeserializer(string attribute , ValueType type, VPackJsonDeserializer deserializer) { System.Collections.Generic.IDictionary <ValueType, VPackJsonDeserializer > byName = this.deserializersByName[attribute]; if (byName == null) { byName = new System.Collections.Generic.Dictionary <ValueType , VPackJsonDeserializer>(); this.deserializersByName[attribute] = byName; } byName[type] = deserializer; return(this); }
private VPackJsonDeserializer getDeserializer(string attribute , ValueType type) { VPackJsonDeserializer deserializer = null; System.Collections.Generic.IDictionary <ValueType, VPackJsonDeserializer > byName = this.deserializersByName[attribute]; if (byName != null) { deserializer = byName[type]; } if (deserializer == null) { deserializer = this.deserializers[type]; } return(deserializer); }
public virtual VPackParser registerDeserializer(ValueType type, VPackJsonDeserializer deserializer) { this.deserializers[type] = deserializer; return(this); }
/// <exception cref="VPackException"/> private void parse(VPackSlice parent, string attribute, VPackSlice value, java.lang.StringBuilder json, bool includeNullValues) { VPackJsonDeserializer deserializer = null; if (attribute != null) { appendField(attribute, json); deserializer = this.getDeserializer(attribute, value.type()); } if (deserializer != null) { deserializer.deserialize(parent, attribute, value, json); } else { if (value.isObject()) { this.parseObject(value, json, includeNullValues); } else { if (value.isArray()) { this.parseArray(value, json, includeNullValues); } else { if (value.isBoolean()) { json.Append(value.getAsBoolean()); } else { if (value.isString()) { json.Append(org.json.simple.JSONValue.toJSONString(value.getAsString())); } else { if (value.isNumber()) { json.Append(value.getAsNumber()); } else { if (value.isNull()) { json.Append(NULL); } else { json.Append(org.json.simple.JSONValue.toJSONString(NON_REPRESENTABLE_TYPE)); } } } } } } } }