protected SerializerJson<?> createSerializer(Class<?> cl)
  {
    SerializerJson<?> ser = _staticSerMap.get(cl);

    if (ser != null) {
      return ser;
    }

    TypeRef typeRef = TypeRef.of(cl);
    
    if (cl.isArray()) {
      Class<?> eltType = cl.getComponentType();
      
      return new ObjectArraySerializerJson(eltType, serializer(eltType));
    }
    
    Method methodReplaceObject = findWriteReplace(cl);
    
    if (methodReplaceObject != null) {
      return new JavaSerializerWriteReplace(methodReplaceObject);
    }
    
    CollectionFunction collFun = _factoryMap.get(cl);
    
    if (collFun != null) {
      return collFun.apply(typeRef, this);
    }
    
    if (Map.class.isAssignableFrom(cl)) {
      return new MapJavaSerializer(typeRef, this, cl);
    }
    else if (Collection.class.isAssignableFrom(cl)) {
      return new ListJavaSerializer(typeRef, this, cl);
    }
    /*
    if (Collection.class.isAssignableFrom(cl)) {
      return new CollectionSerializerJson(typeRef, this);
    }

    if (Map.class.isAssignableFrom(cl)) {
      return new MapSerializerJson(typeRef, this, HashMap::new);
    }
    */
    
    ser = findInterfaceSerializer(cl);
    
    if (ser != null) {
      return ser;
    }

    if (AtomicInteger.class.isAssignableFrom(cl)) {
      return AtomicIntegerSerializer.SER;
    }

    if (Enum.class.isAssignableFrom(cl)) {
      return EnumSerializer.SER;
    }
    
    try {
      Method valueOf = cl.getMethod("valueOf", String.class);
      
      if (Modifier.isStatic(valueOf.getModifiers())) {
          //&& cl.equals(valueOf.getReturnType())) {
        return new StringValueOfSerializer<>(cl, valueOf);
      }
    } catch (NoSuchMethodException e) {
      log.log(Level.ALL, e.toString(), e);
    }

    return new JavaSerializerJson(typeRef, this);
  }
protected SerializerJson < ? > createSerializer ( Class < ? > cl ) { SerializerJson < ? > ser = _staticSerMap . get ( cl ) ; if ( ser != null ) { return ser ; } TypeRef typeRef = TypeRef . of ( cl ) ; if ( cl . isArray ( ) ) { Class < ? > eltType = cl . getComponentType ( ) ; return new ObjectArraySerializerJson ( eltType , serializer ( eltType ) ) ; } Method methodReplaceObject = findWriteReplace ( cl ) ; if ( methodReplaceObject != null ) { return new JavaSerializerWriteReplace ( methodReplaceObject ) ; } CollectionFunction collFun = _factoryMap . get ( cl ) ; if ( collFun != null ) { return collFun . apply ( typeRef , this ) ; } if ( Map . class . isAssignableFrom ( cl ) ) { return new MapJavaSerializer ( typeRef , this , cl ) ; } else if ( Collection . class . isAssignableFrom ( cl ) ) { return new ListJavaSerializer ( typeRef , this , cl ) ; } ser = findInterfaceSerializer ( cl ) ; if ( ser != null ) { return ser ; } if ( AtomicInteger . class . isAssignableFrom ( cl ) ) { return AtomicIntegerSerializer . SER ; } if ( Enum . class . isAssignableFrom ( cl ) ) { return EnumSerializer . SER ; } try { Method valueOf = cl . getMethod ( "valueOf" , String . class ) ; if ( Modifier . isStatic ( valueOf . getModifiers ( ) ) ) { return new StringValueOfSerializer < > ( cl , valueOf ) ; } } catch ( NoSuchMethodException e ) { log . log ( Level . ALL , e . toString ( ) , e ) ; } return new JavaSerializerJson ( typeRef , this ) ; }
/*
public void addDeserializer(Class<?> cl,
SerializerJson deser)
{
_deserMap.put(cl, deser);
}