Class StringCodecFactory

java.lang.Object
org.hippoecm.repository.api.StringCodecFactory

public class StringCodecFactory extends Object
The StringCodecFactory allows you access to symbolic named StringCodec's. Typically a single instance of the StringCodecFactory is stored in the application framework.
  • Constructor Details

    • StringCodecFactory

      public StringCodecFactory(Map<String,StringCodec> codecs)
      Initialized a StringCodecFactory with the given and fixed StringCodec mappings.
      Parameters:
      codecs - a map of codecs to bind to their symbolic names. The map becomes immutable.
  • Method Details

    • getStringCodec

      public StringCodec getStringCodec()
      Requests the default encoder to use.
      Returns:
      returns the fall-back or default encoder to use, or null if non was defined.
    • getStringCodec

      public StringCodec getStringCodec(String encoding)
      Requests which encoder to use for the given symbolic name.
      Parameters:
      encoding - the symbolic name of the encoder that is requested
      Returns:
      the StringCodec to use, which might be a fall-back encoder or null if non was defined.
    • getStringCodec

      public StringCodec getStringCodec(String encoding, String locale)
      Requests which encoder to use for the given symbolic name and locale. If a locale is defined as language_country, e.g. en_GB, it will first try language_country and then language.
      Parameters:
      encoding - the symbolic name of the encoder that is requested
      locale - the locale for the requested codec
      Returns:
      the StringCodec to use, which might be a fall-back encoder or null if non was defined.