public final class PolicySubject
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private static PolicyLogger |
LOGGER |
private java.util.List<Policy> |
policies |
private java.lang.Object |
subject |
| Constructor and Description |
|---|
PolicySubject(java.lang.Object subject,
java.util.Collection<Policy> policies)
Constructs a policy subject instance.
|
PolicySubject(java.lang.Object subject,
Policy policy)
Constructs a policy subject instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
attach(Policy policy)
Attaches another Policy instance to the policy subject.
|
Policy |
getEffectivePolicy(PolicyMerger merger)
Returns the effective policy of the subject, i.e.
|
java.lang.Object |
getSubject()
A unique identifier of the subject
Subjects may not always be uniquely identifiable.
|
java.lang.String |
toString()
An
Object.toString() method override. |
(package private) java.lang.StringBuffer |
toString(int indentLevel,
java.lang.StringBuffer buffer)
A helper method that appends indented string representation of this instance to the input string buffer.
|
private static final PolicyLogger LOGGER
private final java.util.List<Policy> policies
private final java.lang.Object subject
public PolicySubject(java.lang.Object subject,
Policy policy)
throws java.lang.IllegalArgumentException
subject - object to which the policies are attached. Must not be null.policy - first policy attached to the subject. Must not be null.java.lang.IllegalArgumentException - in case any of the arguments is null.public PolicySubject(java.lang.Object subject,
java.util.Collection<Policy> policies)
throws java.lang.IllegalArgumentException
subject - object to which the policies are attached. Must not be null.policies - first policy attached to the subject. Must not be null.java.lang.IllegalArgumentException - in case any of the arguments is null or
in case policies argument represents empty collection.public void attach(Policy policy)
policy - new policy instance to be attached to this subjectjava.lang.IllegalArgumentException - in case policy argument is null.public Policy getEffectivePolicy(PolicyMerger merger) throws PolicyException
PolicyExceptionpublic java.lang.Object getSubject()
public java.lang.String toString()
Object.toString() method override.toString in class java.lang.Objectjava.lang.StringBuffer toString(int indentLevel,
java.lang.StringBuffer buffer)
indentLevel - indentation level to be used.buffer - buffer to be used for appending string representation of this instance