EnvironmentContextEnvironmentpublic abstract class AbstractEnvironment extends java.lang.Object implements Environment
Environment implementations.| Constructor | Description |
|---|---|
AbstractEnvironment() |
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
acceptsProfiles(java.lang.String... profiles) |
Return whether one or more of the given profiles is active or, in the case of no
explicit active profiles, whether one or more of the given profiles is included in
the set of default profiles.
|
void |
addPropertyItemRuleMap(ItemRuleMap propertyItemRuleMap) |
|
java.lang.String[] |
getActiveProfiles() |
Returns the set of profiles explicitly made active for this environment.
|
java.lang.String[] |
getDefaultProfiles() |
Returns the set of profiles to be active by default when no active profiles have
been set explicitly.
|
<T> T |
getProperty(java.lang.String name,
Activity activity) |
|
ItemRuleMap |
getPropertyItemRuleMap() |
|
void |
setActiveProfiles(java.lang.String... profiles) |
Specify the set of profiles active for this
Environment. |
void |
setDefaultProfiles(java.lang.String... profiles) |
Specify the set of profiles to be made active by default if no other profiles
are explicitly made active through
setActiveProfiles(java.lang.String...). |
void |
setPropertyItemRuleMap(ItemRuleMap propertyItemRuleMap) |
|
protected void |
validateProfile(java.lang.String profile) |
Validate the given profile, called internally prior to adding to the set of
active or default profiles.
|
getApplicationAdapter, getBasePath, getClassLoader, toRealPath, toRealPathAsFilepublic java.lang.String[] getActiveProfiles()
EnvironmentgetActiveProfiles in interface Environmentpublic void setActiveProfiles(java.lang.String... profiles)
Environment.
Profiles are evaluated during the ActivityContext configuration to determine
whether configuration settings or rules should be registered.
Any existing active profiles will be replaced with the given arguments; call with zero arguments to clear the current set of active profiles.
profiles - the set of profiles activejava.lang.IllegalArgumentException - if any profile is null, empty or whitespace-onlysetDefaultProfiles(java.lang.String...)public java.lang.String[] getDefaultProfiles()
EnvironmentgetDefaultProfiles in interface Environmentpublic void setDefaultProfiles(java.lang.String... profiles)
setActiveProfiles(java.lang.String...).
Calling this method removes overrides any reserved default profiles that may have been added during construction of the environment.
profiles - the set of profiles to be made active by defaultpublic boolean acceptsProfiles(java.lang.String... profiles)
Environmentenv.acceptsProfiles("p1", "!p2") will
return true if profile 'p1' is active or 'p2' is not active.acceptsProfiles in interface Environmentprofiles - the given profilesEnvironment.getActiveProfiles(),
Environment.getDefaultProfiles()protected void validateProfile(java.lang.String profile)
Subclasses may override to impose further restrictions on profile syntax.
profile - the given profilejava.lang.IllegalArgumentException - if the profile is null, empty, whitespace-only or
begins with the profile NOT operator (!)acceptsProfiles(java.lang.String...),
setDefaultProfiles(java.lang.String...)public ItemRuleMap getPropertyItemRuleMap()
public void setPropertyItemRuleMap(ItemRuleMap propertyItemRuleMap)
public void addPropertyItemRuleMap(ItemRuleMap propertyItemRuleMap)
public <T> T getProperty(java.lang.String name,
Activity activity)
getProperty in interface EnvironmentCopyright © 2008–2018 The Aspectran Project. All rights reserved.