code: public static <V, T extends Tag> T convertToTag(String name, V value) throws ConversionException {
          if(value == null) {
              return null;
          }
  
          TagConverter<T, V> converter = (TagConverter<T, V>) typeToConverter.get(value.getClass());
          if(converter == null) {
              for(Class<?> clazz : getAllClasses(value.getClass())) {
                  if(typeToConverter.containsKey(clazz)) {
                      try {
                          converter = (TagConverter<T, V>) typeToConverter.get(clazz);
                          break;
                      } catch(ClassCastException e) {
                      }
                  }
              }
          }
  
          if(converter == null) {
              throw new ConversionException("Value type " + value.getClass().getName() + " has no converter.");
          }
  
          return converter.convert(name, value);
      }
docs: Converts the given value to a tag.
  
  @param <V>   Value type to convert from.
  @param <T>   Tag type to convert to.
  @param name  Name of the resulting tag.
  @param value Value to convert.
  @return The converted tag.
  @throws ConversionException If a suitable converter could not be found.