Package com.aspectran.core.context.env
Class ActivityEnvironment
- java.lang.Object
-
- com.aspectran.core.context.env.ActivityEnvironment
-
- All Implemented Interfaces:
Environment
public class ActivityEnvironment extends java.lang.Object implements Environment
The Class ActivityEnvironment.
-
-
Constructor Summary
Constructors Constructor Description ActivityEnvironment(EnvironmentProfiles environmentProfiles, ActivityContext activityContext)
-
Method Summary
All Methods Instance Methods Concrete Methods 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
addPropertyItemRule(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)
Returns the value of the property on environment via the currently available activity.<T> T
getProperty(java.lang.String name, Activity activity)
Returns the value of the property on environment via the specified activity.ItemRuleMap
getPropertyItemRuleMap()
void
setPropertyItemRuleMap(ItemRuleMap propertyItemRuleMap)
-
-
-
Constructor Detail
-
ActivityEnvironment
public ActivityEnvironment(EnvironmentProfiles environmentProfiles, ActivityContext activityContext)
-
-
Method Detail
-
getActiveProfiles
public java.lang.String[] getActiveProfiles()
Description copied from interface:Environment
Returns the set of profiles explicitly made active for this environment.- Specified by:
getActiveProfiles
in interfaceEnvironment
- Returns:
- the set of profiles explicitly made active
-
getDefaultProfiles
public java.lang.String[] getDefaultProfiles()
Description copied from interface:Environment
Returns the set of profiles to be active by default when no active profiles have been set explicitly.- Specified by:
getDefaultProfiles
in interfaceEnvironment
- Returns:
- the set of profiles to be active by default
-
acceptsProfiles
public boolean acceptsProfiles(java.lang.String... profiles)
Description copied from interface:Environment
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. If a profile begins with '!' the logic is inverted, i.e. the method will return true if the given profile is not active. For example,env.acceptsProfiles("p1", "!p2")
will returntrue
if profile 'p1' is active or 'p2' is not active.- Specified by:
acceptsProfiles
in interfaceEnvironment
- Parameters:
profiles
- the given profiles- Returns:
- true if the given profile is active; false otherwise
- See Also:
Environment.getActiveProfiles()
,Environment.getDefaultProfiles()
-
getPropertyItemRuleMap
public ItemRuleMap getPropertyItemRuleMap()
-
setPropertyItemRuleMap
public void setPropertyItemRuleMap(ItemRuleMap propertyItemRuleMap)
-
addPropertyItemRule
public void addPropertyItemRule(ItemRuleMap propertyItemRuleMap)
-
getProperty
public <T> T getProperty(java.lang.String name)
Description copied from interface:Environment
Returns the value of the property on environment via the currently available activity.- Specified by:
getProperty
in interfaceEnvironment
- Type Parameters:
T
- the type of the value- Parameters:
name
- the given property name- Returns:
- the value of the property on environment
-
getProperty
public <T> T getProperty(java.lang.String name, Activity activity)
Description copied from interface:Environment
Returns the value of the property on environment via the specified activity.- Specified by:
getProperty
in interfaceEnvironment
- Type Parameters:
T
- the type of the value- Parameters:
name
- the given property nameactivity
- the activity- Returns:
- the value of the property on environment
-
-