-
public abstract class AbstractConfigurationCreated by vincent on 17-1-17. Copyright @ 2013-2017 Platon AI. All rights reserved
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classAbstractConfiguration.Companion
-
Constructor Summary
Constructors Constructor Description AbstractConfiguration(String profile, Boolean loadDefaults, Iterable<String> resources)Create a ai.platon.pulsar.common.config.AbstractConfiguration. AbstractConfiguration(KConfiguration conf)Constructor for AbstractConfiguration.
-
Method Summary
Modifier and Type Method Description final StringgetName()final UnitsetName(String name)final StringgetProfile()final UnitsetProfile(String profile)final StringgetMode()final EnvironmentgetEnvironment()Spring core is the first class dependency now, we will remove dependency on KConfiguration later final UnitsetEnvironment(Environment environment)Spring core is the first class dependency now, we will remove dependency on KConfiguration later final BooleangetIsDryRun()final BooleangetIsDistributedFs()final KConfigurationunbox()unbox. final Integersize()The configured item size. Stringget(String name)Get the value of the nameproperty,nullif no such property exists.Stringget(String name, String defaultValue)Get the value of the name.final IntegergetInt(String name, Integer defaultValue)Get the value of the nameproperty as anint.final IntArraygetInts(String name)Get the value of the nameproperty as a set of comma-delimitedintvalues.final LonggetLong(String name, Long defaultValue)Get the value of the nameproperty as along.final FloatgetFloat(String name, Float defaultValue)Get the value of the nameproperty as afloat.final DoublegetDouble(String name, Double defaultValue)Get the value of the nameproperty as adouble.final BooleangetBoolean(String name, Boolean defaultValue)Get the value of the nameproperty as aboolean.final <T extends Enum<T>> TgetEnum(String name, T defaultValue)Return value matching this enumerated type. final Collection<String>getStringCollection(String name)Get the comma delimited values of the nameproperty as a collection ofStrings.final Array<String>getStrings(String name)Get the comma delimited values of the nameproperty as an array ofStrings.final Array<String>getStrings(String name, String defaultValue)Get the comma delimited values of the nameproperty as an array ofStrings.final Collection<String>getTrimmedStringCollection(String name)Get the comma delimited values of the nameproperty as a collection ofStrings, trimmed of the leading and trailing whitespace.final Array<String>getTrimmedStrings(String name)Get the comma delimited values of the nameproperty as an array ofStrings, trimmed of the leading and trailing whitespace.final Array<String>getTrimmedStrings(String name, String defaultValue)Get the comma delimited values of the nameproperty as an array ofStrings, trimmed of the leading and trailing whitespace.final IntegergetUint(String name, Integer defaultValue)Get an unsigned integer, if the configured value is negative or not set, return the default value final LonggetUlong(String name, Long defaultValue)Get a unsigned long integer, if the configured value is negative, return the default value final DurationgetDuration(String name)Support both ISO-8601 standard and hadoop time duration format ISO-8601 standard : PnDTnHnMn.nS Hadoop time duration format : Valid units are : ns, us, ms, s, m, h, d. final DurationgetDuration(String name, Duration defaultValue)getDuration. final InstantgetInstant(String name, Instant defaultValue)getInstant. final PathgetPath(String name, Path elsePath)getPath. final PathgetPathOrNull(String name)getPathOrNull. final Map<String, String>getKvs(String name)getKvs. final InputStreamgetConfResourceAsInputStream(String resource)getConfResourceAsInputStream. final ReadergetConfResourceAsReader(String resource)getConfResourceAsReader. final URLgetResource(String resource)getResource. final Class<?>getClass(String name, Class<?> defaultValue)Get the value of the nameproperty as aClass.final <U extends Any> Class<out U>getClass(String name, Class<out U> defaultValue, Class<U> xface)Get the value of the nameproperty as aClassimplementing the interface specified byxface.StringtoString()-
-
Constructor Detail
-
AbstractConfiguration
AbstractConfiguration(String profile, Boolean loadDefaults, Iterable<String> resources)
-
AbstractConfiguration
AbstractConfiguration(KConfiguration conf)
Constructor for AbstractConfiguration.
-
-
Method Detail
-
getProfile
final String getProfile()
-
setProfile
final Unit setProfile(String profile)
-
getEnvironment
final Environment getEnvironment()
Spring core is the first class dependency now, we will remove dependency on KConfiguration later
-
setEnvironment
final Unit setEnvironment(Environment environment)
Spring core is the first class dependency now, we will remove dependency on KConfiguration later
-
getIsDryRun
final Boolean getIsDryRun()
-
getIsDistributedFs
final Boolean getIsDistributedFs()
-
unbox
final KConfiguration unbox()
unbox.
-
get
String get(String name)
Get the value of the
nameproperty,nullif no such property exists. If the key is deprecated, it returns the value of the first key which replaces the deprecated key and is not null.Values are processed for #VariableExpansion before being returned.
- Parameters:
name- the property name, will be trimmed before get value.
-
get
String get(String name, String defaultValue)
Get the value of the
name. If the key is deprecated, it returns the value of the first key which replaces the deprecated key and is not null. If no such property exists, thendefaultValueis returned.- Parameters:
name- property name, will be trimmed before get value.defaultValue- default value.
-
getInt
final Integer getInt(String name, Integer defaultValue)
Get the value of the
nameproperty as anint.If no such property exists, the provided default value is returned, or if the specified value is not a valid
int, then an error is thrown.- Parameters:
name- property name.defaultValue- default value.
-
getInts
final IntArray getInts(String name)
Get the value of the
nameproperty as a set of comma-delimitedintvalues.If no such property exists, an empty array is returned.
- Parameters:
name- property name
-
getLong
final Long getLong(String name, Long defaultValue)
Get the value of the
nameproperty as along. If no such property exists, the provided default value is returned, or if the specified value is not a validlong, then an error is thrown.- Parameters:
name- property name.defaultValue- default value.
-
getFloat
final Float getFloat(String name, Float defaultValue)
Get the value of the
nameproperty as afloat. If no such property exists, the provided default value is returned, or if the specified value is not a validfloat, then an error is thrown.- Parameters:
name- property name.defaultValue- default value.
-
getDouble
final Double getDouble(String name, Double defaultValue)
Get the value of the
nameproperty as adouble. If no such property exists, the provided default value is returned, or if the specified value is not a validdouble, then an error is thrown.- Parameters:
name- property name.defaultValue- default value.
-
getBoolean
final Boolean getBoolean(String name, Boolean defaultValue)
Get the value of the
nameproperty as aboolean. If no such property is specified, or if the specified value is not a validboolean, thendefaultValueis returned.- Parameters:
name- property name.defaultValue- default value.
-
getEnum
final <T extends Enum<T>> T getEnum(String name, T defaultValue)
Return value matching this enumerated type.
- Parameters:
name- Property namedefaultValue- Value returned if no mapping exists
-
getStringCollection
final Collection<String> getStringCollection(String name)
Get the comma delimited values of the
nameproperty as a collection ofStrings. If no such property is specified then empty collection is returned.This is an optimized version of .getStrings
- Parameters:
name- property name.
-
getStrings
final Array<String> getStrings(String name)
Get the comma delimited values of the
nameproperty as an array ofStrings. If no such property is specified thennullis returned.- Parameters:
name- property name.
-
getStrings
final Array<String> getStrings(String name, String defaultValue)
Get the comma delimited values of the
nameproperty as an array ofStrings. If no such property is specified then default value is returned.- Parameters:
name- property name.defaultValue- The default value
-
getTrimmedStringCollection
final Collection<String> getTrimmedStringCollection(String name)
Get the comma delimited values of the
nameproperty as a collection ofStrings, trimmed of the leading and trailing whitespace. If no such property is specified then emptyCollectionis returned.- Parameters:
name- property name.
-
getTrimmedStrings
final Array<String> getTrimmedStrings(String name)
Get the comma delimited values of the
nameproperty as an array ofStrings, trimmed of the leading and trailing whitespace. If no such property is specified then an empty array is returned.- Parameters:
name- property name.
-
getTrimmedStrings
final Array<String> getTrimmedStrings(String name, String defaultValue)
Get the comma delimited values of the
nameproperty as an array ofStrings, trimmed of the leading and trailing whitespace. If no such property is specified then default value is returned.- Parameters:
name- property name.defaultValue- The default value
-
getUint
final Integer getUint(String name, Integer defaultValue)
Get an unsigned integer, if the configured value is negative or not set, return the default value
- Parameters:
name- The property namedefaultValue- The default value return if the configured value is negative
-
getUlong
final Long getUlong(String name, Long defaultValue)
Get a unsigned long integer, if the configured value is negative, return the default value
- Parameters:
name- The property namedefaultValue- The default value return if the configured value is negative
-
getDuration
final Duration getDuration(String name)
Support both ISO-8601 standard and hadoop time duration format ISO-8601 standard : PnDTnHnMn.nS Hadoop time duration format : Valid units are : ns, us, ms, s, m, h, d.
- Parameters:
name- a java.lang.String object.
-
getDuration
final Duration getDuration(String name, Duration defaultValue)
getDuration.
- Parameters:
name- a java.lang.String object.defaultValue- a java.time.Duration object.
-
getInstant
final Instant getInstant(String name, Instant defaultValue)
getInstant.
- Parameters:
name- a java.lang.String object.defaultValue- a java.time.Instant object.
-
getPath
final Path getPath(String name, Path elsePath)
getPath.
- Parameters:
name- a java.lang.String object.elsePath- a java.nio.file.Path object.
-
getPathOrNull
final Path getPathOrNull(String name)
getPathOrNull.
- Parameters:
name- a java.lang.String object.
-
getKvs
final Map<String, String> getKvs(String name)
getKvs.
- Parameters:
name- a java.lang.String object.
-
getConfResourceAsInputStream
final InputStream getConfResourceAsInputStream(String resource)
getConfResourceAsInputStream.
- Parameters:
resource- a java.lang.String object.
-
getConfResourceAsReader
final Reader getConfResourceAsReader(String resource)
getConfResourceAsReader.
- Parameters:
resource- a java.lang.String object.
-
getResource
final URL getResource(String resource)
getResource.
- Parameters:
resource- a java.lang.String object.
-
getClass
final Class<?> getClass(String name, Class<?> defaultValue)
Get the value of the
nameproperty as aClass. If no such property is specified, thendefaultValueis returned.- Parameters:
name- the class name.defaultValue- default value.
-
getClass
final <U extends Any> Class<out U> getClass(String name, Class<out U> defaultValue, Class<U> xface)
Get the value of the
nameproperty as aClassimplementing the interface specified byxface.If no such property is specified, then
defaultValueis returned.An exception is thrown if the returned class does not implement the named interface.
- Parameters:
name- the class name.defaultValue- default value.xface- the interface implemented by the named class.
-
-
-
-