Class JacksonConfigManager


  • public class JacksonConfigManager
    extends Object
    • Constructor Detail

      • JacksonConfigManager

        @Inject
        public JacksonConfigManager​(ConfigManager configManager,
                                    com.fasterxml.jackson.databind.ObjectMapper jsonMapper,
                                    com.fasterxml.jackson.databind.ObjectMapper jsonMapperOnlyNonNullValue,
                                    AuditManager auditManager)
    • Method Detail

      • watch

        public <T> AtomicReference<T> watch​(String key,
                                            com.fasterxml.jackson.core.type.TypeReference<T> clazz,
                                            T defaultVal)
      • convertByteToConfig

        public <T> T convertByteToConfig​(byte[] configInByte,
                                         Class<? extends T> clazz,
                                         T defaultVal)
      • set

        public <T> ConfigManager.SetResult set​(String key,
                                               T val,
                                               AuditInfo auditInfo)
        Set the config and add audit entry
        Parameters:
        key - of the config to set
        val - new config value to insert
        auditInfo - metadata regarding the change to config, for audit purposes
      • set

        public <T> ConfigManager.SetResult set​(String key,
                                               @Nullable
                                               byte[] oldValue,
                                               T newValue,
                                               AuditInfo auditInfo)
        Set the config and add audit entry
        Parameters:
        key - of the config to set
        oldValue - old config value. If not null, then the update will only succeed if the insert happens when current database entry is the same as this value. Note that the current database entry (in array of bytes) have to be exactly the same as the array of bytes of this value for update to succeed. If null, then the insert will not consider the current database entry. Note that this field intentionally uses byte array to be resilient across serde of existing data retrieved from the database (instead of Java object which may have additional fields added as a result of serde)
        newValue - new config value to insert
        auditInfo - metadata regarding the change to config, for audit purposes