1 17 package org.apache.servicemix.jbi.security; 18 19 import java.security.Principal ; 20 21 22 27 public class GroupPrincipal implements Principal { 28 29 public static final GroupPrincipal ANY = new GroupPrincipal("*"); 30 31 private final String name; 32 private transient int hash; 33 34 public GroupPrincipal(String name) { 35 if (name == null) throw new IllegalArgumentException ("name cannot be null"); 36 this.name = name; 37 } 38 39 public String getName() { 40 return name; 41 } 42 43 public boolean equals(Object o) { 44 if (this == o) return true; 45 if (o == null || getClass() != o.getClass()) return false; 46 47 final GroupPrincipal that = (GroupPrincipal) o; 48 49 if (!name.equals(that.name)) return false; 50 51 return true; 52 } 53 54 public int hashCode() { 55 if (hash == 0) { 56 hash = name.hashCode(); 57 } 58 return hash; 59 } 60 61 public String toString() { 62 return name; 63 } 64 } 65 | Popular Tags |