Java Code Examples for com.alibaba.fastjson.JSON#DEFAULT_GENERATE_FEATURE

The following examples show how to use com.alibaba.fastjson.JSON#DEFAULT_GENERATE_FEATURE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JsonDataCodec.java    From spring-boot-protocol with Apache License 2.0 5 votes vote down vote up
@Override
public byte[] encodeResponseData(Object data,RpcMethod rpcMethod) {
    if(data == null){
        return EMPTY;
    }

    try (SerializeWriter out = new SerializeWriter(null, JSON.DEFAULT_GENERATE_FEATURE,
            SERIALIZER_FEATURES)) {
        JSONSerializer serializer = new JSONSerializer(out, SerializeConfig.globalInstance);
        serializer.write(data);
        return out.toBytes(CHARSET_UTF8);
    }
}
 
Example 2
Source File: TencentImPlugin.java    From FlutterTencentImPlugin with Apache License 2.0 4 votes vote down vote up
private TencentImPlugin(Context context, MethodChannel channel) {
    TencentImPlugin.context = context;
    TencentImPlugin.channel = channel;
    JSON.DEFAULT_GENERATE_FEATURE |= SerializerFeature.DisableCircularReferenceDetect.mask;
}
 
Example 3
Source File: SerializeWriter.java    From uavstack with Apache License 2.0 4 votes vote down vote up
public SerializeWriter(Writer writer){
    this(writer, JSON.DEFAULT_GENERATE_FEATURE, SerializerFeature.EMPTY);
}