Package com.aspectran.core.context.env
Class ActivityEnvironment
java.lang.Object
com.aspectran.core.context.env.ActivityEnvironment
- All Implemented Interfaces:
Environment
The Class ActivityEnvironment.
-
Constructor Summary
ConstructorsConstructorDescriptionActivityEnvironment
(ActivityContext context, EnvironmentProfiles environmentProfiles) -
Method Summary
Modifier and TypeMethodDescriptionboolean
acceptsProfiles
(Profiles profiles) Determine whether the givenProfiles
predicate matches the active profiles — or in the case of no explicit active profiles, whether the givenProfiles
predicate matches the default profiles.boolean
acceptsProfiles
(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
addActiveProfile
(String profile) Add a profile to the current set of active profiles.void
addPropertyItemRule
(ItemRuleMap propertyItemRuleMap) String[]
Return the set of profiles explicitly made active for this environment.String[]
Return the set of profiles explicitly made active for this environment.String[]
Return the set of profiles to be active by default when no active profiles have been set explicitly.<T> T
getProperty
(String name) Returns the value of the property on environment via the currently available activity.<T> T
getProperty
(String name, Activity activity) Returns the value of the property on environment via the specified activity.boolean
matchesProfiles
(String profileExpression) Determine whether one of the given profile expressions matches the active profiles — or in the case of no explicit active profiles, whether one of the given profile expressions matches the default profiles.void
setPropertyItemRuleMap
(ItemRuleMap propertyItemRuleMap)
-
Constructor Details
-
ActivityEnvironment
-
-
Method Details
-
getActiveProfiles
Description copied from interface:Environment
Return the set of profiles explicitly made active for this environment. Profiles are used for creating logical groupings of bean definitions to be registered conditionally, for example based on deployment environment. Profiles can be activated by setting "aspectran.profiles.active" as a system property or by callingEnvironmentProfiles.setActiveProfiles(String...)
.If no profiles have explicitly been specified as active, then any default profiles will automatically be activated.
-
getDefaultProfiles
Description copied from interface:Environment
Return the set of profiles to be active by default when no active profiles have been set explicitly. -
getCurrentProfiles
Description copied from interface:Environment
Return the set of profiles explicitly made active for this environment. If no active profile is explicitly set, returns the set of profiles to be active by default. -
matchesProfiles
Description copied from interface:Environment
Determine whether one of the given profile expressions matches the active profiles — or in the case of no explicit active profiles, whether one of the given profile expressions matches the default profiles.Profile expressions allow for complex, boolean profile logic to be expressed — for example
"p1 & p2"
,"(p1 & p2) | p3"
, etc. SeeProfiles.of(String)
for details on the supported expression syntax.This method is a convenient shortcut for
env.acceptsProfiles(Profiles.of(profileExpression))
.- Specified by:
matchesProfiles
in interfaceEnvironment
- See Also:
-
acceptsProfiles
Description copied from interface:Environment
Determine whether the givenProfiles
predicate matches the active profiles — or in the case of no explicit active profiles, whether the givenProfiles
predicate matches the default profiles.If you wish provide profile expressions directly as strings, use
Environment.matchesProfiles(String)
instead.- Specified by:
acceptsProfiles
in interfaceEnvironment
- See Also:
-
acceptsProfiles
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:
-
addActiveProfile
Description copied from interface:Environment
Add a profile to the current set of active profiles.- Specified by:
addActiveProfile
in interfaceEnvironment
-
getPropertyItemRuleMap
-
setPropertyItemRuleMap
-
addPropertyItemRule
-
getProperty
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
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
-