Class AdapterMock
java.lang.Object
org.casbin.jcasbin.persist.file_adapter.AdapterMock
- All Implemented Interfaces:
Adapter
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPolicy adds a policy rule to the storage.voidloadPolicy(Model model) loadPolicy loads all policy rules from the storage.private voidloadPolicyFile(Model model, Helper.loadPolicyLineHandler<String, Model> handler) voidremoveFilteredPolicy(String sec, String ptype, int fieldIndex, String... fieldValues) removeFilteredPolicy removes policy rules that match the filter from the storage.voidremovePolicy(String sec, String ptype, List<String> rule) removePolicy removes a policy rule from the storage.voidsavePolicy(Model model) savePolicy saves all policy rules to the storage.voidsetMockErr(String errorToSet)
-
Field Details
-
filePath
-
errorValue
-
-
Constructor Details
-
AdapterMock
-
-
Method Details
-
setMockErr
-
getMockErr
-
loadPolicy
Description copied from interface:AdapterloadPolicy loads all policy rules from the storage.- Specified by:
loadPolicyin interfaceAdapter- Parameters:
model- the model.
-
savePolicy
Description copied from interface:AdaptersavePolicy saves all policy rules to the storage.- Specified by:
savePolicyin interfaceAdapter- Parameters:
model- the model.
-
addPolicy
Description copied from interface:AdapteraddPolicy adds a policy rule to the storage. This is part of the Auto-Save feature. -
removePolicy
Description copied from interface:AdapterremovePolicy removes a policy rule from the storage. This is part of the Auto-Save feature.- Specified by:
removePolicyin interfaceAdapter- Parameters:
sec- the section, "p" or "g".ptype- the policy type, "p", "p2", .. or "g", "g2", ..rule- the rule, like (sub, obj, act).
-
removeFilteredPolicy
Description copied from interface:AdapterremoveFilteredPolicy removes policy rules that match the filter from the storage. This is part of the Auto-Save feature.- Specified by:
removeFilteredPolicyin interfaceAdapter- Parameters:
sec- the section, "p" or "g".ptype- the policy type, "p", "p2", .. or "g", "g2", ..fieldIndex- the policy rule's start index to be matched.fieldValues- the field values to be matched, value "" means not to match this field.
-
loadPolicyFile
private void loadPolicyFile(Model model, Helper.loadPolicyLineHandler<String, Model> handler) throws IOException- Throws:
IOException
-