Environment
ContextEnvironment
public 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, toRealPathAsFile
public java.lang.String[] getActiveProfiles()
Environment
getActiveProfiles
in interface Environment
public 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()
Environment
getDefaultProfiles
in interface Environment
public 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)
Environment
env.acceptsProfiles("p1", "!p2")will return
true
if profile 'p1' is active or 'p2' is not active.acceptsProfiles
in interface Environment
profiles
- 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 Environment
Copyright © 2008–2018 The Aspectran Project. All rights reserved.