Class PulsarConfigurationLoader
- java.lang.Object
-
- org.apache.pulsar.common.configuration.PulsarConfigurationLoader
-
public class PulsarConfigurationLoader extends java.lang.ObjectLoads ServiceConfiguration with properties.
-
-
Constructor Summary
Constructors Constructor Description PulsarConfigurationLoader()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ServiceConfigurationconvertFrom(PulsarConfiguration conf)static ServiceConfigurationconvertFrom(PulsarConfiguration conf, boolean ignoreNonExistMember)Converts a PulsarConfiguration object to a ServiceConfiguration object.static <T extends PulsarConfiguration>
Tcreate(java.io.InputStream inStream, java.lang.Class<? extends PulsarConfiguration> clazz)Creates PulsarConfiguration and loads it with populated attribute values loaded from provided inputstream property file.static <T extends PulsarConfiguration>
Tcreate(java.lang.String configFile, java.lang.Class<? extends PulsarConfiguration> clazz)Creates PulsarConfiguration and loads it with populated attribute values loaded from provided property file.static <T extends PulsarConfiguration>
Tcreate(java.util.Properties properties, java.lang.Class<? extends PulsarConfiguration> clazz)Creates PulsarConfiguration and loads it with populated attribute values from provided Properties object.static booleanisComplete(java.lang.Object obj)ValidatesFieldContextannotation on each field of the class element.
-
-
-
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.IOExceptionjava.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.IOExceptionjava.lang.IllegalArgumentException
-
isComplete
public static boolean isComplete(java.lang.Object obj) throws java.lang.IllegalArgumentExceptionValidatesFieldContextannotation 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 toFieldContextconstraints.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
-
convertFrom
public static ServiceConfiguration convertFrom(PulsarConfiguration conf) throws java.lang.RuntimeException
- Throws:
java.lang.RuntimeException
-
-