content: /*
   * Decompiled with CFR 0.153-SNAPSHOT (d6f6758-dirty).
   * 
   * Could not load the following classes:
   *  org.springframework.data.redis.serializer.RedisSerializer
   *  org.springframework.data.redis.serializer.SerializationException
   */
  package com.alibaba.fastjson.support.spring;
  
  import com.alibaba.fastjson.JSON;
  import com.alibaba.fastjson.support.config.FastJsonConfig;
  import org.springframework.data.redis.serializer.RedisSerializer;
  import org.springframework.data.redis.serializer.SerializationException;
  
  /*
   * This class specifies class file version 49.0 but uses Java 6 signatures.  Assumed Java 6.
   */
  public class FastJsonRedisSerializer<T>
  implements RedisSerializer<T> {
      private FastJsonConfig fastJsonConfig = new FastJsonConfig();
      private Class<T> type;
  
      public FastJsonRedisSerializer(Class<T> type) {
          this.type = type;
      }
  
      public FastJsonConfig getFastJsonConfig() {
          return this.fastJsonConfig;
      }
  
      public void setFastJsonConfig(FastJsonConfig fastJsonConfig) {
          this.fastJsonConfig = fastJsonConfig;
      }
  
      public byte[] serialize(T t) throws SerializationException {
          if (t == null) {
              return new byte[0];
          }
          try {
              return JSON.toJSONBytesWithFastJsonConfig(this.fastJsonConfig.getCharset(), t, this.fastJsonConfig.getSerializeConfig(), this.fastJsonConfig.getSerializeFilters(), this.fastJsonConfig.getDateFormat(), JSON.DEFAULT_GENERATE_FEATURE, this.fastJsonConfig.getSerializerFeatures());
          } catch (Exception ex) {
              throw new SerializationException("Could not serialize: " + ex.getMessage(), (Throwable)ex);
          }
      }
  
      public T deserialize(byte[] bytes) throws SerializationException {
          if (bytes == null || bytes.length == 0) {
              return null;
          }
          try {
              return JSON.parseObject(bytes, this.fastJsonConfig.getCharset(), this.type, this.fastJsonConfig.getParserConfig(), this.fastJsonConfig.getParseProcess(), JSON.DEFAULT_PARSER_FEATURE, this.fastJsonConfig.getFeatures());
          } catch (Exception ex) {
              throw new SerializationException("Could not deserialize: " + ex.getMessage(), (Throwable)ex);
          }
      }
  }
  
  