Class PolicyContext
- java.lang.Object
-
- com.broadleafcommerce.data.tracking.core.policy.PolicyContext
-
public class PolicyContext extends Object
A thread context to keep track ofPolicy
aspects during validation. This facilitates inheritance of properties from parent Policy declarations during the flow of validation. For example, an initial Policy annotation could declarePolicy.permissionRoots()
, which are inherited by other Policy declarations on a more generic service that might only declarePolicy.operationTypes()
.- Author:
- Jeff Fischer
-
-
Constructor Summary
Constructors Constructor Description PolicyContext()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
canEqual(Object other)
static void
clear(String signature)
PolicyInformation
derivePolicyInformation(PolicyInformation start)
Embellish the currentPolicyInformation
with any inherited information from a parent PolicyInformation instance in logic flow.boolean
equals(Object o)
static PolicyContext
getContext()
Map<String,PolicyInformation>
getContextPolicies()
PolicyInformation
getMostDerivedPolicyInformation()
Policy validation flows may "stack" as a codepath progresses, and become more derived viaderivePolicyInformation(PolicyInformation)
.int
hashCode()
void
setContextPolicies(Map<String,PolicyInformation> contextPolicies)
String
toString()
-
-
-
Method Detail
-
derivePolicyInformation
public PolicyInformation derivePolicyInformation(PolicyInformation start)
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
public static PolicyContext getContext()
-
getMostDerivedPolicyInformation
@Nullable public PolicyInformation 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
public static void clear(String signature)
-
getContextPolicies
public Map<String,PolicyInformation> getContextPolicies()
-
setContextPolicies
public void setContextPolicies(Map<String,PolicyInformation> contextPolicies)
-
canEqual
protected boolean canEqual(Object other)
-
-