Class PolicyContext
- java.lang.Object
-
- com.broadleafcommerce.data.tracking.core.policy.PolicyContext
-
public class PolicyContext extends Object
A thread context to keep track ofPolicyaspects 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 booleancanEqual(Object other)static voidclear(String signature)PolicyInformationderivePolicyInformation(PolicyInformation start)Embellish the currentPolicyInformationwith any inherited information from a parent PolicyInformation instance in logic flow.booleanequals(Object o)static PolicyContextgetContext()Map<String,PolicyInformation>getContextPolicies()PolicyInformationgetMostDerivedPolicyInformation()Policy validation flows may "stack" as a codepath progresses, and become more derived viaderivePolicyInformation(PolicyInformation).inthashCode()voidsetContextPolicies(Map<String,PolicyInformation> contextPolicies)StringtoString()
-
-
-
Method Detail
-
derivePolicyInformation
public PolicyInformation derivePolicyInformation(PolicyInformation start)
Embellish the currentPolicyInformationwith 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)
-
-