/** * Determine whether this permission is equal to another permission. Returns {@code true} if * both {@link #actionsEquals(AbstractActionPermission)} and {@link #nameEquals(AbstractNamedPermission)} * return {@code true}. * * @param permission the other permission * @return {@code true} if this permission implies the other; {@code false} otherwise */ public final boolean equals(final This permission) { return super.equals(permission) && actionsEquals(permission); }
/** * Determine whether this permission implies the name of the given permission. * * @param permission the permission whose name is to be checked * @return {@code true} if this permission's name implies the given name, {@code false} otherwise */ public boolean impliesName(final This permission) { return permission != null && impliesName(permission.getName()); }
public final int hashCode() { return super.hashCode() * 53 + actionsHashCode(); }
/** * Determine whether this permission has a name equal to the name of the given permission. * * @param permission the permission whose name is to be checked * @return {@code true} if this permission's name is equal to the given permission's name, {@code false} otherwise */ public final boolean nameEquals(final This permission) { return permission != null && nameEquals(permission.getName()); }
public Permission nextElement() { final int bits = this.bits; if (bits == 0) throw new NoSuchElementException(); if (Integer.bitCount(bits) == getNameEnumeration().size()) { this.bits = 0; return ((AbstractNamedPermission<?>) getSourcePermission()).withName("*"); } int bit = Integer.lowestOneBit(bits); this.bits = bits & ~bit; return permissionFor(Integer.numberOfTrailingZeros(bit)); }
/** * Determine whether this permission implies the given name. * * @param name the name to check * @return {@code true} if this permission's name implies the given name, {@code false} otherwise */ public boolean impliesName(final String name) { return nameEquals("*") || nameEquals(name); }
/** * Determine whether this permission has a name equal to the given name. * * @param name the name to check * @return {@code true} if this permission's name is equal to the given name, {@code false} otherwise */ public boolean nameEquals(final String name) { return getName().equals(name); }
public boolean implies(final This permission) { return permission != null && impliesName(permission); }
public int hashCode() { return getClass().hashCode() * 71 + nameHashCode(); } }
/** * Determine whether this permission has a name equal to the name of the given permission. * * @param permission the permission whose name is to be checked * @return {@code true} if this permission's name is equal to the given permission's name, {@code false} otherwise */ public final boolean nameEquals(final This permission) { return permission != null && nameEquals(permission.getName()); }
public Permission nextElement() { final long bits = this.bits; if (bits == 0) throw new NoSuchElementException(); if (Long.bitCount(bits) == getNameEnumeration().size()) { this.bits = 0; return ((AbstractNamedPermission<?>) getSourcePermission()).withName("*"); } long bit = Long.lowestOneBit(bits); this.bits = bits & ~bit; return permissionFor(Long.numberOfTrailingZeros(bit)); }
public boolean equals(final This other) { return other != null && nameEquals(other); }
/** * Get the hash code of the name. The default implementation returns {@code getName().hashCode()}. * * @return the hash code of the name */ protected int nameHashCode() { return getName().hashCode(); }
/** * Determine whether this permission implies the name of the given permission. If * the permission is not of the same type as this permission, {@code false} is returned. * * @param permission the permission whose name is to be checked * @return {@code true} if this permission's name implies the given name, {@code false} otherwise */ @SuppressWarnings("unchecked") public final boolean impliesName(final Permission permission) { return permission != null && permission.getClass() == getClass() && impliesName((This) permission); }
public int hashCode() { return getClass().hashCode() * 71 + nameHashCode(); } }
/** * Determine whether this permission implies the name of the given permission. * * @param permission the permission whose name is to be checked * @return {@code true} if this permission's name implies the given name, {@code false} otherwise */ public boolean impliesName(final This permission) { return permission != null && impliesName(permission.getName()); }
/** * Determine whether this permission has a name equal to the name of the given permission. * * @param permission the permission whose name is to be checked * @return {@code true} if this permission's name is equal to the given permission's name, {@code false} otherwise */ public final boolean nameEquals(final This permission) { return permission != null && nameEquals(permission.getName()); }
private Permission permissionFor(int id) { return ((AbstractNamedPermission<?>)getSourcePermission()).withName(getNameEnumeration().nameOf(id)); }
/** * Determine whether this permission has a name equal to the name of the given permission. If the given permission * is of a different type than this permission, {@code false} is returned. * * @param permission the permission whose name is to be checked * @return {@code true} if this permission's name is equal to the given permission's name, {@code false} otherwise */ @SuppressWarnings("unchecked") public final boolean nameEquals(final Permission permission) { return permission != null && permission.getClass() == getClass() && nameEquals((This) permission); }
/** * Get the hash code of the name. The default implementation returns {@code getName().hashCode()}. * * @return the hash code of the name */ protected int nameHashCode() { return getName().hashCode(); }