Search in sources :

Example 1 with ExtraProcessable

use of com.alibaba.fastjson.parser.deserializer.ExtraProcessable in project fastjson by alibaba.

the class DefaultJSONParser method parseExtra.

public void parseExtra(Object object, String key) {
    // xxx
    final JSONLexer lexer = this.lexer;
    lexer.nextTokenWithColon();
    Type type = null;
    if (extraTypeProviders != null) {
        for (ExtraTypeProvider extraProvider : extraTypeProviders) {
            type = extraProvider.getExtraType(object, key);
        }
    }
    Object value = //
    type == null ? // skip
    parse() : parseObject(type);
    if (object instanceof ExtraProcessable) {
        ExtraProcessable extraProcessable = ((ExtraProcessable) object);
        extraProcessable.processExtra(key, value);
        return;
    }
    if (extraProcessors != null) {
        for (ExtraProcessor process : extraProcessors) {
            process.processExtra(object, key, value);
        }
    }
    if (resolveStatus == NeedToResolve) {
        resolveStatus = NONE;
    }
}
Also used : WildcardType(java.lang.reflect.WildcardType) ParameterizedType(java.lang.reflect.ParameterizedType) Type(java.lang.reflect.Type) ExtraTypeProvider(com.alibaba.fastjson.parser.deserializer.ExtraTypeProvider) ExtraProcessor(com.alibaba.fastjson.parser.deserializer.ExtraProcessor) ExtraProcessable(com.alibaba.fastjson.parser.deserializer.ExtraProcessable)

Aggregations

ExtraProcessable (com.alibaba.fastjson.parser.deserializer.ExtraProcessable)1 ExtraProcessor (com.alibaba.fastjson.parser.deserializer.ExtraProcessor)1 ExtraTypeProvider (com.alibaba.fastjson.parser.deserializer.ExtraTypeProvider)1 ParameterizedType (java.lang.reflect.ParameterizedType)1 Type (java.lang.reflect.Type)1 WildcardType (java.lang.reflect.WildcardType)1