Class ConfigMapper


  • public class ConfigMapper
    extends Object
    Utility for applying Typesafe configurations to Atomix configuration objects.
    • Constructor Detail

      • ConfigMapper

        public ConfigMapper​(ClassLoader classLoader)
    • Method Detail

      • loadFiles

        public <T> T loadFiles​(Class<T> type,
                               List<File> files,
                               List<String> resources)
        Loads the given configuration file using the mapper, falling back to the given resources.
        Type Parameters:
        T - the resulting type
        Parameters:
        type - the type to load
        files - the files to load
        resources - the resources to which to fall back
        Returns:
        the loaded configuration
      • loadResources

        public <T> T loadResources​(Class<T> type,
                                   String... resources)
        Loads the given resources using the configuration mapper.
        Type Parameters:
        T - the resulting type
        Parameters:
        type - the type to load
        resources - the resources to load
        Returns:
        the loaded configuration
      • loadResources

        public <T> T loadResources​(Class<T> type,
                                   List<String> resources)
        Loads the given resources using the configuration mapper.
        Type Parameters:
        T - the resulting type
        Parameters:
        type - the type to load
        resources - the resources to load
        Returns:
        the loaded configuration
      • map

        protected <T> T map​(com.typesafe.config.Config config,
                            Class<T> clazz)
        Applies the given configuration to the given type.
        Parameters:
        config - the configuration to apply
        clazz - the class to which to apply the configuration
      • newInstance

        protected <T> T newInstance​(com.typesafe.config.Config config,
                                    String key,
                                    Class<T> clazz)
      • map

        protected <T> T map​(com.typesafe.config.Config config,
                            String path,
                            String name,
                            Class<T> clazz)
        Applies the given configuration to the given type.
        Parameters:
        config - the configuration to apply
        clazz - the class to which to apply the configuration
      • checkRemainingProperties

        protected void checkRemainingProperties​(Set<String> missingProperties,
                                                List<String> availableProperties,
                                                String path,
                                                Class<?> clazz)
      • getValue

        protected Object getValue​(Class<?> beanClass,
                                  Type parameterType,
                                  Class<?> parameterClass,
                                  com.typesafe.config.Config config,
                                  String configPath,
                                  String configPropName)
      • getMapValue

        protected Map getMapValue​(Class<?> beanClass,
                                  Type parameterType,
                                  Class<?> parameterClass,
                                  com.typesafe.config.Config config,
                                  String configPath,
                                  String configPropName)
      • getSetValue

        protected Object getSetValue​(Class<?> beanClass,
                                     Type parameterType,
                                     Class<?> parameterClass,
                                     com.typesafe.config.Config config,
                                     String configPath,
                                     String configPropName)
      • getListValue

        protected Object getListValue​(Class<?> beanClass,
                                      Type parameterType,
                                      Class<?> parameterClass,
                                      com.typesafe.config.Config config,
                                      String configPath,
                                      String configPropName)
      • isSimpleType

        protected static boolean isSimpleType​(Class<?> parameterClass)
      • toCamelCase

        protected static String toCamelCase​(String originalName)
      • toSetterName

        protected static String toSetterName​(String name)