public class AndHow extends Object implements StaticPropertyConfiguration, ValidatedValues
AndHow.findConfig().setCmdLineArgs(myCmdLineArgs).build();
findConfig() finds the AndHowConfiguration that
would be used if AndHow.instance() was called. build()
then causes the AndHow instance to be built with that modified configuration.
The code above (or any method of AndHow initiation) can only be executed once
during the life of the application.| Modifier and Type | Field and Description |
|---|---|
static String |
ANDHOW_INLINE_NAME |
static String |
ANDHOW_NAME |
static String |
ANDHOW_TAG_LINE |
static String |
ANDHOW_URL |
EMPTY_PROPERTY_LIST| Modifier and Type | Method and Description |
|---|---|
boolean |
containsUserGroups()
Returns true if any of the registered groups are user groups.
|
static AndHowConfiguration<? extends AndHowConfiguration> |
findConfig()
Finds and creates a new instance of the
AndHowConfiguration
that would be used if AndHow.instance() was called. |
List<EffectiveName> |
getAliases(Property<?> property)
Returns all aliases (in and out) for a property.
|
String |
getCanonicalName(Property<?> prop)
Returns the canonical name of a registered property.
|
<T> T |
getExplicitValue(Property<T> prop)
The value found and loaded for this value by a Loader.
|
List<ExportGroup> |
getExportGroups()
The list of ExportGroups, which handles exporting property values for use
outside the AndHow framework.
|
GroupProxy |
getGroupForProperty(Property<?> prop)
Finds the Group containing the specified Property.
|
NamingStrategy |
getNamingStrategy()
Defines how names are created for Properties.
|
List<Property<?>> |
getProperties()
Returns a complete list of all registered properties.
|
List<Property<?>> |
getPropertiesForGroup(GroupProxy group)
Returns a list of Properties registered in the passed group.
|
Property<?> |
getProperty(String name)
Finds a registered property by any recognized classpath style name,
including the canonical name or 'in' aliases.
|
List<GroupProxy> |
getPropertyGroups()
Returns a list of all registered groups.
|
<T> T |
getValue(Property<T> prop)
The effective value, similar to Property.getValue, but specifically for
the context of this ValueMap.
|
static AndHow |
instance()
Returns the current AndHow instance.
|
static AndHow |
instance(AndHowConfiguration config)
Builds a new AndHow instance using the specified configuration ONLY IF
there is no existing AndHow instance.
|
boolean |
isExplicitlySet(Property<?> prop)
Returns true if the Property's value was explicitly set to a non-null value
via one of the loaders.
|
static boolean |
isInitialize()
Determine if AndHow is initialized or not w/out forcing AndHow to load.
|
public static final String ANDHOW_INLINE_NAME
public static final String ANDHOW_NAME
public static final String ANDHOW_URL
public static final String ANDHOW_TAG_LINE
public static AndHowConfiguration<? extends AndHowConfiguration> findConfig()
AndHowConfiguration
that would be used if AndHow.instance() was called.
Note: If AndHow.instance() is later called, a new
AndHowConfiguration will be returned, not this same instance.
This method provides a way to add command line parameters or fixed values
to the existing configuration and then immediately initiate AndHow.
Example usage:
AndHow.findConfig().setCmdLineArgs(myCmdLineArgs).build();
The call to build() at the end of that command string is
just a convenience method to call AndHow.instance(thisConfiguration);public static AndHow instance() throws AppFatalException
AppFatalExceptionpublic static AndHow instance(AndHowConfiguration config) throws AppFatalException
config - AppFatalExceptionpublic static boolean isInitialize()
public boolean isExplicitlySet(Property<?> prop)
ValidatedValuesisExplicitlySet in interface ValidatedValuesprop - The property to checkpublic <T> T getExplicitValue(Property<T> prop)
ValidatedValuesgetExplicitValue in interface ValidatedValuesT - The return type of the Property.prop - The property to get the value forpublic <T> T getValue(Property<T> prop)
ValidatedValuesgetValue in interface ValidatedValuesT - The return type of the Property.prop - The property to get the value for.public List<EffectiveName> getAliases(Property<?> property)
StaticPropertyConfigurationgetAliases in interface StaticPropertyConfigurationproperty - The property to fetch naming information forpublic String getCanonicalName(Property<?> prop)
StaticPropertyConfigurationgetCanonicalName in interface StaticPropertyConfigurationprop - The property to get the canonical name forpublic GroupProxy getGroupForProperty(Property<?> prop)
StaticPropertyConfigurationgetGroupForProperty in interface StaticPropertyConfigurationprop - The property to get the PropertyGroup forpublic List<Property<?>> getPropertiesForGroup(GroupProxy group)
StaticPropertyConfigurationgetPropertiesForGroup in interface StaticPropertyConfigurationgroup - The group to get Properties forpublic Property<?> getProperty(String name)
StaticPropertyConfigurationmy.property and the URI style name, like my/property.
The URI style name is just a means of reading properties in another system -
for AndHow the URI style name is not considered an actual name.getProperty in interface StaticPropertyConfigurationname - A path to a property in the classpath style.public List<GroupProxy> getPropertyGroups()
StaticPropertyConfigurationgetPropertyGroups in interface StaticPropertyConfigurationpublic boolean containsUserGroups()
StaticPropertyConfigurationcontainsUserGroups in interface StaticPropertyConfigurationpublic List<Property<?>> getProperties()
StaticPropertyConfigurationgetProperties in interface StaticPropertyConfigurationpublic List<ExportGroup> getExportGroups()
StaticPropertyConfigurationgetExportGroups in interface StaticPropertyConfigurationpublic NamingStrategy getNamingStrategy()
StaticPropertyConfigurationgetNamingStrategy in interface StaticPropertyConfigurationCopyright © 2017. All rights reserved.