Class EntityCodecUtils

java.lang.Object
org.aksw.commons.codec.entity.util.EntityCodecUtils

public class EntityCodecUtils extends Object
  • Constructor Details

    • EntityCodecUtils

      public EntityCodecUtils()
  • Method Details

    • harmonize

      public static <T> T harmonize(T entity, Supplier<? extends EntityCodec<T>> codecSupplier)
    • harmonize

      public static <T> T harmonize(T entity, EntityCodec<T> codec)
      Apply decoding to an entity (if applicable) then return the encoded entity Main use case is to remove non-canonical quotes from a strings and then return a new one with canonical quotes.
    • reencode

      public static <T> T reencode(T entity, Supplier<? extends EntityCodec<T>> decodecSupplier, Supplier<? extends EntityCodec<T>> encodecSupplier)
    • reencode

      public static <T> T reencode(T entity, EntityCodec<T> decodec, EntityCodec<T> encodec)
      If the entity can be decoded with 'decoder' then do so and apply encoder.encode afterwards. If the entity cannot be decoded then return it unchanged. Useful to change e.g. quoting from double quotes to backticks