+ private static ArrayList<String> getSortedKeysByDatastoreType(final Collection<String> inKeys,
+ final String dataStoreTypePrefix) {
+ // Sort the property keys by putting the names prefixed with the data store type last. This
+ // is done so data store specific settings are applied after global settings.
+ final ArrayList<String> keys = new ArrayList<>(inKeys);
+ keys.sort((key1, key2) -> key1.startsWith(dataStoreTypePrefix) ? 1 :
+ key2.startsWith(dataStoreTypePrefix) ? -1 : key1.compareTo(key2));
+ return keys;
+ }
+
+ @SuppressWarnings("checkstyle:IllegalCatch")
+ private boolean convertValueAndInvokeSetter(final String inKey, final Object inValue, final Builder builder) {
+ final String key = convertToCamelCase(inKey);
+
+ try {
+ // Convert the value to the right type.
+ final Object value = convertValue(key, inValue);
+ if (value == null) {
+ return false;
+ }
+
+ LOG.debug("Converted value for property {}: {} ({})",
+ key, value, value.getClass().getSimpleName());
+
+ // Call the setter method on the Builder instance.
+ final Method setter = BUILDER_SETTERS.get(key);
+ setter.invoke(builder, constructorValueRecursively(
+ Primitives.wrap(setter.getParameterTypes()[0]), value.toString()));
+
+ return true;
+ } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
+ | InstantiationException e) {
+ LOG.error("Error converting value ({}) for property {}", inValue, key, e);
+ }
+
+ return false;
+ }
+
+ private static String convertToCamelCase(final String inString) {