Class PolicyContext
java.lang.Object
com.broadleafcommerce.data.tracking.core.policy.PolicyContext
A thread context to keep track of
Policy
aspects during validation. This facilitates
inheritance of properties from parent Policy declarations during the flow of validation. For
example, an initial Policy annotation could declare Policy.permissionRoots()
, which are
inherited by other Policy declarations on a more generic service that might only declare
Policy.operationTypes()
.- Author:
- Jeff Fischer
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
static void
Embellish the currentPolicyInformation
with any inherited information from a parent PolicyInformation instance in logic flow.boolean
static PolicyContext
Policy validation flows may "stack" as a codepath progresses, and become more derived viaderivePolicyInformation(PolicyInformation)
.int
hashCode()
void
setContextPolicies
(Map<String, PolicyInformation> contextPolicies) toString()
-
Constructor Details
-
PolicyContext
public PolicyContext()
-
-
Method Details
-
derivePolicyInformation
Embellish the currentPolicyInformation
with any inherited information from a parent PolicyInformation instance in logic flow.- Parameters:
start
- The current PolicyInformation instance- Returns:
- The embellished PolicyInformation instance
-
getContext
-
getMostDerivedPolicyInformation
Policy validation flows may "stack" as a codepath progresses, and become more derived viaderivePolicyInformation(PolicyInformation)
. This is a convenience method that can be used to get the "last" or "most derived" policy information fromgetContextPolicies()
.- Returns:
- the "last" or "most derived" policy information from
getContextPolicies()
. IfgetContextPolicies()
is empty, this will returnnull
.
-
clear
-
getContextPolicies
-
setContextPolicies
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-