1 22 package org.jboss.metadata.spi.scope; 23 24 import java.io.Serializable ; 25 26 32 public class Scope implements Serializable 33 { 34 35 private static final long serialVersionUID = 5255750644324593361L; 36 37 38 private final ScopeLevel level; 39 40 41 private final String qualifier; 42 43 public Scope(ScopeLevel level, String qualifier) 44 { 45 if (level == null) 46 throw new IllegalArgumentException ("Null level"); 47 if (qualifier == null) 48 throw new IllegalArgumentException ("Null qualifier"); 49 50 this.level = level; 51 this.qualifier = qualifier; 52 } 53 54 public ScopeLevel getScopeLevel() 55 { 56 return level; 57 } 58 59 public String getQualifier() 60 { 61 return qualifier; 62 } 63 64 public String toString() 65 { 66 return level.getName() + "=" + qualifier; 67 } 68 69 public boolean equals(Object object) 70 { 71 if (object == this) 72 return true; 73 if (object == null || object instanceof Scope == false) 74 return false; 75 76 Scope other = (Scope) object; 77 if (level.compareTo(other.getScopeLevel()) != 0) 78 return false; 79 80 return qualifier.equals(other.qualifier); 81 } 82 83 public int hashCode() 84 { 85 return level.hashCode(); 86 } 87 } 88 | Popular Tags |