Class PulsarConfigurationLoader


  • public class PulsarConfigurationLoader
    extends java.lang.Object
    Loads ServiceConfiguration with properties.
    • Constructor Detail

      • PulsarConfigurationLoader

        public PulsarConfigurationLoader()
    • Method Detail

      • create

        public static <T extends PulsarConfiguration> T create​(java.lang.String configFile,
                                                               java.lang.Class<? extends PulsarConfiguration> clazz)
                                                        throws java.io.IOException,
                                                               java.lang.IllegalArgumentException
        Creates PulsarConfiguration and loads it with populated attribute values loaded from provided property file.
        Parameters:
        configFile -
        Throws:
        java.io.IOException
        java.lang.IllegalArgumentException
      • create

        public static <T extends PulsarConfiguration> T create​(java.io.InputStream inStream,
                                                               java.lang.Class<? extends PulsarConfiguration> clazz)
                                                        throws java.io.IOException,
                                                               java.lang.IllegalArgumentException
        Creates PulsarConfiguration and loads it with populated attribute values loaded from provided inputstream property file.
        Parameters:
        inStream -
        Throws:
        java.io.IOException - if an error occurred when reading from the input stream.
        java.lang.IllegalArgumentException - if the input stream contains incorrect value type
      • create

        public static <T extends PulsarConfiguration> T create​(java.util.Properties properties,
                                                               java.lang.Class<? extends PulsarConfiguration> clazz)
                                                        throws java.io.IOException,
                                                               java.lang.IllegalArgumentException
        Creates PulsarConfiguration and loads it with populated attribute values from provided Properties object.
        Parameters:
        properties - The properties to populate the attributed from
        Throws:
        java.io.IOException
        java.lang.IllegalArgumentException
      • isComplete

        public static boolean isComplete​(java.lang.Object obj)
                                  throws java.lang.IllegalArgumentException
        Validates FieldContext annotation on each field of the class element. If element is annotated required and value of the element is null or number value is not in a provided (min,max) range then consider as incomplete object and throws exception with incomplete parameters
        Parameters:
        obj -
        Returns:
        Throws:
        java.lang.IllegalArgumentException - if object is field values are not completed according to FieldContext constraints.
        java.lang.IllegalAccessException
      • convertFrom

        public static ServiceConfiguration convertFrom​(PulsarConfiguration conf,
                                                       boolean ignoreNonExistMember)
                                                throws java.lang.RuntimeException
        Converts a PulsarConfiguration object to a ServiceConfiguration object.
        Parameters:
        conf -
        ignoreNonExistMember -
        Returns:
        Throws:
        java.lang.IllegalArgumentException - if conf has the field whose name is not contained in ServiceConfiguration and ignoreNonExistMember is false.
        java.lang.RuntimeException