211 212 if (credOwners == null || credOwners.length == 0) { 213 return new String[0][0]; 214 } 215 216 String[][] pArray = new String[credOwners.length][2]; 217 for (int i = 0; i < credOwners.length; i++) { 218 pArray[i][0] = credOwners[i].principalClass; 219 pArray[i][1] = credOwners[i].principalName; 220 } 221 return pArray; 222 } 223 224 /** 225 * Checks if this {@code PrivateCredentialPermission} implies 226 * the specified {@code Permission}. 227 * 228 * <p> 229 * 230 * This method returns true if: 231 * <p><ul> 232 * <li> <i>p</i> is an instanceof PrivateCredentialPermission and <p> 233 * <li> the target name for <i>p</i> is implied by this object's 234 * target name. For example: 235 * <pre> 236 * [* P1 "duke"] implies [a.b.Credential P1 "duke"]. 237 * [C1 P1 "duke"] implies [C1 P1 "duke" P2 "dukette"]. 238 * [C1 P2 "dukette"] implies [C1 P1 "duke" P2 "dukette"]. 239 * </pre> 240 * </ul> 241 * 242 * <p> 243 * 244 * @param p the {@code Permission} to check against. 245 * 246 * @return true if this {@code PrivateCredentialPermission} implies 247 * the specified {@code Permission}, false if not. 248 */ 249 public boolean implies(Permission p) { 250 251 if (p == null || !(p instanceof PrivateCredentialPermission)) 252 return false; | 211 212 if (credOwners == null || credOwners.length == 0) { 213 return new String[0][0]; 214 } 215 216 String[][] pArray = new String[credOwners.length][2]; 217 for (int i = 0; i < credOwners.length; i++) { 218 pArray[i][0] = credOwners[i].principalClass; 219 pArray[i][1] = credOwners[i].principalName; 220 } 221 return pArray; 222 } 223 224 /** 225 * Checks if this {@code PrivateCredentialPermission} implies 226 * the specified {@code Permission}. 227 * 228 * <p> 229 * 230 * This method returns true if: 231 * <ul> 232 * <li> <i>p</i> is an instanceof PrivateCredentialPermission and 233 * <li> the target name for <i>p</i> is implied by this object's 234 * target name. For example: 235 * <pre> 236 * [* P1 "duke"] implies [a.b.Credential P1 "duke"]. 237 * [C1 P1 "duke"] implies [C1 P1 "duke" P2 "dukette"]. 238 * [C1 P2 "dukette"] implies [C1 P1 "duke" P2 "dukette"]. 239 * </pre> 240 * </ul> 241 * 242 * <p> 243 * 244 * @param p the {@code Permission} to check against. 245 * 246 * @return true if this {@code PrivateCredentialPermission} implies 247 * the specified {@code Permission}, false if not. 248 */ 249 public boolean implies(Permission p) { 250 251 if (p == null || !(p instanceof PrivateCredentialPermission)) 252 return false; |