/** * Get a permission which is identical to this one, but with new actions which consist of the union of the actions * from this permission and the action bits from the given value. The returned permission may or may not be a new * instance, and may be equal to this instance. * * @param actionBits the action bits * @return the permission (not {@code null}) */ public final This withActionBits(int actionBits) { return withNewActionBits(this.actionBits | actionBits & actionsMask()); }
/** * Get a permission which is identical to this one, but with new action bits as given by {@code actionBits}. * The returned permission may or may not be a new instance, and may be equal to this instance. * * @param actionBits the action bits * @return the permission (not {@code null}) */ @SuppressWarnings("unchecked") public final This withNewActionBits(int actionBits) { final int masked = actionBits & actionsMask(); if (masked == this.actionBits) { return (This) this; } else { return constructWithActionBits(masked); } }
retry: for (;;) { for (AbstractActionSetPermission<?> test : oldVal) { if (test.implies(merged)) { if (test.nameEquals(merged)) { merged = merged.withActionBits(permission.getActionBits()); if (! merged.implies(test)) { int i = 0; for (AbstractActionSetPermission<?> test : oldVal) { if (! permission.implies(test)) { newVal[i++] = test;
/** * Determine whether this permission's actions value implies the given action bits. * * @param actionBits the actions bits to test * @return {@code true} if this permission implies the given action bits; {@code false} otherwise */ public final boolean impliesActionBits(final int actionBits) { return isSet(this.actionBits, actionBits & actionsMask()); }
public final This withActions(final String actionsString) { return withActionBits(parseActions(actionsString)); }
public final boolean impliesActions(final String actions) { return impliesActionBits(parseActions(actions)); }
/** * Construct a new instance. * * @param name the permission name * @param actions the permission actions string * @param actionEnumeration the permission actions enumeration */ protected AbstractActionSetPermission(final String name, final String actions, final StringEnumeration actionEnumeration) { super(name); this.actionEnumeration = actionEnumeration; final int actionBits = parseActions(actions); this.actionBits = actionBits & actionsMask(); if (actionBits == actionsMask()) this.actions = "*"; }
public final boolean impliesActions(final This permission) { return permission != null && isSet(actionBits, permission.getActionBits()); }
public final This withNewActions(String actionsString) { return withNewActionBits(parseActions(actionsString)); }
public final This withNewActionsFrom(final This permission) { return withNewActionBits(permission.getActionBits()); }
public final This withActionsFrom(final This permission) { return withActionBits(permission.getActionBits()); }
public final This withoutActionsFrom(final This permission) { return withoutActionBits(permission.getActionBits()); }
public final This withoutActions(String actionsString) { return withoutActionBits(parseActions(actionsString)); }
/** * Get a permission which is identical to this one, but with new actions which consist of the actions * from this permission without the action bits from the given value. The returned permission may or may not be a new * instance, and may be equal to this instance. * * @param actionBits the action bits * @return the permission (not {@code null}) */ public final This withoutActionBits(int actionBits) { return withNewActionBits(this.actionBits & ~actionBits); }
/** * Construct a new instance. The given bits are masked by {@link #actionsMask()} before being stored in the object * instance. * * @param name the permission name * @param actionBits the permission action bits * @param actionEnumeration the permission actions enumeration */ protected AbstractActionSetPermission(final String name, final int actionBits, final StringEnumeration actionEnumeration) { super(name); this.actionEnumeration = actionEnumeration; this.actionBits = actionBits & actionsMask(); if (actionBits == actionsMask()) actions = "*"; }
public final boolean actionsEquals(final This permission) { return permission != null && actionBits == permission.getActionBits(); }
/** * Determine whether this permission's actions value implies the given action bits. * * @param actionBits the actions bits to test * @return {@code true} if this permission implies the given action bits; {@code false} otherwise */ public final boolean impliesActionBits(final int actionBits) { return isSet(this.actionBits, actionBits & actionsMask()); }
public final This withActions(final String actionsString) { return withActionBits(parseActions(actionsString)); }
public final boolean impliesActions(final String actions) { return impliesActionBits(parseActions(actions)); }
/** * Construct a new instance. * * @param name the permission name * @param actions the permission actions string * @param actionEnumeration the permission actions enumeration */ protected AbstractActionSetPermission(final String name, final String actions, final StringEnumeration actionEnumeration) { super(name); this.actionEnumeration = actionEnumeration; final int actionBits = parseActions(actions); this.actionBits = actionBits & actionsMask(); if (actionBits == actionsMask()) this.actions = "*"; }